public UsingModelCommand(string modelname) { if (!CreateModelCommand.IsValidModelName(modelname)) { throw new ArgumentException(modelname + " is not a valid model name ", nameof(modelname)); } m_modelName = modelname; }
public AddEventCommand(string modelName, string eventName) : base(modelName) { if (!CreateModelCommand.IsValidModelName(modelName)) { throw new ArgumentException(modelName + " is not a valid model name", nameof(modelName)); } if (!AddEventCommand.IsValidEventName(eventName)) { throw new ArgumentException(eventName + " is not a valid event name", nameof(eventName)); } m_eventName = eventName; }
/// <summary> /// Does the command line include a valid USING [modelname] section /// </summary> /// <param name="commandLine"></param> /// <returns></returns> public static bool IsValidUsingModelCommand(string commandLine) { if (!string.IsNullOrWhiteSpace(commandLine)) { string[] commandParts = commandLine.Split(' '); if (commandParts != null) { if (commandParts.GetLength(0) >= 2) { // Is this a USING command? if (commandParts[0].Equals(CommandLineParser.COMMAND_USING, StringComparison.OrdinalIgnoreCase)) { // Is there a valid model name? return(CreateModelCommand.IsValidModelName(commandParts[1])); } } } } return(false); }
/// <summary> /// is the command line a valid "Create model" command /// </summary> /// <param name="commandLine"> /// The command passed in :- CREATE MODEL modelname /// </param> public override bool IsValidCommand(string commandLine) { return(CreateModelCommand.IsValidCreateModelCommand(commandLine)); }