Пример #1
0
        public static void TryExecuteCommand(string[] words)
        {
            ICommand cmd = FindCommandWithKeyword(words[0]);

            if (cmd != null)
            {
                ValidationState result = cmd.Validate(words);
                if (result.Equals(ValidationState.Fail))
                {
                }
                else if (result.Equals(ValidationState.Error))
                {
                    cmd.PrintErrorMessage();
                }
                else if (result.Equals(ValidationState.Success))
                {
                    cmd.CallCommand();
                }
            }
            else
            {
                PrintErrorMessage();
            }
        }