Table of Contents

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

string

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

IReadOnlyList<string>

Platform

The settings every platform application has (SdkAppOptions), described in the language of the user interface.

public static SettingsSchema Platform { get; }

Property Value

SettingsSchema

Settings

Every setting, in the order the settings types declare them.

public IReadOnlyList<SettingDescriptor> Settings { get; }

Property Value

IReadOnlyList<SettingDescriptor>

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

other SettingsSchema

The other schema.

Returns

SettingsSchema

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

setting SettingDescriptor

The setting.

Returns

string

For(Type, string, ResourceManager?)

The schema of a settings type.

public static SettingsSchema For(Type optionsType, string section, ResourceManager? descriptions = null)

Parameters

optionsType Type

The settings type.

section string

The key of the section the type is bound from, under Root: CLI for Configuration:CLI; empty for a type whose properties are the sections themselves.

descriptions ResourceManager

Where the descriptions of the settings are; null when nothing describes them.

Returns

SettingsSchema

For<TOptions>(string, ResourceManager?)

The schema of a settings type.

public static SettingsSchema For<TOptions>(string section, ResourceManager? descriptions = null)

Parameters

section string

The key of the section the type is bound from, under Root: CLI for Configuration:CLI; empty for a type whose properties are the sections themselves.

descriptions ResourceManager

Where the descriptions of the settings are; null when nothing describes them.

Returns

SettingsSchema

Type Parameters

TOptions

The 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

settings IEnumerable<SettingDescriptor>

The settings.

Returns

SettingsSchema

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

configurationPath string

The 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

key string

The key: server.verbose.

setting SettingDescriptor

The setting.

Returns

bool

false when no setting has the key.

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

setting SettingDescriptor

The setting.

text string

The value, as it is written: false, 30, dark, i, j, k.

value object

The value: a bool, a long, a string - a choice as the schema spells it - or a list of strings.

Returns

bool

false when the text is no value of the setting.