public void InitializeCommandLineParser() { // Define parameters and switches. (All optional). // Parameters and their default values. CommandLineArgumentParser.DefineOptionalParameter( new string[] { "-file = " + m_InputFile, "-speed = " + m_iSpeedPercentage.ToString() }); // Switches. (default will be "false") CommandLineArgumentParser.DefineSwitches( new string[] { "-stretch", "-noexp" }); }
private void InitializeCommandLineParser() { string[] optional = new string[] { "-file = none", "-speed = 100" }; string[] switches = new string[] { "-stretch", "-noexp" }; CommandLineArgumentParser.DefineOptionalParameter(optional); CommandLineArgumentParser.DefineSwitches(switches); }
private void InitializeCommandLineParser() { Dictionary <string, string> options = new Dictionary <string, string>(); options.Add("-name", ""); options.Add("-workspace", ""); options.Add("-video", ""); options.Add("-speed", "100"); CommandLineArgumentParser.DefineOptionalParameter(options); // Note: it doesn't make sense to define flags that default to true. // The default is that the flag is not set, so false. List <string> switches = new List <string>(); switches.Add("-stretch"); switches.Add("-hideExplorer"); CommandLineArgumentParser.DefineSwitches(switches); }
/// <summary> /// Initializes static members of the<see cref="GlobalParameters" /> class. /// </summary> static GlobalParameters() { // Unique parameters that can be used alone string[] uniqueParameters = { "-gui", "-help" }; CommandLineArgumentParser.DefineUniqueParameters(uniqueParameters); // Mandatory parameters of the application decoded from the command line. string[] requiredArguments = { "-rx", "-tx", }; CommandLineArgumentParser.DefineRequiredParameters(requiredArguments); // Optional parameters string[] optionalArguments = { "-baud=9600", "-parity=none", "-stopbit=1", "-data=8", "-output=stdout", "-bytesPerLine=16" }; CommandLineArgumentParser.DefineOptionalParameter(optionalArguments); // Supported switches string[] switches = { "-onlyHex", "-onlyAscii", "-time", "-collapsed", "-ycable" }; CommandLineArgumentParser.DefineSwitches(switches); }