예제 #1
0
 public void WriteLineBlue(string text, params string[] redTokens)
 {
     using (ConsoleColorSelector.SetConsoleForegroundColor(ConsoleColor.DarkBlue))
     {
         WriteLine(text, redTokens);
     }
 }
예제 #2
0
 public void WriteLineGreen(string text)
 {
     using (ConsoleColorSelector.SetConsoleForegroundColor(ConsoleColor.DarkGreen))
     {
         WriteLine(text);
     }
 }
예제 #3
0
 public void WriteLineRed(string text)
 {
     using (ConsoleColorSelector.SetConsoleBackgroundColor(ConsoleColor.Red))
         using (ConsoleColorSelector.SetConsoleForegroundColor(ConsoleColor.White))
         {
             WriteLine(text);
         }
 }
예제 #4
0
        private void PrintText(string text, ConsoleColor color)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return;
            }

            using (ConsoleColorSelector.SetConsoleForegroundColor(color))
            {
                WriteLine();
                WriteLine(text);
            }
        }
예제 #5
0
        public void PrintException(Exception exception)
        {
            using (ConsoleColorSelector.SetConsoleForegroundColor(ConsoleColor.Red))
            {
                WriteLine();
                WriteLine(@"The operation has failed.");
                WriteLine();
                WriteLine(exception?.ToString() ?? "UNKNOWN ERROR");
            }

            WriteLine(@"Press any key to continue.");
            WriteInputPrompt();
            WaitForKeyPress();
            ResetConsole();
        }