/// <summary> /// Parse command line arguments. /// </summary> /// <param name="def">The command line definition</param> /// <param name="args">The arguments passed to the application</param> /// <exception cref="CommandLineArgsException">Thrown if there is an error in the arguments passed into the application</exception> /// <exception cref="ArgumentException">Thrown if there is an error in the <see cref="SwitchesDefBase"/> instance</exception> public static void Parse(SwitchesDefBase def, params string[] args) { SwitchesParser parser = new SwitchesParser(def); int nextArg = parser.Parse(args); // copy any extra arguments if (nextArg < args.Length) { string[] extraArgs = new string[args.Length - nextArg]; Array.Copy(args, nextArg, extraArgs, 0, args.Length - nextArg); def.SetExtraArguments(extraArgs); } }
/// <summary> /// Parse command line arguments. /// </summary> /// <param name="args">The arguments passed to the application</param> /// <exception cref="CommandLineArgsException">Thrown if there is an error in the arguments passed into the application</exception> /// <exception cref="ArgumentException">Thrown if there is an error in the <see cref="SwitchesDefBase"/> instance</exception> public virtual void Parse(params string[] args) { SwitchesParser.Parse(this, args); Verify(); }