βοΈCustom Settings
You can add your own custom settings, too!
Defining custom settings
π©Settings Formatinternal class OxygenSettings : BaseKernelConfig, IKernelConfig
{
// Your custom settings here
}internal class OxygenSettings : BaseKernelConfig, IKernelConfig
{
// Your JSON representation about your settings entries
private readonly string _entriesJson =
"""
[
{
"Name": "CustomSection",
"Desc": "This is the custom section.",
"DisplayAs": "Custom section",
"Keys": [
{
"Name": "Custom switch",
"Type": "SBoolean",
"Variable": "CustomSwitch",
"Description": "Specifies the custom switch."
},
{
"Name": "Custom character",
"Type": "SChar",
"Variable": "CustomChar",
"Description": "Specifies the custom character."
},
{
"Name": "Custom color",
"Type": "SColor",
"Variable": "CustomColor",
"Description": "Specifies the custom color."
},
{
"Name": "Custom double",
"Type": "SDouble",
"Variable": "CustomDouble",
"Description": "Specifies the custom double."
},
{
"Name": "Custom figlet font",
"Type": "SFiglet",
"Variable": "CustomFigletFont",
"Description": "Specifies the custom figlet font."
},
{
"Name": "Custom integer",
"Type": "SInt",
"Variable": "CustomInt",
"Description": "Specifies the custom integer."
},
{
"Name": "Custom integer slider",
"Type": "SIntSlider",
"Variable": "CustomIntSlider",
"Description": "Specifies the custom integer slider.",
"MinimumValue": 0,
"MaximumValue": 255
},
{
"Name": "Custom list",
"Type": "SList",
"Variable": "CustomList",
"SelectionFunctionName": "GetPathList",
"SelectionFunctionType": "Filesystem",
"DelimiterVariable": "PathLookupDelimiter",
"IsValuePath": true,
"IsPathCurrentPath": true,
"Description": "Specifies the custom list."
},
{
"Name": "Custom preset",
"Type": "SPreset",
"Variable": "CustomPreset",
"ShellType": "Shell",
"Description": "Specifies the custom preset."
},
{
"Name": "Custom selection",
"Type": "SSelection",
"Variable": "CustomSelection",
"IsEnumeration": false,
"SelectionFunctionName": "ListAllLanguages",
"SelectionFunctionType": "LanguageManager",
"IsSelectionFunctionDict": true,
"SelectionFallback": [ "en-US" ],
"Description": "Specifies the custom selection."
},
{
"Name": "Custom string",
"Type": "SString",
"Variable": "CustomString",
"Description": "Specifies the custom string."
}
]
}
]
""";
// You must override this
public override SettingsEntry[] SettingsEntries =>
ConfigTools.GetSettingsEntries(_entriesJson);
// Your variables. Your JSON representation of the entries must contain information about these
public char CustomChar { get; set; } = 'A';
public string CustomColor { get; set; } = Color.Empty.PlainSequence;
public double CustomDouble { get; set; } = 0.5d;
public bool CustomSwitch { get; set; } = true;
public string CustomFigletFont { get; set; } = "small";
public int CustomInt { get; set; } = 1;
public int CustomIntSlider { get; set; } = 4;
public string CustomList { get; set; } = "";
public string CustomPreset { get; set; } = "Default";
public string CustomString { get; set; } = "Default";
public string CustomSelection { get; set; } = "en-US";
}Testing your own custom settings
Last updated