Пример #1
0
        public void ExecuteSelectedCommandAndDefault()
        {
            if (AllowedChars.Contains(activeCommandKey))
            {
                var command = dictionary[activeCommandKey];

                if (!command.IsContinious())
                {
                    activeCommandKey = ' ';
                }

                command.Execute();

                General.Execute();
            }
        }
Пример #2
0
    private static bool ValidateHairColour(string input)
    {
        const string AllowedChars = "abcdef1234567890";

        if (7 > input.Length)
        {
            return(false);
        }

        if ('#' != input[0])
        {
            return(false);
        }

        foreach (var ch in input.ToLowerInvariant().Skip(1))
        {
            if (false == AllowedChars.Contains(ch))
            {
                return(false);
            }
        }

        return(true);
    }