Class SettingsSchema
- Namespace
- RDCore.SDK.Server.Configuration
- Assembly
- RDCore.SDK.dll
The settings a platform application can be configured with, as its settings types declare them: what a client offers to change, and checks a value against before it changes one.
public sealed class SettingsSchema
- Inheritance
-
SettingsSchema
- Inherited Members
Remarks
A schema is read off the settings types by reflection. A property that has a public setter is a setting when its type is a bool, a whole number, an enum, a string or a list of strings; a property whose type is a settings type of its own is a section, whose settings are read the same way. Any other property is not something a value can be written for, and is not in the schema.
When a change takes effect is what SettingAttribute says, of the setting or of the section it is in; a setting that nothing says it of is Live. A setting only the deployed configuration sets (Deployment) is in the schema too, so that a client can say why it is not changed.
The description of a setting is the string of its key in descriptions, its dots written as underscores: Server_Verbose.
Fields
Root
The section of the configuration the settings of the platform are under, in every application's appsettings.json.
public const string Root = "Configuration"
Field Value
Properties
Languages
The languages the platform describes its settings in, by their two-letter name: what an extension's manifest carries a description of each setting in (SettingDescriptions). The first is the language of a description no other one is found in.
public static IReadOnlyList<string> Languages { get; }
Property Value
Platform
The settings every platform application has (SdkAppOptions), described in the language of the user interface.
public static SettingsSchema Platform { get; }
Property Value
Settings
Every setting, in the order the settings types declare them.
public IReadOnlyList<SettingDescriptor> Settings { get; }
Property Value
Methods
Combine(SettingsSchema)
The settings of this schema and of other: the platform's and an application's own.
public SettingsSchema Combine(SettingsSchema other)
Parameters
otherSettingsSchemaThe other schema.
Returns
Exceptions
- ArgumentException
Both schemas have a setting of the same key.
ConfigurationPathOf(SettingDescriptor)
The path of the configuration a setting's value is at: Configuration:Server:Verbose.
public static string ConfigurationPathOf(SettingDescriptor setting)
Parameters
settingSettingDescriptorThe setting.
Returns
For(Type, string, ResourceManager?)
The schema of a settings type.
public static SettingsSchema For(Type optionsType, string section, ResourceManager? descriptions = null)
Parameters
optionsTypeTypeThe settings type.
sectionstringThe key of the section the type is bound from, under Root:
CLIforConfiguration:CLI; empty for a type whose properties are the sections themselves.descriptionsResourceManagerWhere the descriptions of the settings are; null when nothing describes them.
Returns
For<TOptions>(string, ResourceManager?)
The schema of a settings type.
public static SettingsSchema For<TOptions>(string section, ResourceManager? descriptions = null)
Parameters
sectionstringThe key of the section the type is bound from, under Root:
CLIforConfiguration:CLI; empty for a type whose properties are the sections themselves.descriptionsResourceManagerWhere the descriptions of the settings are; null when nothing describes them.
Returns
Type Parameters
TOptionsThe settings type.
From(IEnumerable<SettingDescriptor>)
A schema of settings that are already described: those of an extension's manifest (SettingsIn(CultureInfo)).
public static SettingsSchema From(IEnumerable<SettingDescriptor> settings)
Parameters
settingsIEnumerable<SettingDescriptor>The settings.
Returns
Exceptions
- ArgumentException
Two settings have the same key.
Governing(string)
The setting a path of the configuration is the value of, or a part of the value of - an item of a list: Configuration:Server:Verbose.
public SettingDescriptor? Governing(string configurationPath)
Parameters
configurationPathstringThe path, its sections separated by
:.
Returns
- SettingDescriptor
The setting; null when the path is of no setting of the schema.
TryFind(string, out SettingDescriptor?)
Gets the setting of a key, without regard to case.
public bool TryFind(string key, out SettingDescriptor? setting)
Parameters
keystringThe key:
server.verbose.settingSettingDescriptorThe setting.
Returns
TryParse(SettingDescriptor, string, out object?)
Reads a value of a setting as it is written - at a prompt, on a command line - and gives it as the configuration has it.
public static bool TryParse(SettingDescriptor setting, string text, out object? value)
Parameters
settingSettingDescriptorThe setting.
textstringThe value, as it is written:
false,30,dark,i, j, k.valueobjectThe value: a bool, a long, a string - a choice as the schema spells it - or a list of strings.