public OptionInfo(CmdLineOptionAttribute attribute, FieldInfo field) { this.field = field; required = attribute.Required; shortName = attribute.ShortName; longName = attribute.LongName; }
public static OptionMap CreateMap(Type type) { FieldInfo[] fields = type.GetFields(); OptionMap map = new OptionMap(fields.Length); foreach (FieldInfo field in fields) { if (!field.IsStatic && !field.IsInitOnly && !field.IsLiteral) { CmdLineOptionAttribute attribute = CmdLineOptionAttribute.FromField(field); if (attribute != null) { map[attribute.UniqueName] = new OptionInfo(attribute, field); } } } return(map); }