Exemplo n.º 1
0
 public void RegisterTypeParser(Type type, ParseTypeDelegate del)
 {
     if (typeParserDic.ContainsKey(type))
     {
         Debug.LogWarning(string.Format("Duplicate CustomDbClass : {0}", type));
     }
     typeParserDic.Add(type, del);
 }
Exemplo n.º 2
0
        public object ParseType(Type type, string text)
        {
            ParseTypeDelegate del = null;

            if (typeParserDic.TryGetValue(type, out del))
            {
                return(del(text));
            }
            return(null);
        }
Exemplo n.º 3
0
        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 ) );
        }
Exemplo n.º 4
0
 internal TypeItem(Type type, ParseTypeDelegate parseFunction, object defaultValue)
 {
     this.type          = type;
     this.parseFunction = parseFunction;
     this.defaultValue  = defaultValue;
 }