Beispiel #1
0
        protected override bool Run()
        {
            if (Settings.App.UseShell)
            {
                _dispatcher = new CommandDispatcher(this);

                List <string> completionList = new List <string>();

                if (!string.IsNullOrEmpty(Settings.App.Prompt))
                {
                    prompt = Settings.App.Prompt;
                }

                var startupMsg = "Spook shell " + Version + "\nLogs are stored in " + LogPath + "\nTo exit use <ctrl-c> or \"exit\"!\n";

                Prompt.Run(
                    ((command, listCmd, list) =>
                {
                    string command_main = command.Trim().Split(new char[] { ' ' }).First();

                    if (!_dispatcher.OnCommand(command))
                    {
                        Console.WriteLine("error: Command not found");
                    }

                    return("");
                }), prompt, PromptGenerator, startupMsg, Path.GetTempPath() + Settings.App.History, _dispatcher.Verbs);
            }
            else
            {
                // Do nothing in this thread...
                Thread.Sleep(1000);
            }

            return(this.Running);
        }