Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length < 1 || args[0] == "/?")
            {
                PrintHelpText();
                return;
            }

            Console.BufferWidth = 1000;

            var debugger = new DebuggerInvoker(args);

            int            position = 0;
            ConsoleKeyInfo keyPressed;

            do
            {
                PrintPreDebuggingOptions(debugger, ref position);
                GetPreDebuggingKey(out keyPressed);
                PerformPreDebuggingAction(debugger, keyPressed, ref position);
            } while (keyPressed.Key != ConsoleKey.F5);

            Console.Clear();

            Console.SetCursorPosition(0, 0);
            ConsoleHelper.ClearLinesAndReturnCursor(0, 0, 10);
            debugger.RunProgramWithDebugging();
        }
Exemplo n.º 2
0
 private static void PrintPreDebuggingOptions(DebuggerInvoker debugger, ref int position)
 {
     Console.Clear();
     Console.SetCursorPosition(0, 0);
     ConsoleHelper.ClearLinesAndReturnCursor(0, 0, 7);
     Console.WriteLine(debugger);
     DrawPointerLine(position);
     Console.WriteLine();
     Console.WriteLine("Press Left or Right to move the cursor.");
     Console.WriteLine("Press F9 to set a break point.");
     Console.WriteLine("Press F5 to start debugging.");
 }
Exemplo n.º 3
0
        private static void PerformPreDebuggingAction(DebuggerInvoker debugger, ConsoleKeyInfo keyPressed, ref int position)
        {
            switch (keyPressed.Key)
            {
            case ConsoleKey.LeftArrow:
                if (position > 0)
                {
                    position--;
                }
                break;

            case ConsoleKey.RightArrow:
                if (position < Console.BufferWidth)
                {
                    position++;
                }
                break;

            case ConsoleKey.F9:
                debugger.ToggleBreakPoint(position);
                break;
            }
        }