Class TextModeCRTPresetRegistry
Finds the CRT presets in every Resources/CRT/Presets folder of the project.
Inherited Members
Namespace: Scylla.TextMode.CRT
Assembly: ScyllaTextMode.CRT.dll
Syntax
public static class TextModeCRTPresetRegistry
Remarks
The presets are loaded on first access and sorted by Order,
then by display name, because the order Resources.LoadAll returns is not stable. Call Refresh() after adding
preset assets at edit time.
Presets made at runtime with Create(string, string, TextModeCRTSettings, int) are listed once they are passed to Register(TextModeCRTPreset), until the runtime stops.
Fields
RESOURCES_FOLDER
Resources folder the presets are loaded from.
Declaration
public const string RESOURCES_FOLDER = "CRT/Presets"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Find(string)
Finds a preset by display name or asset name, ignoring case.
Declaration
public static TextModeCRTPreset Find(string presetName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | presetName | The name to look for. |
Returns
| Type | Description |
|---|---|
| TextModeCRTPreset | The preset, or null if none matches. |
FindDefault()
Finds the default preset: the one named in the TextMode configuration when the module is running, otherwise DEFAULT_CRT_PRESET.
Declaration
public static TextModeCRTPreset FindDefault()
Returns
| Type | Description |
|---|---|
| TextModeCRTPreset | The default preset, or null if no preset of that name exists. |
GetAll()
Gets every preset, sorted by Order and then by display name.
Declaration
public static IReadOnlyList<TextModeCRTPreset> GetAll()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<TextModeCRTPreset> | The presets. The list is shared; do not modify it. |
Refresh()
Discards the loaded list so the next access loads the presets again.
Declaration
public static void Refresh()
Register(TextModeCRTPreset)
Adds a preset that is not in a Resources/CRT/Presets folder, such as one made at
runtime with Create(string, string, TextModeCRTSettings, int). It is listed in its sort position
until the runtime stops, and survives Refresh().
Declaration
public static void Register(TextModeCRTPreset preset)
Parameters
| Type | Name | Description |
|---|---|---|
| TextModeCRTPreset | preset | The preset to add. Null is ignored. |
Remarks
Registering a preset that is already listed, including one that was saved as an asset in a presets folder after it was created, does not list it twice.
Unregister(TextModeCRTPreset)
Removes a preset added with Register(TextModeCRTPreset). A preset that is also an asset in a presets folder stays listed.
Declaration
public static bool Unregister(TextModeCRTPreset preset)
Parameters
| Type | Name | Description |
|---|---|---|
| TextModeCRTPreset | preset | The preset to remove. |
Returns
| Type | Description |
|---|---|
| bool | True if the preset was registered. |