private void Run(string input) { string name = ""; string rawArgs = ""; int k = input.IndexOf(" -"); if (k > -1) { name = input.Substring(0, k); rawArgs = input.Substring(k + 1); } else { name = input; } Script script = RuntimeScripts.FindScript(name); if (script != null) { RuntimeScripts.RunScript(script, new Context(rawArgs)); return; } Command command = Find(c => c.Name == name); if (command == null) { Console.WriteLine("Command {0} not found!", name); return; } Context context = new Context(rawArgs); command.Run(context); }
public void UseScript(string scriptPath) { RuntimeScripts.AddScript(scriptPath); }