Terraria ModLoader  0.11.5
A framework for Terraria mods
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute Class Reference

Defines the default key value to be added when using the ModConfig UI to add elements to a Dictionary. Works the same as System.ComponentModel.DefaultValueAttribute, but can't inherit from it because it would break when deserializing any data structure annotated with it. This attribute compliments DefaultListValueAttribute when used annotating a Dictionary. More...

+ Inheritance diagram for Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute:
+ Collaboration diagram for Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute:

Public Member Functions

 DefaultDictionaryKeyValueAttribute (Type type, string value)
 
 DefaultDictionaryKeyValueAttribute (char value)
 
 DefaultDictionaryKeyValueAttribute (byte value)
 
 DefaultDictionaryKeyValueAttribute (short value)
 
 DefaultDictionaryKeyValueAttribute (int value)
 
 DefaultDictionaryKeyValueAttribute (long value)
 
 DefaultDictionaryKeyValueAttribute (float value)
 
 DefaultDictionaryKeyValueAttribute (double value)
 
 DefaultDictionaryKeyValueAttribute (bool value)
 
 DefaultDictionaryKeyValueAttribute (string value)
 
 DefaultDictionaryKeyValueAttribute (object value)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Public Attributes

virtual object Value => value
 

Protected Member Functions

void SetValue (object value)
 

Private Attributes

object value
 

Detailed Description

Defines the default key value to be added when using the ModConfig UI to add elements to a Dictionary. Works the same as System.ComponentModel.DefaultValueAttribute, but can't inherit from it because it would break when deserializing any data structure annotated with it. This attribute compliments DefaultListValueAttribute when used annotating a Dictionary.

Definition at line 160 of file ConfigAttributes.cs.

Constructor & Destructor Documentation

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( Type  type,
string  value 
)

Definition at line 163 of file ConfigAttributes.cs.

163  {
164  try {
165  this.value = TypeDescriptor.GetConverter(type).ConvertFromInvariantString(value);
166  }
167  catch {
168  Logging.tML.Error("Default value attribute of type " + type.FullName + " threw converting from the string '" + value + "'.");
169  }
170  }
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( char  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( byte  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( short  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( int  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( long  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( float  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( double  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( bool  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( string  value)
Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( object  value)

Member Function Documentation

override bool Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Equals ( object  obj)

Definition at line 185 of file ConfigAttributes.cs.

References Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Equals().

Referenced by Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Equals().

185  {
186  if (obj == this) {
187  return true;
188  }
189  var other = obj as DefaultDictionaryKeyValueAttribute;
190  if (other != null) {
191  if (Value != null) {
192  return Value.Equals(other.Value);
193  }
194  else {
195  return (other.Value == null);
196  }
197  }
198  return false;
199  }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

override int Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.GetHashCode ( )
void Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.SetValue ( object  value)
protected

Definition at line 203 of file ConfigAttributes.cs.

Member Data Documentation

object Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.value
private

Definition at line 162 of file ConfigAttributes.cs.

virtual object Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Value => value

Definition at line 183 of file ConfigAttributes.cs.