public void Write(ConsoleColor foreground, ConsoleColor background, string format, params object[] args) { SafeConsoleColorSetter.SetColor(foreground, background); try { string currentText = String.Format(format, args); tw.Write(currentText); s_currentLine.Append(currentText); } finally { SafeConsoleColorSetter.ResetColor(); } }
public void WriteLine(ConsoleColor foreground, ConsoleColor background, string format, params object[] args) { SafeConsoleColorSetter.SetColor(foreground, background); try { string currentText = String.Format(format, args); tw.WriteLine(currentText); s_currentLine.Append(currentText).Append("\n"); if (Global.Options.Pause) { s_linesWritten += (int)Math.Ceiling((double)Math.Max(s_currentLine.Length, 1) / (double)Console.BufferWidth); if (s_linesWritten > (Console.WindowHeight - 2)) { SafeConsoleColorSetter.SetColor(Global.Options.PausePromptForeground, Global.Options.PausePromptBackground); Console.Write("<space> next page, (q)uit, (c)ontinue... "); SafeConsoleColorSetter.ResetColor(); ConsoleKeyInfo keyInfo = Console.ReadKey(true); Console.WriteLine(); s_linesWritten = 0; switch (keyInfo.KeyChar.ToString().ToLower()) { case "c": // continue to the end without pausing Global.Options.Pause = false; break; case "q": // quit System.Environment.Exit(1); break; } } } s_currentLine.Length = 0; } finally { SafeConsoleColorSetter.ResetColor(); } }