Class BowirePluginSetting

Namespace
Kuestenlogik.Bowire
Assembly
Kuestenlogik.Bowire.dll

Describes a single setting that a protocol plugin contributes to the Bowire Settings dialog. The UI renders a control (toggle, text, number, select) based on the Type and persists the value in localStorage under bowire_plugin_{pluginId}_{Key}.

public sealed record BowirePluginSetting : IEquatable<BowirePluginSetting>
Inheritance
BowirePluginSetting
Implements
Inherited Members

Remarks

#691 — the label and description travel to the browser already rendered, so no guard on the JavaScript side can see that they are English: the strings are not in the JavaScript. LabelKey and DescriptionKey are how a plugin says "the catalogue has a translation for this". Both are optional: a plugin that supplies neither renders exactly as it did before, which is what third-party plugins need — they have no entry in Bowire's catalogue and no way to add one.

They are init properties rather than positional parameters, and that is not a style choice. Appending two parameters to the primary constructor is source-compatible but NOT binary-compatible: the six-parameter .ctor stops existing, and every already-installed plugin compiled against it throws MissingMethodException the first time the settings endpoint touches it. The installed DIS plugin did exactly that, and took /api/protocols down with it — a blank Settings page for a translation nobody had asked for. A property changes no constructor, so an old binary keeps working untouched.

Constructors

BowirePluginSetting(string, string, string?, string, object?, IReadOnlyList<BowirePluginSettingOption>?)

Describes a single setting that a protocol plugin contributes to the Bowire Settings dialog. The UI renders a control (toggle, text, number, select) based on the Type and persists the value in localStorage under bowire_plugin_{pluginId}_{Key}.

public BowirePluginSetting(string Key, string Label, string? Description = null, string Type = "bool", object? DefaultValue = null, IReadOnlyList<BowirePluginSettingOption>? Options = null)

Parameters

Key string

Unique key within this plugin (e.g. "autoInterpretJson").

Label string

Human-readable label shown in the settings UI.

Description string

Optional description shown below the label.

Type string

Control type: "bool", "string", "number", "select".

DefaultValue object

Default value (bool, string, number, or string for select).

Options IReadOnlyList<BowirePluginSettingOption>

For "select" type: list of { value, label } pairs.

Remarks

#691 — the label and description travel to the browser already rendered, so no guard on the JavaScript side can see that they are English: the strings are not in the JavaScript. LabelKey and DescriptionKey are how a plugin says "the catalogue has a translation for this". Both are optional: a plugin that supplies neither renders exactly as it did before, which is what third-party plugins need — they have no entry in Bowire's catalogue and no way to add one.

They are init properties rather than positional parameters, and that is not a style choice. Appending two parameters to the primary constructor is source-compatible but NOT binary-compatible: the six-parameter .ctor stops existing, and every already-installed plugin compiled against it throws MissingMethodException the first time the settings endpoint touches it. The installed DIS plugin did exactly that, and took /api/protocols down with it — a blank Settings page for a translation nobody had asked for. A property changes no constructor, so an old binary keeps working untouched.

Properties

DefaultValue

Default value (bool, string, number, or string for select).

public object? DefaultValue { get; init; }

Property Value

object

Description

Optional description shown below the label.

public string? Description { get; init; }

Property Value

string

DescriptionKey

The same, for Description.

public string? DescriptionKey { get; init; }

Property Value

string

Key

Unique key within this plugin (e.g. "autoInterpretJson").

public string Key { get; init; }

Property Value

string

Label

Human-readable label shown in the settings UI.

public string Label { get; init; }

Property Value

string

LabelKey

#691 — optional catalogue key for Label. When the workbench's active locale has an entry for it, that entry is shown; otherwise Label is, exactly as before.

public string? LabelKey { get; init; }

Property Value

string

Options

For "select" type: list of { value, label } pairs.

public IReadOnlyList<BowirePluginSettingOption>? Options { get; init; }

Property Value

IReadOnlyList<BowirePluginSettingOption>

Type

Control type: "bool", "string", "number", "select".

public string Type { get; init; }

Property Value

string

Methods

Deconstruct(out string, out string, out string?, out string, out object?, out IReadOnlyList<BowirePluginSettingOption>?)

public void Deconstruct(out string Key, out string Label, out string? Description, out string Type, out object? DefaultValue, out IReadOnlyList<BowirePluginSettingOption>? Options)

Parameters

Key string
Label string
Description string
Type string
DefaultValue object
Options IReadOnlyList<BowirePluginSettingOption>

Equals(BowirePluginSetting?)

public bool Equals(BowirePluginSetting? other)

Parameters

other BowirePluginSetting

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(BowirePluginSetting?, BowirePluginSetting?)

public static bool operator ==(BowirePluginSetting? left, BowirePluginSetting? right)

Parameters

left BowirePluginSetting
right BowirePluginSetting

Returns

bool

operator !=(BowirePluginSetting?, BowirePluginSetting?)

public static bool operator !=(BowirePluginSetting? left, BowirePluginSetting? right)

Parameters

left BowirePluginSetting
right BowirePluginSetting

Returns

bool