Exemple #1
0
        public static GameCommand GuessCommand(string cmd)
        {
            GameCommand myCommand = CommandMgr.GetCommand(cmd);
            GameCommand result;

            if (myCommand != null)
            {
                result = myCommand;
            }
            else
            {
                string compareCmdStr       = cmd.ToLower();
                IDictionaryEnumerator iter = CommandMgr.m_cmds.GetEnumerator();
                while (iter.MoveNext())
                {
                    GameCommand currentCommand    = iter.Value as GameCommand;
                    string      currentCommandStr = iter.Key as string;
                    if (currentCommand != null)
                    {
                        if (currentCommandStr.ToLower().StartsWith(compareCmdStr))
                        {
                            myCommand = currentCommand;
                            break;
                        }
                    }
                }
                result = myCommand;
            }
            return(result);
        }
Exemple #2
0
        public static GameCommand GuessCommand(string cmd)
        {
            GameCommand gameCommand = CommandMgr.GetCommand(cmd);

            if (gameCommand != null)
            {
                return(gameCommand);
            }
            string value = cmd.ToLower();
            IDictionaryEnumerator enumerator = CommandMgr.m_cmds.GetEnumerator();

            while (enumerator.MoveNext())
            {
                GameCommand gameCommand2 = enumerator.Value as GameCommand;
                string      text         = enumerator.Key as string;
                if (gameCommand2 != null && text.ToLower().StartsWith(value))
                {
                    gameCommand = gameCommand2;
                    break;
                }
            }
            return(gameCommand);
        }