コード例 #1
0
        private CommandAction GetCommand(MethodInfo methodInfo)
        {
            var wrapper = new MethodInfoWrapper(methodInfo);
            CommandAction commandAction = new CommandAction(wrapper.Name, wrapper.Description, wrapper.LinkedToMethod);

            return commandAction;
        }
コード例 #2
0
        public CommandLineParseResult Parse(CommandAction action, string[] args)
        {
            var options = new OptionSet();
            var commandLineParameters = new List<CommandLineParameter>();

            foreach (ParameterInfoWrapper parameter in action.Parameters)
            {
                ParameterInfoWrapper localParameter = parameter;
                options.Add(
                    localParameter.GetOptionPrototype(),
                    localParameter.Description,
                    parameterValue => commandLineParameters.Add(new CommandLineParameter(localParameter.Name, parameterValue))
                );
            }

            try
            {
                var extra = options.Parse(args);
                return new CommandLineParseResult(action, commandLineParameters, extra.ToArray());
            }
            catch (OptionException exception)
            {
                throw new CommandLineParseException(exception.Message, action);
            }
        }
コード例 #3
0
 public CommandLineParseResult(CommandAction commandAction, 
     IEnumerable<CommandLineParameter> parsedParameters, 
     string[] additionalParameters, 
     string message)
 {
     CommandAction = commandAction;
     ParsedParameters = parsedParameters;
     AdditionalParameters = additionalParameters;
     Message = message;
 }
コード例 #4
0
 public CommandLineParseResult(CommandAction commandAction, 
     IEnumerable<CommandLineParameter> parsedParameters, 
     string[] additionalParameters)
     : this(commandAction, parsedParameters, additionalParameters, null)
 {
 }
コード例 #5
0
 public CommandLineParseResult(CommandAction commandAction,
                               IEnumerable <CommandLineParameter> parsedParameters,
                               string[] additionalParameters) : this(commandAction, parsedParameters, additionalParameters, null)
 {
 }