public Result StartRunCommand(string command, string[] args) { Result res = new Result(); bool haveArgs = args.Length > 0; switch (command) { case "help": if (haveArgs) { res.outLines.AddRange(CommandHelper.GetHelp(args[0])); } else { res.outLines.AddRange(CommandHelper.GetHelp("")); } return(res); case "ls": return(FileController.List(args)); case "echo": return(new Result(new string[] { string.Join(" ", args) }, new string[0])); case "im": if (haveArgs) { _username = args[0]; } res.outLines.Add("You are " + _username); return(res); case "resetcolors": _typer.Screen.ResetColors(); _typer.ResetScreen(true); return(res); case "edit": return(OpenEditor(args)); case "cd": return(ChangeDirectory(args)); case "where": res.outLines.Add(FileController.invite); return(res); case "mkdir": return(MakeDirectory(args)); case "cf": return(CreateFile(args)); case "ren": return(RenameFiles(args)); case "run": return(Run(args)); case "cpdir": return(CopyDirectory(args)); case "rmdir": return(RenameDir(args)); case "rm": return(RemoveFiles(args)); case "cp": return(CopyFiles(args)); case "color": return(ColorCommand(args)); case "colorbg": return(ColorBG(args)); case "colorborder": return(ColorBorder(args)); case "colorerror": return(ColorError(args)); case "defcolors": return(DefineColors()); case "shutdown": return(ShutDown()); default: res.errors.Add("Undefined " + command + " Try 'help'"); return(res); } }