static void Main(string[] args) { Options commandLineOptions = new Options(); ICommandLineParser commandParser = new CommandLineParser(); if (commandParser.ParseArguments(args, commandLineOptions, Console.Error)) { if (ValidateOptions(commandLineOptions)) { try { TaskProcessor concatTask = new TaskProcessor(); concatTask.ProcessTask(commandLineOptions); } catch (Exception ex) { StringBuilder errorMessage = new StringBuilder(); errorMessage.AppendLine(messageUnexpectedError); if (commandLineOptions.DebugMessages) { errorMessage.AppendFormat(messageUnhandledException, ex.ToString(), ex.Message, ex.StackTrace); } System.Console.Error.WriteLine(errorMessage.ToString()); Environment.ExitCode = 1; } } } else { // Command line params could not be parsed, // or help was requested Environment.ExitCode = -1; } }
static void Main(string[] args) { Options commandLineOptions = new Options(); ICommandLineParser commandParser = new CommandLineParser(); if (commandParser.ParseArguments(args, commandLineOptions, Console.Error)) { if (ValidateOptions(commandLineOptions)) { try { TaskProcessor concatTask = new TaskProcessor(); concatTask.ProcessTask(commandLineOptions); } catch (Exception ex) { StringBuilder errorMessage = new StringBuilder(); errorMessage.AppendLine(messageUnexpectedError); if (commandLineOptions.DebugMessages) { errorMessage.AppendFormat(messageUnhandledException, ex.ToString(), ex.Message, ex.StackTrace); } System.Console.Error.WriteLine(errorMessage.ToString()); Environment.ExitCode = 1; } } } else { // Command line params could not be parsed, // or help was requested Environment.ExitCode = -1; } }