Get RAPTOR

RaptorSuiteSettingsSwitches

Switch rows a project adds to the Suite's Settings pages.

NamespaceAssemblyKindStability
Raptor.EditorToolsRaptor.Editorclasspreview, since 0.1.0
public static class RaptorSuiteSettingsSwitches

Properties

Count

public static int Count { get; }

Gets the number of switches.

Ids

public static IReadOnlyList<string> Ids { get; }

Gets the ids in display order (order, then registration).

Version

public static int Version { get; }

Gets a counter that increases by one on every change.

Methods

IsRegistered

public static bool IsRegistered(string id)

Whether a switch with this id is registered.

ParameterTypeDescription
idstringThe row's stable id.

Returns: True when registered.

Register

public static bool Register(string id, string section, string group, string title, string description, Func<bool> get, Action<bool> set, string keywords = "", int order = 0, params string[] after)

Registers a Settings switch. Throws ArgumentException for a blank id, section, group or title, and ArgumentNullException for a null get or set.

ParameterTypeDefaultDescription
idstringThe row's stable id.
sectionstringThe Settings page.
groupstringThe group on that page.
titlestringThe row's title.
descriptionstringA few words shown as the row's tooltip, or "" for none.
getFunc<bool>Returns the switch state.
setAction<bool>Sets the switch state.
keywordsstring""Extra words the search matches.
orderint0Lower comes first; ties keep registration order.
afterparams string[]Anchor titles in fallback order.

Returns: False when the id is taken.

Call from an [InitializeOnLoad] static constructor on the main thread. A get or set that throws is logged, and a failing get reads as off.

TryGet

public static bool TryGet(string id, out Switch value)

Gets the registered switch with this id.

ParameterTypeDescription
idstringThe row's stable id.
valueout SwitchThe switch.

Returns: False when the id is not registered.