57 lines
1.5 KiB
Haxe
57 lines
1.5 KiB
Haxe
|
package kernel;
|
||
|
|
||
|
import cc.OS;
|
||
|
import kernel.net.Package.NetworkID;
|
||
|
import lib.KVStore;
|
||
|
import cc.Settings;
|
||
|
|
||
|
class KernelSettings {
|
||
|
private static inline function setAllowStartup(value: Bool) {
|
||
|
Settings.set("shell.allow_startup", value);
|
||
|
}
|
||
|
|
||
|
private static inline function setAllowStartupFromFloppy(value: Bool) {
|
||
|
Settings.set("shell.allow_disk_startup", value);
|
||
|
}
|
||
|
|
||
|
private static function set(name: String, value: Dynamic) {
|
||
|
var kvstore = new KVStore("kernel");
|
||
|
kvstore.set(name, value);
|
||
|
kvstore.save();
|
||
|
}
|
||
|
|
||
|
private static function get(name: String): Null<Dynamic> {
|
||
|
var kvstore = new KVStore("kernel");
|
||
|
return kvstore.get(name);
|
||
|
}
|
||
|
|
||
|
public static var hostname(get,set): String;
|
||
|
private static var _hostname:String = get("hostname");
|
||
|
private static inline function get_hostname():String {
|
||
|
return _hostname;
|
||
|
}
|
||
|
|
||
|
private static inline function set_hostname(value:String):String {
|
||
|
OS.setComputerLabel(value);
|
||
|
set("hostname", value);
|
||
|
_hostname = value;
|
||
|
return value;
|
||
|
}
|
||
|
|
||
|
public static var siteController(get,set): NetworkID;
|
||
|
private static var _siteController:NetworkID = get("siteController");
|
||
|
private static function get_siteController():NetworkID {
|
||
|
return _siteController;
|
||
|
}
|
||
|
|
||
|
private static function set_siteController(value:NetworkID):NetworkID {
|
||
|
if (value == null) {
|
||
|
return get_siteController();
|
||
|
}
|
||
|
|
||
|
set("siteController", value);
|
||
|
_siteController = value;
|
||
|
return value;
|
||
|
}
|
||
|
}
|