Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            cmdManager = new CommandManager();
            List <CommandDescriptor> cmds = new List <CommandDescriptor>();

            cmds.Add(new CommandDescriptor("help", "lists all availble commands", false, CommandHandler_Help));
            cmds.Add(new CommandDescriptor("clear", "clears console window", false, CommandHandler_Clear));
            cmds.Add(new CommandDescriptor("add", "adds numbers", false, CommandHandler_Add));
            cmds.Add(new CommandDescriptor("threadTest", "adds numbers result after 5 seconds", true, CommandHandler_AddThreaded));
            cmds.Add(new CommandDescriptor("exec", "executes a given command (just for fun :D)", false, CommandHandler_Exec));
            cmds.Add(new CommandDescriptor("echo", "outputs a given text", false, CommandHandler_Echo));

            console = new DebuggingConsole(cmds.ToArray(), new DebugConsole.Color(255, 255, 255));
            console.Open();
            thread = new Thread(() => { Loop(); });
            thread.IsBackground = true;
            thread.Start();
        }
Beispiel #2
0
        private static void DebuggerLoop(ZMachine zm, string[] sourcePath)
        {
            var console = new DebuggingConsole(zm, zm.IO, sourcePath);

            console.Activate();

            TimedInputCallback cb = () => false;

            byte[] terminatingKeys = { };

            while (console.Active)
            {
                byte   terminator;
                string cmd = zm.IO.ReadLine(string.Empty, 0, cb, terminatingKeys, out terminator);

                console.HandleCommand(cmd);
            }
        }