Class SettableUtil<TItem>
- Namespace
- Uncreated.Warfare.Configuration
- Assembly
- Uncreated.Warfare.dll
Allows for setting properties and fields via string input (such as a command).
public static class SettableUtil<TItem> where TItem : class
Type Parameters
TItemThe declaring type of the variables being set.
- Inheritance
-
SettableUtil<TItem>
- Inherited Members
Methods
AddCustomHandler<TValueType>(CustomSettableHandler<TValueType>, params string[])
Allows you to add custom set methods to types.
public static void AddCustomHandler<TValueType>(SettableUtil<TItem>.CustomSettableHandler<TValueType> handler, params string[] aliases)
Parameters
handlerSettableUtil<TItem>.CustomSettableHandler<TValueType>aliasesstring[]
Type Parameters
TValueType
Remarks
The first alias will be the display name for the property.
Exceptions
- ArgumentException
Must have at least one alias.
SetProperty(TItem, string, string, IFormatProvider, IServiceProvider, out string?, out Type)
Parse value into the type of property (a field or property in TItem) and set the property if it has the CommandSettableAttribute.
public static SetPropertyResult SetProperty(TItem instance, string property, string value, IFormatProvider provider, IServiceProvider serviceProvider, out string? actualPropertyName, out Type propertyType)
Parameters
instanceTItemObject to set the property for.
propertystringName of a property, field, custom handler, or an alias defined in CommandSettableAttribute.
valuestringThe value to set in string format.
providerIFormatProviderLocale to use for parsing.
serviceProviderIServiceProvideractualPropertyNamestringActual name of the discovered member. Never null unless
propertyis null.propertyTypeTypeActual type of the discovered member. Never null, defaults to string if a property isn't found..
Returns
- SetPropertyResult
A success/error code.