IsValidForCommand() 공개 메소드

Tests if the given command is valid. A null or empty command is always valid.
public IsValidForCommand ( string command ) : bool
command string
리턴 bool
예제 #1
0
        /// <summary>
        /// Is the given command a valid command for this switch (i.e. is this switch used by this command)
        /// </summary>
        /// <param name="argument"></param>
        /// <param name="command"></param>
        /// <returns></returns>
        private bool IsValidForCommand(CommandLineArgument argument, string command)
        {
            if (argument.IsValidForCommand(command))
                return true;

            // check the command attributes instead if they contain this switch name
            EnsureCommandSwitches();

            return Array.Exists(commandSwitches[command],
                delegate(string s) { return string.CompareOrdinal(s, argument.Name) == 0; });
        }
예제 #2
0
        /// <summary>
        /// Is the argument valid of for this command?
        /// </summary>
        /// <param name="argument"></param>
        /// <param name="command"></param>
        /// <returns></returns>
        private bool IsValidArgumentForCommand(CommandLineArgument argument, string command)
        {
            if (argument.IsValidForCommand(command))
                return true;

            LazyGenerateCommandArguments();

            return Array.Exists(commandArguments[command],
                delegate(string s)
                {
                    return string.CompareOrdinal(s, argument.Name) == 0;
                });
        }