public static void RunCommand(string command) { object[] objArray; if (string.IsNullOrEmpty(command)) { return; } if (command.ToLower() == "runcommand") { return; } IList <string> strs = StringUtility.CommandLineStyleSplit(command); bool flag = false; bool flag1 = false; string empty = string.Empty; IEnumerator <MethodInfo> enumerator = CommandLineRun.GetAllMethods().GetEnumerator(); try { while (enumerator.MoveNext()) { MethodInfo current = enumerator.Current; if (string.Compare(current.Name, strs[0], true) != 0) { continue; } /* * if (!CommandLineRun.MethodIsAvailable(current)) * { * flag = true; * } */ else if (!CommandLineRun.FillMethodParams(current, strs, out objArray, out empty)) { flag1 = true; } else { current.Invoke(null, objArray); return; } } } finally { if (enumerator == null) { } enumerator.Dispose(); } if (flag1) { Console.AddMessage(string.Concat("Command or script '", strs[0], "' parameter error: ", empty), Color.yellow); } else if (!flag) { Console.AddMessage(string.Concat("No command or script named '", strs[0], "' exists."), Color.yellow); } else { Console.AddMessage(string.Concat("The command or script '", strs[0], "' is not available at this time."), Color.yellow); } }