RaptorModules
Registry of Settings → Modules rows for optional modules, integrations and project add-ons.
| Namespace | Assembly | Kind | Stability |
|---|---|---|---|
Raptor.EditorTools | Raptor.Editor | class | preview, since 0.1.0 |
public static class RaptorModulesProperties
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.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's id. |
Returns: True when present.
IsRegistered
public static bool IsRegistered(string id)Whether a row with this id is registered.
| Parameter | Type | Description |
|---|---|---|
id | string | The 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.
| Parameter | Type | Description |
|---|---|---|
module | RaptorModule | The 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | The row's id. | |
label | string | Display name; empty uses the id. | |
kind | RaptorModuleKind | The group the row is listed under. | |
detect | Func<RaptorModuleStatus> | null | Returns the row's state; null means On. |
fixLabel | string | null | Fix button label; empty uses "Fix". |
fix | Action | null | The 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.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's id. |
icon | string | The 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.
| Parameter | Type | Description |
|---|---|---|
module | RaptorModule | The 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.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's id. |
Returns: The state.
TryGet
public static bool TryGet(string id, out RaptorModule module)Gets the row with this id.
| Parameter | Type | Description |
|---|---|---|
id | string | The row's id. |
module | out RaptorModule | The row. |
Returns: False when the id is not registered.
Events
Changed
public static event Action Changed;Raised after a row is added.
Related types
- 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.