/** * Adds a command to the batch. Batch sub-commands will be processed * in the same order they are added and their responses can be * accessed from the Response object passed to a response handler * of the batch command itself. */ public void AddCommand(IRSCommand command) { CommandValues.Add(new Hashtable() { { "name", command.Name() }, { "params", command.Parameters() } }); Commands.Add(command); }
public CommandLine(string[] commandLineArgs) { if (commandLineArgs == null) { throw new System.ArgumentNullException("commandLineArgs"); } CommandOption currentOption = null; foreach (string arg in commandLineArgs) { if (arg.StartsWith("/")) { // This is an option. Create it if it doesn't already exist (allow the same option to be // specified twice - the values are appended in that case). string optName = arg.Substring(1); currentOption = m_options[optName]; if (currentOption == null) { currentOption = new CommandOption(optName); m_options.Add(currentOption); } } else { // This is a value. Add it to the current option or to this object's values collection if // it appears before any options. if (currentOption == null) { m_values.Add(arg); } else { currentOption.Values.Add(arg); } } } }