/// <summary> /// Runs the text environment. Handle the flow when entered commands. /// </summary> protected override void RunTextEnvironment() { // Enter shell mode var command = string.Empty; while (command != "exit") { WriteBashPostString(); command = CommandHelper.ReadCommand(ModuleManager); if (string.IsNullOrEmpty(command)) { continue; } var parts = command.Split(' '); switch (parts[0]) { case "help": PrintGeneralHelp(); break; case "clear": ClearConsole(); break; case "exit": break; default: ExecuteCommand(command); break; } } }
/// <summary> /// Opens the module specific console /// </summary> /// <param name="module">The module.</param> private void ModuleSpecificConsole(IServerModule module) { var console = module.Console; Console.Clear(); Console.WriteLine("Welcome to the '{0}' module. Type 'help' to print the possible commands.", module.Name); Console.WriteLine(); var command = string.Empty; while (command != "bye") { WriteModulePostString(module); command = CommandHelper.ReadCommand(ModuleManager); switch (command) { case "help": Console.WriteLine(module.GetType().GetDescription()); break; case "quit": case "bye": case "exit": break; default: var parts = command.Split(' '); Console.WriteLine(); console.ExecuteCommand(parts, Console.WriteLine); Console.WriteLine(); break; } } Console.WriteLine(); Console.WriteLine("Exiting module console...bye!"); Console.WriteLine(); }