static int Main(string[] args) { var returnCode = 0; var isValidOptions = true; var options = new CommandLineOptions(); if (!Parser.Default.ParseArguments(args, options)) { returnCode = 1; isValidOptions = false; } if (isValidOptions) { try { var program = new Program(options); program.Run(); } catch (Exception ex) { returnCode = -1; Console.WriteLine("Exception occurred while running. Exception is: {0}", ex.Message); } } return returnCode; }
/// <summary> /// Constructs a new program with the given options. /// </summary> protected Program(CommandLineOptions options) { _options = options; }