2023-06-07 19:29:10 +00:00
|
|
|
package kernel;
|
|
|
|
|
|
|
|
import cc.OS;
|
|
|
|
import kernel.net.Package.NetworkID;
|
|
|
|
import lib.KVStore;
|
|
|
|
import cc.Settings;
|
|
|
|
|
|
|
|
class KernelSettings {
|
2023-07-30 13:55:22 +00:00
|
|
|
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 {
|
2023-06-07 19:29:10 +00:00
|
|
|
return _hostname;
|
|
|
|
}
|
|
|
|
|
2023-07-30 13:55:22 +00:00
|
|
|
private static inline function set_hostname(value:String):String {
|
|
|
|
OS.setComputerLabel(value);
|
|
|
|
set("hostname", value);
|
|
|
|
_hostname = value;
|
|
|
|
return value;
|
2023-06-07 19:29:10 +00:00
|
|
|
}
|
|
|
|
|
2023-07-30 13:55:22 +00:00
|
|
|
public static var siteController(get, set):NetworkID;
|
|
|
|
private static var _siteController:NetworkID = get("siteController");
|
|
|
|
|
2023-06-07 19:29:10 +00:00
|
|
|
private static function get_siteController():NetworkID {
|
|
|
|
return _siteController;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static function set_siteController(value:NetworkID):NetworkID {
|
2023-07-30 13:55:22 +00:00
|
|
|
if (value == null) {
|
|
|
|
return get_siteController();
|
|
|
|
}
|
2023-06-07 19:29:10 +00:00
|
|
|
|
2023-07-30 13:55:22 +00:00
|
|
|
set("siteController", value);
|
|
|
|
_siteController = value;
|
|
|
|
return value;
|
2023-06-07 19:29:10 +00:00
|
|
|
}
|
|
|
|
}
|