/// <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");
 }
 /// <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;
 }
 public void TwoDefaultParameter()
 {
     CommandLineArgumentParser parser =
         new CommandLineArgumentParser(typeof(TwoDefaultArgument),new ErrorReporter(this.error));
 }
 public void OccurenceParameters()
 {
     CommandLineArgumentParser parser =
         new CommandLineArgumentParser(typeof(OccurenceArgument),new ErrorReporter(this.error));
 }
 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);
        }