Пример #1
0
        public void Log(ChatText text)
        {
            //todo: Async writing not working well in tab console
            System.Console.CursorVisible = false;
            var top = Math.Max(0, System.Console.CursorTop);

            if (!GuiApp.Pause)
            {
                System.Console.SetCursorPosition(0, top);
                System.Console.Write(new string(' ', ConsoleUtils.Width - 1));
                System.Console.SetCursorPosition(0, top);
                text.SetNext(new ChatText("\n", TextColor.Reset));
            }

            text.PrintNext(GuiApp.ConsoleColors);

            if (!GuiApp.Pause)
            {
                System.Console.SetCursorPosition(0,
                                                 top + text.GetLines(ConsoleUtils.Width).Count >= System.Console.BufferHeight
                        ? Math.Max(0, System.Console.BufferHeight - 1)
                        : Math.Max(0, top + text.GetLines(ConsoleUtils.Width).Count));
            }

            if (!GuiApp.Pause)
            {
                SetCursorPos();
            }
        }
Пример #2
0
 public void Log(ChatText text)
 {
     if (!GuiApp.Pause)
     {
         text.SetNext(new ChatText("", TextColor.Reset));
     }
     text.PrintNext(GuiApp.ConsoleColors);
     if (!GuiApp.Pause)
     {
         System.Console.Write("\n");
     }
 }