Exemplo n.º 1
0
        private static bool Compare(string input, ECommand type)
        {
            if (input == null)
            {
                return(false);
            }
            switch (type)
            {
            case ECommand.START:
            case ECommand.TURN:
            case ECommand.INFO:
                return(input.StartsWith(type + " "));

            case ECommand.BOARD:
                return(input.StartsWith(type.ToString()));

            case ECommand.END:
            case ECommand.BEGIN:
            case ECommand.ABOUT:
                return(input.Equals(type.ToString()));

            default:
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the command class.
        /// </summary>
        /// <param name="command">Command enum.<see cref="ECommand"/>.</param>
        /// <returns>return the type.</returns>
        public static Type GetCommandClass(ECommand command)
        {
            ITypeFinder typeFinder = new TypeFinder();

            var types = typeFinder.FindAll().Where(zw => zw.Name == command.ToString() + "Command");

            return(types.FirstOrDefault());
        }
Exemplo n.º 3
0
 public Command(ECommand eCommand, KeyCode keyCode)
 {
     Name     = eCommand.ToString();
     ECommand = eCommand;
     KeyCode  = keyCode;
 }