/// <summary> /// Validates the arguments for the command. /// </summary> /// <param name="input">The IInput containing the arguments for the command.</param> /// <param name="errorMessage">An error message detailing the problems with the arguments, null if the arguments are valid.</param> /// <returns>True if the arguments are valid for this command; otherwise false.</returns> public virtual bool ValidateArguments(IInput input, out string errorMessage) { var cmd = Game.Current.Commands.FindCommandInternal(input.CommandName); if (cmd == null) { errorMessage = string.Format(CommonResources.HelpNotFoundFormat, input.CommandName); return false; } if (cmd.Metadata.Arguments.Any(arg => !string.IsNullOrEmpty(arg) && !input.Contains(arg))) { errorMessage = string.Format(CommonResources.CommandInvalidArgumentsFormat, cmd.Metadata.Name, cmd.Metadata.Synopsis); return false; } errorMessage = null; return true; }