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); } }
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); }