Terraria ModLoader  0.10.1.5
A framework for Terraria mods
Terraria.ModLoader.Config.ConfigManager Class Reference
+ Collaboration diagram for Terraria.ModLoader.Config.ConfigManager:

Static Public Member Functions

static object AlternateCreateInstance (Type type)
 
static T GetCustomAttribute< T > (PropertyFieldWrapper memberInfo, object item, object array)
 
static IEnumerable< PropertyFieldWrapper > GetFieldsAndProperties (object item)
 
static Tuple< UIElement, UIElement > WrapIt (UIElement parent, ref int top, PropertyFieldWrapper memberInfo, object item, int order, object array=null, Type arrayType=null, int index=-1)
 

Static Public Attributes

static readonly string ModConfigPath = Path.Combine(Main.SavePath, "Mod Configs")
 
static readonly JsonSerializerSettings serializerSettings
 
static readonly string ServerModConfigPath = Path.Combine(Main.SavePath, "Mod Configs", "Server")
 

Static Private Attributes

static readonly IList< JsonConverter > converters
 
static readonly IDictionary< Mod, List< ModConfig > > LoadTimeConfigs = new Dictionary<Mod, List<ModConfig>>()
 

Detailed Description

Definition at line 17 of file ConfigManager.cs.

Member Function Documentation

static object Terraria.ModLoader.Config.ConfigManager.AlternateCreateInstance ( Type  type)
static

Definition at line 313 of file ConfigManager.cs.

314  {
315  if (type == typeof(string))
316  return "";
317  return Activator.CreateInstance(type);
318  }
static T Terraria.ModLoader.Config.ConfigManager.GetCustomAttribute< T > ( PropertyFieldWrapper  memberInfo,
object  item,
object  array 
)
static
Type Constraints
T :Attribute 

Definition at line 322 of file ConfigManager.cs.

322  : Attribute {
323  // Class
324  T attribute = (T)Attribute.GetCustomAttribute(memberInfo.Type, typeof(T), true);
325  if (array != null)
326  {
327  // item null?
328  // attribute = (T)Attribute.GetCustomAttribute(item.GetType(), typeof(T), true) ?? attribute; // TODO: is this wrong?
329  }
330  // Member
331  attribute = (T)Attribute.GetCustomAttribute(memberInfo.MemberInfo, typeof(T)) ?? attribute;
332  return attribute;
333  }
static IEnumerable<PropertyFieldWrapper> Terraria.ModLoader.Config.ConfigManager.GetFieldsAndProperties ( object  item)
static

Definition at line 298 of file ConfigManager.cs.

Referenced by Terraria.ModLoader.Config.ModConfig.NeedsReload().

299  {
300  PropertyInfo[] properties = item.GetType().GetProperties(
301  //BindingFlags.DeclaredOnly |
302  BindingFlags.Public |
303  BindingFlags.Instance);
304 
305  FieldInfo[] fields = item.GetType().GetFields(
306  //BindingFlags.DeclaredOnly |
307  BindingFlags.Public |
308  BindingFlags.Instance);
309 
310  return fields.Select(x => new PropertyFieldWrapper(x)).Concat(properties.Select(x => new PropertyFieldWrapper(x)));
311  }

+ Here is the caller graph for this function:

static Tuple<UIElement, UIElement> Terraria.ModLoader.Config.ConfigManager.WrapIt ( UIElement  parent,
ref int  top,
PropertyFieldWrapper  memberInfo,
object  item,
int  order,
object  array = null,
Type  arrayType = null,
int  index = -1 
)
static

Definition at line 335 of file ConfigManager.cs.

336  {
337  // public api for modders.
338  return UIModConfig.WrapIt(parent, ref top, memberInfo, item, order, array, arrayType, index);
339  }

Member Data Documentation

readonly IList<JsonConverter> Terraria.ModLoader.Config.ConfigManager.converters
staticprivate
Initial value:
= new List<JsonConverter>() {
new Newtonsoft.Json.Converters.VersionConverter(),
}

Definition at line 45 of file ConfigManager.cs.

readonly IDictionary<Mod, List<ModConfig> > Terraria.ModLoader.Config.ConfigManager.LoadTimeConfigs = new Dictionary<Mod, List<ModConfig>>()
staticprivate

Definition at line 25 of file ConfigManager.cs.

readonly string Terraria.ModLoader.Config.ConfigManager.ModConfigPath = Path.Combine(Main.SavePath, "Mod Configs")
static

Definition at line 50 of file ConfigManager.cs.

readonly JsonSerializerSettings Terraria.ModLoader.Config.ConfigManager.serializerSettings
static
Initial value:
= new JsonSerializerSettings
{
Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
ObjectCreationHandling = ObjectCreationHandling.Replace,
NullValueHandling = NullValueHandling.Ignore,
Converters = converters,
}

Definition at line 27 of file ConfigManager.cs.

readonly string Terraria.ModLoader.Config.ConfigManager.ServerModConfigPath = Path.Combine(Main.SavePath, "Mod Configs", "Server")
static

Definition at line 51 of file ConfigManager.cs.