Esempio n. 1
0
        // This returns the type handler for a given universal field
        public TypeHandler GetFieldHandler(UniversalFieldInfo fieldinfo)
        {
            Type t = typeof(NullHandler);
            TypeHandlerAttribute ta = null;

            // Do we have a handler type for this?
            if (handlertypes.ContainsKey(fieldinfo.Type))
            {
                ta = handlertypes[fieldinfo.Type];
                t  = ta.Type;
            }

            // Create instance
            TypeHandler th = (TypeHandler)General.ThisAssembly.CreateInstance(t.FullName);

            th.SetupField(ta, fieldinfo);
            th.SetValue(fieldinfo.Default);
            return(th);
        }
Esempio n. 2
0
        // This returns the type handler for a custom universal field
        public TypeHandler GetFieldHandler(int type, object defaultsetting)
        {
            Type t = typeof(NullHandler);
            TypeHandlerAttribute ta = null;

            // Do we have a handler type for this?
            if (handlertypes.ContainsKey(type))
            {
                ta = handlertypes[type];
                t  = ta.Type;
            }

            // Create instance
            TypeHandler th = (TypeHandler)General.ThisAssembly.CreateInstance(t.FullName);

            th.SetupField(ta, null);
            th.SetValue(defaultsetting);
            return(th);
        }