Skip to main content

HashedGeneralValueConverter<T>

A class in Alta.Values, Alta.

Type converter that turns a string (a hash number or a name) into a HashedGeneralValue asset. Used by console commands to parse items, populations and stats.

Constructors​

MemberWhat it is
HashedGeneralValueConverter()Creates a HashedGeneralValueConverter with default values.

Fields​

1 private and internal field
MemberWhat it is
private static readonly Logger loggerLogs failed lookups.

Methods​

MemberWhat it is
override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)True for strings.
override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)Lowercases the string, looks it up as a hash if it's a number, otherwise by name. Logs a warning and returns null if not found.
protected virtual HashedGeneralValue<T> GetFromString(string input)Looks up the asset by name. Override for custom name matching.