Class ConfigEntryBase
Container for a single setting of a ConfigFile. Each config entry is linked to one config file.
Syntax
public abstract class ConfigEntryBase
Constructors
Types of defaultValue and definition.AcceptableValues have to be the same as settingType.
Declaration
protected ConfigEntryBase(ConfigFile configFile, ConfigDefinition definition, Type settingType, object defaultValue, ConfigDescription configDescription)
Parameters
Type | Name | Description |
---|---|---|
ConfigFile |
configFile |
|
ConfigDefinition |
definition |
|
System.Type |
settingType |
|
System.Object |
defaultValue |
|
ConfigDescription |
configDescription |
Properties
Get or set the value of the setting.
Declaration
public abstract object BoxedValue { get; set; }
Property Value
Type | Description |
---|---|
System.Object |
Config file this entry is a part of.
Declaration
public ConfigFile ConfigFile { get; }
Property Value
Type | Description |
---|---|
ConfigFile |
Default value of this setting (set only if the setting was not changed before).
Declaration
public object DefaultValue { get; }
Property Value
Type | Description |
---|---|
System.Object |
Category and name of this setting. Used as a unique key for identification within a ConfigFile.
Declaration
public ConfigDefinition Definition { get; }
Property Value
Type | Description |
---|---|
ConfigDefinition |
Description / metadata of this setting.
Declaration
public ConfigDescription Description { get; }
Property Value
Type | Description |
---|---|
ConfigDescription |
Type of the BoxedValue that this setting holds.
Declaration
public Type SettingType { get; }
Property Value
Type | Description |
---|---|
System.Type |
Methods
If necessary, clamp the value to acceptable value range. T has to be equal to settingType.
Declaration
protected T ClampValue<T>(T value)
Parameters
Type | Name | Description |
---|---|---|
T |
value |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Get the serialized representation of the value.
Declaration
public string GetSerializedValue()
Returns
Type | Description |
---|---|
System.String |
Trigger setting changed event.
Declaration
protected void OnSettingChanged(object sender)
Parameters
Type | Name | Description |
---|---|---|
System.Object |
sender |
Set the value by using its serialized form.
Declaration
public void SetSerializedValue(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String |
value |
Write a description of this setting using all available metadata.
Declaration
public void WriteDescription(StreamWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.StreamWriter |
writer |