private static bool ReadValue(string s, IZXPConverter converter, Type t, out object val) { string sFormatted = s.Trim(); switch (sFormatted.ToLower()) { case "null": val = null; return(true); } // We Found An Environment Key To Use if (sFormatted.StartsWith("~~") && sFormatted.EndsWith("~~") && sFormatted.Length > 4) { string sEnvKey = sFormatted.Substring(2, sFormatted.Length - 4); return(GetEnvironment(sEnvKey, out val)); } // Try To Convert The Value if (converter != null) { return(converter.Convert(s, out val)); } else { val = ParseNew(s, t); return(true); } }
public ZXPDatum(string key, PropertyInfo pi) { Key = key; field = null; prop = pi; if(!ZXParser.GetConverter(Type, out Converter)) Converter = null; }
public ZXPDatum(string key, FieldInfo fi) { Key = key; field = fi; prop = null; if(!ZXParser.GetConverter(Type, out Converter)) Converter = null; }
public ZXPDatum(string key, PropertyInfo pi) { Key = key; field = null; prop = pi; if (!ZXParser.GetConverter(Type, out Converter)) { Converter = null; } }
public ZXPDatum(string key, FieldInfo fi) { Key = key; field = fi; prop = null; if (!ZXParser.GetConverter(Type, out Converter)) { Converter = null; } }
public static void AddConverter(Type t, IZXPConverter conv) { conversionFunctions[t] = conv; }
public static bool GetConverter(Type t, out IZXPConverter conv) { return(conversionFunctions.TryGetValue(t, out conv)); }
public static bool GetConverter(Type t, out IZXPConverter conv) { return conversionFunctions.TryGetValue(t, out conv); }
private static bool ReadValue(string s, IZXPConverter converter, Type t, out object val) { string sFormatted = s.Trim(); switch(sFormatted.ToLower()) { case "null": val = null; return true; } // We Found An Environment Key To Use if(sFormatted.StartsWith("~~") && sFormatted.EndsWith("~~") && sFormatted.Length > 4) { string sEnvKey = sFormatted.Substring(2, sFormatted.Length - 4); return GetEnvironment(sEnvKey, out val); } // Try To Convert The Value if(converter != null) return converter.Convert(s, out val); else { val = ParseNew(s, t); return true; } }