Exemple #1
0
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            base.SetupField(attr, fieldinfo);

            //mxd. We don't want to store this type
            index = (int)UniversalType.Float;
        }
        // When set up for a universal field
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            base.SetupField(attr, fieldinfo);

            // Create enum list reference
            list = CreateEnumList();
        }
        // When set up for an argument
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            base.SetupArgument(attr, arginfo);

            // Keep enum list reference
            list = arginfo.Enum;
        }
Exemple #4
0
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            base.SetupArgument(attr, arginfo);

            //mxd. We don't want to store this type
            index = (int)UniversalType.Float;
        }
        // When set up for a universal field
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            base.SetupField(attr, fieldinfo);

            // Keep enum list reference
            list = (fieldinfo != null ? fieldinfo.Enum : new EnumList());
        }
        // When set up for an argument
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            base.SetupArgument(attr, arginfo);

            // Keep flags list reference
            flags = arginfo.Flags;
        }
Exemple #7
0
        // Constructor
        public TypesManager()
        {
            // Initialize
            handlertypes = new Dictionary <int, TypeHandlerAttribute>();

            // Go for all types in this assembly
            Type[] types = General.ThisAssembly.GetTypes();
            foreach (Type tp in types)
            {
                // Check if this type is a class
                if (tp.IsClass && !tp.IsAbstract && !tp.IsArray)
                {
                    // Check if class has an TypeHandler attribute
                    if (Attribute.IsDefined(tp, typeof(TypeHandlerAttribute), false))
                    {
                        // Add the type to the list
                        object[]             attribs = tp.GetCustomAttributes(typeof(TypeHandlerAttribute), false);
                        TypeHandlerAttribute attr    = (attribs[0] as TypeHandlerAttribute);
                        attr.Type = tp;
                        handlertypes.Add(attr.Index, attr);
                    }
                }
            }

            // We have no destructor
            GC.SuppressFinalize(this);
        }
        // When set up for an argument
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            defaultvalue = new EnumItem(arginfo.DefaultValue.ToString(), arginfo.DefaultValue.ToString()); //mxd
            base.SetupArgument(attr, arginfo);

            // Keep enum list reference
            list = arginfo.Enum;
        }
        // When set up for a universal field
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            defaultvalue = (fieldinfo != null ? new EnumItem(fieldinfo.Default.ToString(), fieldinfo.Default.ToString()) : new EnumItem("0", "0"));             //mxd
            base.SetupField(attr, fieldinfo);

            // Create enum list reference
            list = CreateEnumList();
        }
Exemple #10
0
        // When set up for an argument
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            defaultvalue = (int)arginfo.DefaultValue;//mxd
            base.SetupArgument(attr, arginfo);

            // Keep enum list reference
            list = arginfo.Enum;
        }
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            defaultvalue = (int)arginfo.DefaultValue;
            base.SetupArgument(attr, arginfo);

            //mxd. We don't want to store this type
            index = (int)UniversalType.Integer;
        }
Exemple #12
0
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            defaultvalue = (fieldinfo != null ? (int)fieldinfo.Default : 0);             //mxd
            base.SetupField(attr, fieldinfo);

            //mxd. We don't want to store this type
            index = (int)UniversalType.Integer;
        }
        // When set up for an argument
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            defaultvalue = new EnumItem("0", "0");
            base.SetupArgument(attr, arginfo);

            // Create enum list reference
            list = CreateEnumList();

            // Add default value
            list.Insert(0, defaultvalue);
        }
        // When set up for a universal field
        public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
        {
            base.SetupField(attr, fieldinfo);

            // Keep enum list reference
            if (fieldinfo != null)
            {
                list = fieldinfo.Enum;
            }
            else
            {
                list = new EnumList();
            }
        }
Exemple #15
0
        // This returns the type handler for the given argument
        public TypeHandler GetArgumentHandler(ArgumentInfo arginfo)
        {
            Type t = typeof(NullHandler);
            TypeHandlerAttribute ta = null;

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

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

            th.SetupArgument(ta, arginfo);
            return(th);
        }
Exemple #16
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);
        }
Exemple #17
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);
        }
Exemple #18
0
 // This sets up the handler for arguments
 public virtual void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
 {
     // Setup
     this.forargument = false;
     if (attr != null)
     {
         // Set attributes
         this.attribute    = attr;
         this.index        = attr.Index;
         this.typename     = attr.Name;
         this.customusable = attr.IsCustomUsable;
     }
     else
     {
         // Indexless
         this.attribute    = null;
         this.index        = -1;
         this.typename     = "Unknown";
         this.customusable = false;
     }
 }
 // This sets up the handler for arguments
 public virtual void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
 {
     // Setup
     this.forargument = true;
     this.arginfo     = arginfo;
     if (attr != null)
     {
         // Set attributes
         this.attribute    = attr;
         this.index        = attr.Index;
         this.typename     = attr.Name;
         this.customusable = attr.IsCustomUsable;
     }
     else
     {
         // Indexless
         this.attribute    = null;
         this.index        = -1;
         this.typename     = "Unknown";
         this.customusable = false;
     }
 }
Exemple #20
0
        private int defaultvalue; //mxd

        #endregion

        #region ================== Properties

        #endregion

        #region ================== Methods

        //mxd
        public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo)
        {
            defaultvalue = (int)arginfo.DefaultValue;
            base.SetupArgument(attr, arginfo);
        }