tModLoader v0.11.8.9
A mod to make and play 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 (bool value)
 
 DefaultDictionaryKeyValueAttribute (byte value)
 
 DefaultDictionaryKeyValueAttribute (char value)
 
 DefaultDictionaryKeyValueAttribute (double value)
 
 DefaultDictionaryKeyValueAttribute (float value)
 
 DefaultDictionaryKeyValueAttribute (int value)
 
 DefaultDictionaryKeyValueAttribute (long value)
 
 DefaultDictionaryKeyValueAttribute (object value)
 
 DefaultDictionaryKeyValueAttribute (short value)
 
 DefaultDictionaryKeyValueAttribute (string value)
 
 DefaultDictionaryKeyValueAttribute (Type type, string value)
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Protected Member Functions

void SetValue (object value)
 

Properties

virtual object Value [get]
 

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

◆ DefaultDictionaryKeyValueAttribute() [1/11]

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 }

References Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.value.

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

+ Here is the caller graph for this function:

◆ DefaultDictionaryKeyValueAttribute() [2/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( char  value)

◆ DefaultDictionaryKeyValueAttribute() [3/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( byte  value)

◆ DefaultDictionaryKeyValueAttribute() [4/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( short  value)

◆ DefaultDictionaryKeyValueAttribute() [5/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( int  value)

◆ DefaultDictionaryKeyValueAttribute() [6/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( long  value)

◆ DefaultDictionaryKeyValueAttribute() [7/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( float  value)

◆ DefaultDictionaryKeyValueAttribute() [8/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( double  value)

◆ DefaultDictionaryKeyValueAttribute() [9/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( bool  value)

◆ DefaultDictionaryKeyValueAttribute() [10/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( string  value)

◆ DefaultDictionaryKeyValueAttribute() [11/11]

Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute ( object  value)

Member Function Documentation

◆ Equals()

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

Definition at line 185 of file ConfigAttributes.cs.

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 }

References Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.DefaultDictionaryKeyValueAttribute(), and Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Value.

+ Here is the call graph for this function:

◆ GetHashCode()

override int Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.GetHashCode ( )

◆ SetValue()

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

Definition at line 203 of file ConfigAttributes.cs.

203 {
204 this.value = value;
205 }

References Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.value.

Member Data Documentation

◆ value

object Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.value
private

Property Documentation

◆ Value

virtual object Terraria.ModLoader.Config.DefaultDictionaryKeyValueAttribute.Value
get