private static void SetParsableProperty(PropertyInfo prop, CmdArgAttribute attr, bool isSet) { if (!string.IsNullOrEmpty(attr.Group)) { parsableProperties.Add(new ParsableProperty { GroupName = attr.Group, GroupMode = attr.GroupMode, PropName = prop.Name, IsSet = isSet }); } }
private static bool ParseArg <T>(PropertyInfo prop, CmdArgAttribute attr, string[] args, T obj) where T : new() { var arg = args.FirstOrDefault(x => x == attr.Argument); if (arg != null) { if (prop.PropertyType == typeof(bool) || prop.PropertyType == typeof(bool?)) { prop.SetValue(obj, true); } else { ParseNotBool(prop, args, obj, arg); } return(true); } return(false); }