private static void WaitForExit(ICommandProcessorConfig settings, string errorMessage = null, Exception exception = null) { if (!string.IsNullOrEmpty(errorMessage)) { Console.Error.WriteLine(errorMessage); } if (exception != null) { Console.Error.WriteLine(exception); } Console.WriteLine(); if (_stopwatch != null) { var avg = _commandCounter / _stopwatch.Elapsed.TotalSeconds; var summary = $"Report: generated {_commandCounter} commands in {_stopwatch.Elapsed}ms (={avg}/second)."; Console.WriteLine(summary); } if (settings.WaitForUserInput) { Console.WriteLine("Done! Press ENTER key to exit..."); ConsoleExtensions.WaitFor(ConsoleKey.Enter); } if (!string.IsNullOrEmpty(errorMessage)) { Environment.Exit(1); } Environment.Exit(0); }
private static void WaitForStart(ICommandProcessorConfig settings) { if (settings.WaitForUserInput) { Console.WriteLine("Press ENTER key to start the CRAB Import..."); ConsoleExtensions.WaitFor(ConsoleKey.Enter); } _stopwatch = Stopwatch.StartNew(); }