private static int Main(string[] args) { var result = Parser.Default.ParseArguments <SearchOptions>(args); try { return((int)result.MapResult( (arguments) => { using (ConsoleInterface ci = new ConsoleInterface(arguments)) { return ci.Run(); } }, (errors) => { Console.WriteLine(SearchOptions.Usage); return (int)SearchExitCode.ArgumentsInvalid; } )); } catch (Exception ex) when(!Debugger.IsAttached) { Console.WriteLine("Error: " + ex.Message); return((int)SearchExitCode.UnhandledException); } }
public ConsoleProgressTraceListener(ConsoleInterface i) { _interface = i; Trace.Listeners.Add(this); }