Beispiel #1
0
        private void SetDriverDefualtParams(Type t)
        {
            MemberInfo[]            members = t.GetMembers();
            UserConfiguredAttribute token   = null;

            foreach (MemberInfo mi in members)
            {
                token = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredAttribute), false) as UserConfiguredAttribute;

                if (token == null)
                {
                    continue;
                }

                UserConfiguredDefaultAttribute     defaultVal = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDefaultAttribute), false) as UserConfiguredDefaultAttribute;
                UserConfiguredDescriptionAttribute desc       = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDescriptionAttribute), false) as UserConfiguredDescriptionAttribute;

                DriverConfigParam DCP = new DriverConfigParam();
                DCP.Parameter = mi.Name;
                if (defaultVal != null)
                {
                    DCP.Value = defaultVal.DefaultValue;
                }
                if (desc != null)
                {
                    DCP.Description = desc.Description;
                }
                DriverConfiguration.Add(DCP);
            }
        }
Beispiel #2
0
        private DriverConfigParam GetDriverConfigParam(MemberInfo mi)
        {
            UserConfiguredDefaultAttribute     defaultVal = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDefaultAttribute), false) as UserConfiguredDefaultAttribute;
            UserConfiguredDescriptionAttribute desc       = Attribute.GetCustomAttribute(mi, typeof(UserConfiguredDescriptionAttribute), false) as UserConfiguredDescriptionAttribute;

            DriverConfigParam DCP = new DriverConfigParam();

            DCP.Parameter = mi.Name;
            if (defaultVal != null)
            {
                DCP.Value = defaultVal.DefaultValue;
            }
            if (desc != null)
            {
                DCP.Description = desc.Description;
            }

            return(DCP);
        }