Table of Contents

Interface IDefiningConfigKey

Namespace
MonkeyLoader.Configuration
Assembly
MonkeyLoader.dll

Defines the definition for a config item.

public interface IDefiningConfigKey : ITypedConfigKey, IConfigKey, IEquatable<IConfigKey>, IEntity<IDefiningConfigKey>, IEnumerable<IComponent<IDefiningConfigKey>>, IEnumerable, INestedIdentifiable<ConfigSection>, INestedIdentifiable, IIdentifiable, IPrioritizable
Inherited Members
Extension Methods

Properties

Config

Gets the config this item belongs to.

Config Config { get; }

Property Value

Config

Description

Gets the human-readable description of this config item.

string? Description { get; }

Property Value

string

HasChanges

Gets or sets whether this config item has unsaved changes.

bool HasChanges { get; set; }

Property Value

bool

HasDescription

Gets whether this config item has a human-readable description.

bool HasDescription { get; }

Property Value

bool

true if Description is not null; otherwise, false.

HasValue

Gets whether this config item has a set value.

bool HasValue { get; }

Property Value

bool

Remarks

Should be automatomatically set to true when a different value is set.

InternalAccessOnly

Gets whether only the owning mod should have access to this config item.

bool InternalAccessOnly { get; }

Property Value

bool

Section

Gets the ConfigSection this item belongs to.

ConfigSection Section { get; set; }

Property Value

ConfigSection

Remarks

Should only be set once when the owning ConfigSection is initializing.

Methods

GetValue()

Gets this config item's set value, falling back to the computed default.

object? GetValue()

Returns

object

The item's internal value or its type's default.

Reset()

Removes this config item's value and attempts to reset it back to its default.

void Reset()

SetValue(object?, string?)

Set the config item's internal value to the given one.

void SetValue(object? value, string? eventLabel = null)

Parameters

value object

The value to set.

eventLabel string

The custom label that may be set by whoever changed the config.

Exceptions

ArgumentException

The value didn't pass validation.

TryComputeDefault(out object?)

Tries to compute the default value for this key, if a default provider was set.

bool TryComputeDefault(out object? defaultValue)

Parameters

defaultValue object

The computed default value if the return value is true. Otherwise default.

Returns

bool

true if the default value was successfully computed.

TryGetValue(out object?)

Tries to get this config item's set value, falling back to the computed default.

bool TryGetValue(out object? value)

Parameters

value object

The item's internal value or its type's default.

Returns

bool

true if the config item's value was set or a default could be computer, otherwise false.

TrySetValue(object?, string?)

Tries to set the config item's internal value to the given one if it passes validation.

bool TrySetValue(object? value, string? eventLabel = null)

Parameters

value object

The value to set.

eventLabel string

The custom label that may be set by whoever changed the config.

Returns

bool

true if the value was successfully set, otherwise false.

Unset()

Removes this config item's value, setting it to its type's default.

bool Unset()

Returns

bool

Whether there was a value to remove.

Validate(object?)

Checks if a value is valid for this config item.

bool Validate(object? value)

Parameters

value object

The value to check.

Returns

bool

true if the value is valid.

Events

Changed

Triggered when the internal value of this config item changes.

event ConfigKeyChangedEventHandler? Changed

Event Type

ConfigKeyChangedEventHandler