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

Defines the default value to be added when using the ModConfig UI to add elements to a Collection (List, Set, or Dictionary value). 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. More...

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

Public Member Functions

 DefaultListValueAttribute (Type type, string value)
 
 DefaultListValueAttribute (char value)
 
 DefaultListValueAttribute (byte value)
 
 DefaultListValueAttribute (short value)
 
 DefaultListValueAttribute (int value)
 
 DefaultListValueAttribute (long value)
 
 DefaultListValueAttribute (float value)
 
 DefaultListValueAttribute (double value)
 
 DefaultListValueAttribute (bool value)
 
 DefaultListValueAttribute (string value)
 
 DefaultListValueAttribute (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 value to be added when using the ModConfig UI to add elements to a Collection (List, Set, or Dictionary value). 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.

Definition at line 108 of file ConfigAttributes.cs.

Constructor & Destructor Documentation

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

Definition at line 111 of file ConfigAttributes.cs.

111  {
112  try {
113  this.value = TypeDescriptor.GetConverter(type).ConvertFromInvariantString(value);
114  }
115  catch {
116  Logging.tML.Error("Default value attribute of type " + type.FullName + " threw converting from the string '" + value + "'.");
117  }
118  }
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( char  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( byte  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( short  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( int  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( long  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( float  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( double  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( bool  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( string  value)
Terraria.ModLoader.Config.DefaultListValueAttribute.DefaultListValueAttribute ( object  value)

Member Function Documentation

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

Definition at line 133 of file ConfigAttributes.cs.

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

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

133  {
134  if (obj == this) {
135  return true;
136  }
137  var other = obj as DefaultListValueAttribute;
138  if (other != null) {
139  if (Value != null) {
140  return Value.Equals(other.Value);
141  }
142  else {
143  return (other.Value == null);
144  }
145  }
146  return false;
147  }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 151 of file ConfigAttributes.cs.

Member Data Documentation

object Terraria.ModLoader.Config.DefaultListValueAttribute.value
private

Definition at line 110 of file ConfigAttributes.cs.

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

Definition at line 131 of file ConfigAttributes.cs.