public static ExampleOptions ParseArgs(string[] args) { var options = new ExampleOptions(); var settings = new CommandLineParserSettings { CaseSensitive = false }; var parser = new CommandLineParser(settings); var results = parser.ParseArguments(args, options); if (!results) return null; if (!string.IsNullOrEmpty(options.Manifest) && !File.Exists(options.Manifest)) { Console.WriteLine("Missing manifest file: {0}", options.Manifest); return null; } return options; }
public static int Main(string[] args) { try { Options = ExampleOptions.ParseArgs(args); if (Options == null) return 1; Console.WriteLine("Successfully parsed the options"); } catch (Exception ex) { Console.WriteLine("Example error: {0}", ex); return 1; } return 0; }
public static int Main(string[] args) { try { Options = ExampleOptions.ParseArgs(args); if (Options == null) { return(1); } Console.WriteLine("Successfully parsed the options"); } catch (Exception ex) { Console.WriteLine("Example error: {0}", ex); return(1); } return(0); }
public static ExampleOptions ParseArgs(string[] args) { var options = new ExampleOptions(); var settings = new CommandLineParserSettings { CaseSensitive = false }; var parser = new CommandLineParser(settings); var results = parser.ParseArguments(args, options); if (!results) { return(null); } if (!string.IsNullOrEmpty(options.Manifest) && !File.Exists(options.Manifest)) { Console.WriteLine("Missing manifest file: {0}", options.Manifest); return(null); } return(options); }