public static void Display(string text, MDbgIO.HighlighType ht, int highlightStart, int highlighLen)
        {
            if (commandExecutionMessage != null)
            {                
                commandExecutionMessage(text.Trim());
            }


            //System.Diagnostics.Debug.WriteLine("[MDBG] " + text);

            /*
            if (highlighLen == 0 || highlightStart >= text.Length)
            {
                Console.Write(text);
            }
            else
            {
                Console.Write(text.Substring(0, highlightStart));
                ConsoleColor fc = Console.ForegroundColor;
                ConsoleColor bc = Console.BackgroundColor;

                switch (ht)
                {
                    case HighlighType.StatementLocation:
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        break;
                    case HighlighType.Error:
                        Console.ForegroundColor = ConsoleColor.Red;
                        break;
                    default:
                        Debug.Assert(false);
                        throw new InvalidOperationException();
                }
                int l = highlightStart + highlighLen;
                if (l > text.Length)
                {
                    highlighLen = text.Length - highlightStart;
                }
                Console.Write(text.Substring(highlightStart, highlighLen));
                Console.ForegroundColor = fc;
                Console.BackgroundColor = bc;
                if (highlightStart + highlighLen < text.Length)
                {
                    Console.Write(text.Substring(highlightStart + highlighLen));
                }
            }*/
        }
Esempio n. 2
0
        //////////////////////////////////////////////////////////////////////////////////
        //
        // Customization methods (to be overriden in aditional skins).
        //
        //////////////////////////////////////////////////////////////////////////////////

        protected virtual void Init(string[] commandLineArguments)
        {
            string[] initialCommands = null;

            // process startup commands
            if (commandLineArguments.Length != 0)
            {
                var startupCommands = new ArrayList();
                if (commandLineArguments[0].Length > 1 && commandLineArguments[0][0] == '!')
                {
                    // ! commands on command line
                    int i = 0;
                    while (i < commandLineArguments.Length)
                    {
                        var sb = new StringBuilder();
                        Debug.Assert(commandLineArguments[i][0] == '!');
                        sb.Append(commandLineArguments[i].Substring(1));
                        ++i;
                        while (i < commandLineArguments.Length &&
                               !(commandLineArguments[i].Length > 1 && commandLineArguments[i][0] == '!'))
                        {
                            sb.Append(' ');
                            sb.Append(commandLineArguments[i]);
                            ++i;
                        }
                        startupCommands.Add(sb.ToString());
                    }
                }
                else
                {
                    // it is name of executable on the command line
                    var sb = new StringBuilder("run");
                    for (int i = 0; i < commandLineArguments.Length; i++)
                    {
                        sb.Append(' ');
                        string arg = commandLineArguments[i];
                        if (arg.IndexOf(' ') != -1)
                        {
                            // argument contains spaces, need to quote it
                            sb.Append('\"').Append(arg).Append('\"');
                        }
                        else
                        {
                            sb.Append(arg);
                        }
                    }
                    startupCommands.Add(sb.ToString());
                }

                initialCommands = (string[])startupCommands.ToArray(typeof(string));
            }


            IO = new MDbgIO(this, initialCommands);

            CommandBase.Shell = this;

            m_debugger = new MDbgEngine();
            MdbgCommands.Initialize();

            OnCommandExecuted += MdbgCommands.WhenHandler;

            LoadPlatformDependentExtension();

            ProcessAutoExec();
        }
        //////////////////////////////////////////////////////////////////////////////////
        //
        // Customization methods (to be overriden in aditional skins).
        //
        //////////////////////////////////////////////////////////////////////////////////

        protected virtual void Init(string[] commandLineArguments)
        {
            string[] initialCommands = null;

            // process startup commands
            if (commandLineArguments.Length != 0)
            {
                var startupCommands = new ArrayList();
                if (commandLineArguments[0].Length > 1 && commandLineArguments[0][0] == '!')
                {
                    // ! commands on command line
                    int i = 0;
                    while (i < commandLineArguments.Length)
                    {
                        var sb = new StringBuilder();
                        Debug.Assert(commandLineArguments[i][0] == '!');
                        sb.Append(commandLineArguments[i].Substring(1));
                        ++i;
                        while (i < commandLineArguments.Length &&
                               !(commandLineArguments[i].Length > 1 && commandLineArguments[i][0] == '!'))
                        {
                            sb.Append(' ');
                            sb.Append(commandLineArguments[i]);
                            ++i;
                        }
                        startupCommands.Add(sb.ToString());
                    }
                }
                else
                {
                    // it is name of executable on the command line
                    var sb = new StringBuilder("run");
                    for (int i = 0; i < commandLineArguments.Length; i++)
                    {
                        sb.Append(' ');
                        string arg = commandLineArguments[i];
                        if (arg.IndexOf(' ') != -1)
                        {
                            // argument contains spaces, need to quote it
                            sb.Append('\"').Append(arg).Append('\"');
                        }
                        else
                        {
                            sb.Append(arg);
                        }
                    }
                    startupCommands.Add(sb.ToString());
                }

                initialCommands = (string[]) startupCommands.ToArray(typeof (string));
            }


            IO = new MDbgIO(this, initialCommands);

            CommandBase.Shell = this;

            m_debugger = new MDbgEngine();
            MdbgCommands.Initialize();

            OnCommandExecuted += MdbgCommands.WhenHandler;

            LoadPlatformDependentExtension();

            ProcessAutoExec();
        }