public static T FromNode <T>(this ConfigNode node, T defaultValue) where T : class { CFromNode method = converters[typeof(T)]; T value = (T)method.Invoke(node) ?? defaultValue; return(value); }
public static T FromNode <T>(this ConfigNode node, string name, T defaultValue) { if (!node.HasNode(name)) { return(defaultValue); } Type t = typeof(T); if (t.IsPrimitive) { return(GetBuiltinValue(node.GetNode(name), Settings.VALUE, defaultValue)); } else { CFromNode method = converters[t]; return((T)method.Invoke(node.GetNode(name))); } }