Presets<T>

References
[IoId("00000000-7afb-41e0-b4e1-4c489e4646ee")] public sealed class Presets<T> : IPresets
Generic implementation of IPresets.
T

Constructors

Presets

#
public Presets()
Empty preset constructor.

Presets

#
public Presets(IReader reader)
reader (IReader)

Properties

AllPresets

#
public IEnumerable<Preset<T>> AllPresets { get; }
Enumerate over all name+value pairs.

Count

#
public int Count { get; }
Gets the number of preset values.
Count
Explicit

IPresets.AllPresets

#
AllPresets

Names

#
public IEnumerable<string> Names { get; }
Enumerate over all names.
Names

Indexers

Explicit

IPresets.this[]

#
IPreset IPresets.this[int index]
index (int)
this[]
Explicit

IPresets.this[]

#
name (string)
this[]

this[]

#
public Preset<T> this[int index] { get; }
Access a specific name+value pair.
index (int)Index of pair.

this[]

#
public Preset<T> this[string name] { get; }
Access a specific value by name.
name (string)Name of value.

Methods

Add

#
public bool Add(Preset<T> preset)
Attempt to add a preset.
preset (Preset<T>)Preset to add.
True if preset was successfully added.

Add

#
public bool Add(string name, string info, Color tint, T value)
Attempt to add a preset.
name (string)Name of preset.
info (string)Description of preset.
tint (Color)Colour of preset.
value (T)Value of preset.
True if preset was successfully added.

Add

#
public bool Add(string name, string info, T value)
Attempt to add a preset.
name (string)Name of preset.
info (string)Description of preset.
value (T)Value of preset.
True if preset was successfully added.

AddEnum<TE>

#
public int AddEnum<TE>()
Add all values from an enum as presets. This will only work if the enum numeric base type is compatible with the T constraint. The values are added under their own name, unless they have a [UiName] attribute.
Number of added values.

AddEnumByType

#
public int AddEnumByType(Type enumType)
Add all values from an enum as presets. This will only work if the enum numeric base type is compatible with the T constraint. The values are added under their own name, unless they have a [UiName] attribute.
enumType (Type)
Number of added values.

Clear

#
public void Clear()
Wipe all defined presets.
Clear

FindByValue

#
public Preset<T> FindByValue(object value)
Attempt to find the name of a value. If the value is of the wrong type or otherwise unknown to this preset collection, null or an empty string may be returned.
value (object)
Explicit

IPresets.FindByValue

#
IPreset IPresets.FindByValue(object value)
value (object)
FindByValue
Explicit

IPresets.TryCopyFrom

#
int IPresets.TryCopyFrom(IPresets other)
other (IPresets)
TryCopyFrom

IsAvailable

#
public bool IsAvailable(string name)
Gets whether a specific name is still available and adheres to the naming scheme.
name (string)Name to test.
True if name hasn't been defined.
IsAvailable

Store

#
public void Store(IWriter writer)
writer (IWriter)
Store

TryCopyFrom

#
public int TryCopyFrom(Presets<T> other)
Try and copy all presets from another collection.
other (Presets<T>)
Number of presets successfully copied.