Example #1
1
 public static extern SafeConsoleHandle CreateConsoleScreenBuffer(
      ConsoleAccess dwDesiredAccess,
      ConsoleShareMode dwShareMode,
      [In] SecurityAttributes lpSecurityAttributes,
      ConsoleBufferFlags dwFlags,
      IntPtr lpScreenBufferData);
Example #2
1
        private static SafeConsoleHandle CreateConsoleScreenBuffer(ConsoleAccess consoleAccess)
        {
            WinConsole.AllocConsole();

            return WinConsole.CreateConsoleScreenBuffer(
                consoleAccess,
                0,
                null,
                ConsoleBufferFlags.CONSOLE_TEXTMODE_BUFFER,
                IntPtr.Zero);
        }
Example #3
0
 private void TimedLine()
 {
     ConsoleAccess.Lock();
     if (CurrentLine.ConsolePos == null)
     {
         CurrentLine.ConsolePos = new int[2] {
             Console.CursorLeft, Console.CursorTop
         }
     }
     ;
     if (CurrentLineTimer >= CurrentLine.Speed)
     {
         if (CurrentLine.Line[CurrentLine.LineIndex] != '$')
         {
             ConsoleAccess.Write(CurrentLine.Line[CurrentLine.LineIndex]);
             CurrentLine.LineIndex++;
             CurrentLine.RealCharLineIndex++;
             CurrentLineTimer -= CurrentLine.Speed;
         }
         else if (CurrentLine.SpecialColor == false)
         {
             LineQueueProcessColor();
         }
         else
         {
             LineQueueRestoreColor();
         }
     }
     ConsoleAccess.Unlock();
 }
Example #4
0
 private void LineQueueEndOfSameLine()
 {
     CurrentLine.SpecialColor = false;
     ConsoleAccess.ResetColor();
     PreviousLine = CurrentLine;
     CurrentLine  = null;
 }
Example #5
0
        private void LineQueueRestoreColor()
        {
            CurrentLine.SpecialColor = false;
            ConsoleAccess.ResetColor();
            CurrentLine.LineIndex++;

            if (CurrentLine.LineIndex < CurrentLine.Line.Length)
            {
                CurrentLine.LastCharForeground = ConsoleAccess.ForegroundColor;
                CurrentLine.LastCharBackground = ConsoleAccess.BackgroundColor;
            }
        }
Example #6
0
        private void InstantLine()
        {
            ConsoleAccess.Lock();
            CurrentLine.ConsolePos = new int[2] {
                Console.CursorLeft, Console.CursorTop
            };
            while (CurrentLine.LineIndex < CurrentLine.Line.Length)
            {
                if (CurrentLine.Line[CurrentLine.LineIndex] != '$')
                {
                    Console.Write(CurrentLine.Line[CurrentLine.LineIndex]);
                    CurrentLine.LineIndex++;
                    CurrentLine.RealCharLineIndex++;
                }
                else if (CurrentLine.SpecialColor == false)
                {
                    LineQueueProcessColor();
                }
                else
                {
                    LineQueueRestoreColor();
                }
            }

            LineQueueEndOfLine();
            ConsoleAccess.Unlock();

            if (LineQueue.Count > 0)
            {
                LineQueuePop();
                if (CurrentLine.Speed <= 0.0f)
                {
                    InstantLine();
                }
            }
            else
            {
                FinishedTyping();
            }
        }
Example #7
0
        public void Update(float deltaTime)
        {
            if (CurrentLine == null && LineQueue.Count > 0)
            {
                LineQueuePop();

                GConsole.Instance.Input.ClearCurrentLine();

                if (PreviousLine != null && PreviousLine.Line == CurrentLine.Line &&
                    GConsole.Settings.SameLinesProduceDots == true)
                {
                    SameLineDot();
                }
            }
            else if (CurrentLine != null && CurrentLine.LineIndex < CurrentLine.Line.Length)
            {
                if (CurrentLine.ConsolePos != null && CurrentLine.ConsolePos[1] == Console.WindowTop + Console.WindowHeight - 2)
                {
                    Console.SetWindowPosition(Console.WindowLeft, Console.WindowTop + 1);
                }

                if (CurrentLine.Speed <= 0.0f)
                {
                    InstantLine();
                }
                else
                {
                    CurrentLineTimer += deltaTime;
                    TimedLine();
                }
            }
            else if (CurrentLine != null && CurrentLine.LineIndex >= CurrentLine.Line.Length)
            {
                ConsoleAccess.Lock();
                LineQueueEndOfLine();
                ConsoleAccess.Unlock();
                FinishedTyping();
            }
        }
Example #8
0
        private void SameLineDot()
        {
            ConsoleAccess.Lock();
            var OrigConsolePos = new int[2] {
                Console.CursorLeft, Console.CursorTop
            };

            ConsoleAccess.ForegroundColor = PreviousLine.LastCharForeground;
            ConsoleAccess.BackgroundColor = PreviousLine.LastCharBackground;

            if (PreviousLine.DotCount < 3)
            {
                ConsoleAccess.SetCursorPosition(
                    PreviousLine.ConsolePos[0] + PreviousLine.RealCharLineIndex + PreviousLine.DotCount,
                    PreviousLine.ConsolePos[1]);
                PreviousLine.DotCount++;
                ConsoleAccess.Write(".");
            }
            else
            {
                ConsoleAccess.SetCursorPosition(
                    PreviousLine.ConsolePos[0] + PreviousLine.RealCharLineIndex,
                    PreviousLine.ConsolePos[1]);
                ConsoleAccess.Write(".  ");
                PreviousLine.DotCount = 1;
            }

            ConsoleAccess.ResetColor();

            ConsoleAccess.ConsolePosition = OrigConsolePos;
            CurrentLine = PreviousLine;
            LineQueueEndOfSameLine();
            ConsoleAccess.Unlock();

            FinishedTyping();
        }
Example #9
0
 private void LineQueueEndOfLine()
 {
     LineQueueEndOfSameLine();
     ConsoleAccess.Write("\n");
 }
Example #10
0
 public InvokerSet(ConsoleAccess Access)
 {
     access = Access;
 }