Get RAPTOR

RaptorModules

Registry of Settings → Modules rows for optional modules, integrations and project add-ons.

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

Properties

All

public static IReadOnlyList<RaptorModule> All { get; }

Gets a snapshot of every row in registration order.

Count

public static int Count { get; }

Gets the number of rows.

Version

public static int Version { get; }

Gets a counter that increases by one on every change.

Methods

IsPresent

public static bool IsPresent(string id)

Whether the row is registered and its state is not Missing.

ParameterTypeDescription
idstringThe row's id.

Returns: True when present.

IsRegistered

public static bool IsRegistered(string id)

Whether a row with this id is registered.

ParameterTypeDescription
idstringThe row's id.

Returns: True when registered.

Register

public static bool Register(RaptorModule module)

Adds a row. Returns false and keeps the existing row when the id is already registered.

ParameterTypeDescription
moduleRaptorModuleThe row.

Returns: False when the id is taken.

Call from an [InitializeOnLoad] static constructor on the main thread.

Register

public static bool Register(string id, string label, RaptorModuleKind kind, Func<RaptorModuleStatus> detect = null, string fixLabel = null, Action fix = null)

Creates a RaptorModule and registers it.

ParameterTypeDefaultDescription
idstringThe row's id.
labelstringDisplay name; empty uses the id.
kindRaptorModuleKindThe group the row is listed under.
detectFunc<RaptorModuleStatus>nullReturns the row's state; null means On.
fixLabelstringnullFix button label; empty uses "Fix".
fixActionnullThe fix action; null means no fix button.

Returns: False when the id is taken.

Call from an [InitializeOnLoad] static constructor on the main thread.

SetIcon

public static void SetIcon(string id, string icon)

Sets the icon the module's row in Settings → Modules draws (a RAPTOR icon name such as "tool-logic"). Null or empty clears it. A row with none draws the module mark.

ParameterTypeDescription
idstringThe row's id.
iconstringThe icon name, or null.

Call from an [InitializeOnLoad] static constructor on the main thread. Calling it again with the same values changes nothing.

StatusOf

public static RaptorModuleStatus StatusOf(RaptorModule module)

Runs the row's detector and returns its state. A row without a detector is On. A detector that throws returns Missing with the word "Error" and is logged once per id.

ParameterTypeDescription
moduleRaptorModuleThe row.

Returns: The state.

StatusOf

public static RaptorModuleStatus StatusOf(string id)

Returns the row's current state, or Missing when the id is not registered.

ParameterTypeDescription
idstringThe row's id.

Returns: The state.

TryGet

public static bool TryGet(string id, out RaptorModule module)

Gets the row with this id.

ParameterTypeDescription
idstringThe row's id.
moduleout RaptorModuleThe row.

Returns: False when the id is not registered.

Events

Changed

public static event Action Changed;

Raised after a row is added.

  • RaptorModuleStatus: A module's state and its status word (for example "On", "No masks", "Fog OK").
  • RaptorModuleKind: Whether a RaptorModule is a RAPTOR add-on, a third-party integration, or project code.