示例#1
0
        public ParsedArguments ParseArgumentsAndMerge(string actionName, Dictionary<string, string> arg, ParsedArguments parsedArguments)
        {
            var methodInfo = _controller.GetMethod(actionName);
            var argumentRecognizers = methodInfo.GetArguments()
                .ToList();

            var parser = new ArgumentParser(argumentRecognizers, _allowInferParameter, Culture);
            var parsedMethodArguments = parser.Parse(arg);
            var parsedMethod = Parse(methodInfo, parsedMethodArguments);
            var merged = parsedArguments.Merge(parsedMethod);
            if (!_controller.IgnoreGlobalUnMatchedParameters)
                merged.AssertFailOnUnMatched();
            return merged;
        }
示例#2
0
 public ParsedArguments ParseArgumentsAndMerge(IEnumerable<string> arg, ParsedArguments parsedArguments)
 {
     var parsedMethod = Parse(arg);
     // Inferred ordinal arguments should not be recognized twice
     parsedArguments.RecognizedArguments = parsedArguments.RecognizedArguments
         .Where(argopts =>
             !parsedMethod.RecognizedArguments.Any(pargopt => pargopt.Index == argopts.Index && argopts.InferredOrdinal));
     var merged = parsedArguments.Merge(parsedMethod);
     if (!_controller.IgnoreGlobalUnMatchedParameters)
         merged.AssertFailOnUnMatched();
     return merged;
 }