public void RegisterTypeParser(Type type, ParseTypeDelegate del) { if (typeParserDic.ContainsKey(type)) { Debug.LogWarning(string.Format("Duplicate CustomDbClass : {0}", type)); } typeParserDic.Add(type, del); }
public object ParseType(Type type, string text) { ParseTypeDelegate del = null; if (typeParserDic.TryGetValue(type, out del)) { return(del(text)); } return(null); }
public static void RegisterType(Type type, ParseTypeDelegate parseFunction, object defaultValue) { //this is multithreading support Dictionary <Type, TypeItem> newTypes = new Dictionary <Type, TypeItem>(types); newTypes.Add(type, new TypeItem(type, parseFunction, defaultValue)); //update types = newTypes; //types.Add( type, new TypeItem( type, parseFunction, defaultValue ) ); }
internal TypeItem(Type type, ParseTypeDelegate parseFunction, object defaultValue) { this.type = type; this.parseFunction = parseFunction; this.defaultValue = defaultValue; }