private void ExecuteCommand(string command) { string[] commands = command.Split(' '); switch (commands[0]) { case "ls": ListFiles(); break; case "clear": Console.Clear(); break; case "touch": CreateBlankFile(commands[1]); break; case "cd": if (commands[1] == "..") { var bits = _myLib.CurrentDirectory.Split('/'); _myLib.CurrentDirectory = "/"; if (bits.Length == 3) { _myLib.CurrentDirectory = "/"; return; } for (var i = 0; i < bits.Length - 2; i++) { _myLib.CurrentDirectory += bits[i]; } _myLib.CurrentDirectory += "/"; return; } if (_currentDrive.Exists(FileSystemPath.Parse(_myLib.CurrentDirectory + commands[1] + "/"))) { _myLib.CurrentDirectory = _myLib.CurrentDirectory + commands[1] + "/"; _myLib.CurrentDirectory = _myLib.CurrentDirectory; } else { Console.WriteLine("Cannot find {0}", commands[1]); } break; default: if (commands[0].StartsWith("./")) { string path = commands[0].Substring(2); RuntimeEngine myaProcess = new RuntimeEngine(path, _kernel, _myLib); myaProcess.Initialize(_processManager, _myLib); _processManager.Register(myaProcess); myaProcess.Run(commands.Skip(1).ToArray()); break; } RunApplication(commands[0], commands.Skip(1).ToArray()); break; } }