/// <summary> /// Associates a number of <paramref name="newCmd"/>s to a <paramref name="handler"/>. /// </summary> /// <param name="handler">The method to invoke from <paramref name="newCmd"/></param> /// <param name="newCmd">The strings that invoke the <paramref name="handler"/>.</param> public static void AddCommand(MBCShellCommandHandler handler, params string[] newCmd) { if (newCmd.Length < 2) { throw new ArgumentException("AddCommand() must be provided with at least a command and a description."); } var concatCmd = new StringBuilder(); concatCmd.Append(newCmd[0]); for (int i = 1; i < newCmd.Length - 1; i++) { concatCmd.Append(' '); concatCmd.Append(newCmd[i]); } availableCommands.Add(concatCmd.ToString(), handler); availableCommandDescriptions.Add(concatCmd.ToString(), newCmd[newCmd.Length - 1]); }