コード例 #1
0
 /// <summary>
 /// Parses Command Line Arguments. 
 /// Use CommandLineArgumentAttributes to control parsing behaviour.
 /// </summary>
 /// <param name="arguments"> The actual arguments. </param>
 /// <param name="destination"> The resulting parsed arguments. </param>
 /// <param name="reporter"> The destination for parse errors. </param>
 public static void ParseCommandLineArguments(string[] arguments, object destination, ErrorReporter reporter)
 {
     CommandLineArgumentParser parser = new CommandLineArgumentParser(destination.GetType(), reporter);
     if (!parser.Parse(arguments, destination))
         throw new Exception("Parsing failed");
 }
コード例 #2
0
 /// <summary>
 /// Returns a Usage string for command line argument parsing.
 /// Use CommandLineArgumentAttributes to control parsing behaviour.
 /// </summary>
 /// <param name="argumentType"> The type of the arguments to display usage for. </param>
 /// <returns> Printable string containing a user friendly description of command line arguments. </returns>
 public static string CommandLineArgumentsUsage(Type argumentType)
 {
     CommandLineArgumentParser parser = new CommandLineArgumentParser(argumentType, null);
     return parser.Usage;
 }
コード例 #3
0
 public void TwoDefaultParameter()
 {
     CommandLineArgumentParser parser =
         new CommandLineArgumentParser(typeof(TwoDefaultArgument),new ErrorReporter(this.error));
 }
コード例 #4
0
 public void OccurenceParameters()
 {
     CommandLineArgumentParser parser =
         new CommandLineArgumentParser(typeof(OccurenceArgument),new ErrorReporter(this.error));
 }
コード例 #5
0
 public void DuplicateLongNameParameter()
 {
     CommandLineArgumentParser parser =
         new CommandLineArgumentParser(typeof(DuplicateLongName),new ErrorReporter(this.error));
 }
コード例 #6
0
        /// <summary>
        /// Returns a Usage string for command line argument parsing.
        /// Use CommandLineArgumentAttributes to control parsing behaviour.
        /// </summary>
        /// <param name="argumentType"> The type of the arguments to display usage for. </param>
        /// <returns> Printable string containing a user friendly description of command line arguments. </returns>
        public static string CommandLineArgumentsUsage(Type argumentType)
        {
            CommandLineArgumentParser parser = new CommandLineArgumentParser(argumentType, null);

            return(parser.Usage);
        }