public static void ProcessCommand(string text) { try { TextCommand cmd = TextCommand.Parse(text); RuntimeCore.Executions.Execute(RuntimeCore.CommandList[cmd.Command], cmd.Arguments); } catch (Exception e) { Trace.WriteLine(e, "Runtime"); UO.PrintError("Error: " + e.Message); } }
public CommandList(string text) { string cmdLine = ""; string[] commands = text.Replace("\r", "").Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); List <TextCommand> commandList = new List <TextCommand>(commands.Length); foreach (string command in commands) { if (command.Length > 0) { cmdLine += command + "\n"; commandList.Add(TextCommand.Parse(command)); } } if (cmdLine.Contains("\n")) { cmdLine = cmdLine.Remove(cmdLine.LastIndexOf('\n')); } list = commandList.ToArray(); this.text = cmdLine; }