示例#1
0
        /// <summary>
        /// Starts the console
        /// </summary>
        public void start(IAceApplicationBase __application)
        {
            application = __application;

            cls();

            helpHeader.Add("Command with default parameters: [command name]");
            helpHeader.Add("For help on a command: [command name] " + aceCommandEntry.PARAM_HELP);
            helpHeader.Add("To be prompted for parameters: [command name] " + aceCommandEntry.PARAM_WILLCARD);
            // helpHeader.Add("[F1] full help | [F2] properties help | [F3] console plugins list | [F5] buffer to file");
            // helpHeader.Add("[DOWN] history back | [UP] history forward | [TAB] confirm proposal | [F12] clear screen");


            aceLog.consoleControl.setAsOutput(output);
            aceLog.consoleControl.setAsOutput(response);

            aceLog.consoleControl.makeSureHaveDifferentColors(output, response);

            // commandSetTree = commandTreeTools.BuildCommandTree(this);

            output.AppendLine(consoleTitle);
            output.AppendLine(consoleHelp);


            Console.Title = consoleTitle;

            commandSetTree.shortCuts.Add("F1", "help option=\"full\"");
            commandSetTree.shortCuts.Add("F12", "help option=\"full\"");

            onStartUp();


            history.Clear();

            while (consoleIsRunning)
            {
                if (useActiveInput)
                {
                    aceCommandActiveInput input = new aceCommandActiveInput(commandSetTree, history, "", "_>_ ");

                    Thread th = new Thread(input.run);
                    th.Start();
                    while (input.active)
                    {
                        Thread.Sleep(1000);
                    }

                    // aceTerminalInput.askForString("Please type console command and press enter.", "help");



                    if (input.specialCall != ConsoleKey.NoName)
                    {
                        executeCommand(input.current);
                    }
                    else
                    {
                        doSpecialCall(input);
                    }
                }
                else
                {
                    String input = aceTerminalInput.askForStringInline(linePrefix.or(" > "), DefaultCommand);
                    executeCommand(input);
                }



                Thread.Sleep(250);
            }

            aceLog.consoleControl.removeFromOutput(output);
            aceLog.consoleControl.removeFromOutput(response);
        }
        /// <summary>
        /// Gets a new instance of plug-in, specified by type name of sub directory.name path
        /// </summary>
        /// <param name="pluginName">Name of the plugin.</param>
        /// <param name="console">The console.</param>
        /// <param name="deployer">The deployer.</param>
        /// <param name="application">The application.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public IAcePluginBase GetPluginInstance(String pluginName, IAceCommandConsole console, IAcePluginDeployerBase deployer, IAceApplicationBase application, ILogBuilder output = null)
        {
            if (output == null)
            {
                if (console != null)
                {
                    output = console.output;
                }
            }

            Type resolution = resolvePlugin(pluginName, output);

            if (resolution == null)
            {
                return(null);
            }

            IAcePluginBase plugin = Activator.CreateInstance(resolution, new Object[] { }) as IAcePluginBase;

            return(plugin);

            // resolution.getInstance();
        }