Table of Contents

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

TItem

The 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

handler SettableUtil<TItem>.CustomSettableHandler<TValueType>
aliases string[]

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

instance TItem

Object to set the property for.

property string

Name of a property, field, custom handler, or an alias defined in CommandSettableAttribute.

value string

The value to set in string format.

provider IFormatProvider

Locale to use for parsing.

serviceProvider IServiceProvider
actualPropertyName string

Actual name of the discovered member. Never null unless property is null.

propertyType Type

Actual type of the discovered member. Never null, defaults to string if a property isn't found..

Returns

SetPropertyResult

A success/error code.