Panel
public sealed class PanelNamespace Snitch.Api
Fluent builder for a mod’s Snitch panel (returned by Profiler.RegisterPanel). Counters/state added here get an id of “<panelId>.<name>” so they group under the panel automatically. Everything is a safe no-op when the Snitch host is absent.
Properties
Section titled “Properties”public string Id { get; }The panel id (also the default log channel).
Methods
Section titled “Methods”Counter
Section titled “Counter”public Panel Counter(string name, Func<double> read, string unit = null)A numeric gauge shown in this panel. Registered as “<panelId>.<name>”.
| Parameter | |
|---|---|
name | The counter name inside the panel, e.g. “Queue”. Null or empty uses the panel id itself. |
read | Returns the current value. Called on the main thread at the poll rate. |
unit | Text shown after the value, e.g. “items” or “ms”. Null shows no unit. |
State(Func)
Section titled “State(Func)”public Panel State(Func<StateSnapshot> snapshot)Types: StateSnapshot
A state distribution shown in this panel (uses the panel id).
| Parameter | |
|---|---|
snapshot | Returns the current distribution. Called on the main thread at the poll rate. |
State(string, Func)
Section titled “State(string, Func)”public Panel State(string name, Func<StateSnapshot> snapshot)Types: StateSnapshot
A named state distribution shown in this panel. Registered as “<panelId>.<name>”.
| Parameter | |
|---|---|
name | The distribution name inside the panel, e.g. “Jobs”. Null or empty uses the panel id itself. |
snapshot | Returns the current distribution. Called on the main thread at the poll rate. |
public Panel Text(Func<string> provider)A free-text, multi-line readout in this panel.
Action
Section titled “Action”public Panel Action(string label, Action run)A clickable button (replaces a debug hotkey action).
| Parameter | |
|---|---|
label | The button text, e.g. “Force cosmetic”. The id for snitch act is built as in Profiler.RegisterAction. |
run | Runs on the main thread when the button is pressed. |
Toggle
Section titled “Toggle”public Panel Toggle(string label, Func<bool> get, Action<bool> set)An on/off control (replaces a debug toggle hotkey).
| Parameter | |
|---|---|
label | The text next to the switch. The id for snitch toggle is built as in Profiler.RegisterAction. |
get | Returns the current state. |
set | Applies a new state. |
Slider
Section titled “Slider”public Panel Slider( string label, double min, double max, Func<double> get, Action<double> set, double step = 0d, string unit = null)A draggable value (replaces typing a number into a console to find it). The host clamps to the range and snaps to step before your setter sees it.
| Parameter | |
|---|---|
label | The text next to the slider. The id for snitch slider is built as in Profiler.RegisterAction. |
min | The lowest value. |
max | The highest value. It must be greater than min, otherwise nothing is registered. |
get | Returns the current value. |
set | Applies a new value, already clamped and snapped. |
step | The snap size, e.g. 5. 0 or less is continuous. |
unit | Text shown after the value, e.g. “m”. Null shows no unit. |
public Panel Log()Show this panel’s own log channel inside the panel.
public void Write(string message, LogLevel level = LogLevel.Info)Types: LogLevel
Send a log line to this panel’s channel (and the combined timeline).
| Parameter | |
|---|---|
message | The log text. Null or empty is ignored. |
level | Info, Warning or Error. |