private static void WaitForExit(bool waitForUserInput, string errorMessage = null, Exception exception = null) { if (!string.IsNullOrEmpty(errorMessage) || exception != null) { Log.Fatal(exception, errorMessage); } 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 (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(); }
private static void WaitForStart(bool waitForUserInput) { if (waitForUserInput) { Console.WriteLine("Press ENTER key to start the CRAB Import..."); ConsoleExtensions.WaitFor(ConsoleKey.Enter); } else { Console.WriteLine("Starting CRAB Import..."); } _stopwatch = Stopwatch.StartNew(); }