private object CreateObjectFromArguments(IEnumerable<KeyValuePair<string,string>> parsedArguments, Parameter paramInfo)
 {
     var obj = Activator.CreateInstance(paramInfo.ParameterType);
     foreach (
         PropertyInfo prop in paramInfo.GetPublicInstanceProperties())
     {
         var recognizedArgument = parsedArguments.First(a => a.Key.EqualsIC(prop.Name));
         prop.SetValue(obj, ConvertFrom(recognizedArgument, prop.PropertyType), null);
     }
     return obj;
 }
 public bool Matches(Parameter paramInfo)
 {
     return RawArgument.EqualsIC(paramInfo.Name);
 }
Beispiel #3
0
 private Argument GetArgumentWithOptions(Parameter parameterInfo)
 {
     return new Argument(parameterInfo.Name,
         required: parameterInfo.LooksRequired(),
         type: parameterInfo.ParameterType);
 }
Beispiel #4
0
 private void AddArgumentWithOptionsForPropertiesOnObject(List<Argument> recognizers, Parameter parameterInfo)
 {
     recognizers.AddRange(parameterInfo.GetPublicInstanceProperties()
         .Select(prop =>
             new Argument(prop.Name,
                 required: parameterInfo.LooksRequired() && IsRequired(prop),
                 type: prop.PropertyType)));
 }