コード例 #1
0
ファイル: CommandMgr.cs プロジェクト: SkelletonX/DDTServer
        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);
        }
コード例 #2
0
 public static void DisplaySyntax(BaseClient client)
 {
     client.DisplayMessage("Commands list:");
     string[] commandList = CommandMgr.GetCommandList(ePrivLevel.Admin, true);
     for (int i = 0; i < commandList.Length; i++)
     {
         string str = commandList[i];
         client.DisplayMessage("         " + str);
     }
 }
コード例 #3
0
 public static bool HandleCommandNoPlvl(BaseClient client, string cmdLine)
 {
     try
     {
         string[]    array       = CommandMgr.ParseCmdLine(cmdLine);
         GameCommand gameCommand = CommandMgr.GuessCommand(array[0]);
         if (gameCommand == null)
         {
             return(false);
         }
         CommandMgr.ExecuteCommand(client, gameCommand, array);
     }
     catch (Exception exception)
     {
         if (CommandMgr.log.IsErrorEnabled)
         {
             CommandMgr.log.Error("HandleCommandNoPlvl", exception);
         }
     }
     return(true);
 }
コード例 #4
0
ファイル: CommandMgr.cs プロジェクト: SkelletonX/DDTServer
        public static bool HandleCommandNoPlvl(BaseClient client, string cmdLine)
        {
            bool result;

            try
            {
                string[]    pars      = CommandMgr.ParseCmdLine(cmdLine);
                GameCommand myCommand = CommandMgr.GuessCommand(pars[0]);
                if (myCommand == null)
                {
                    result = false;
                    return(result);
                }
                CommandMgr.ExecuteCommand(client, myCommand, pars);
            }
            catch (Exception e)
            {
                CommandMgr.log.Error("HandleCommandNoPlvl", e);
            }
            result = true;
            return(result);
        }
コード例 #5
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);
        }
コード例 #6
0
 public static void OnScriptCompiled(RoadEvent ev, object sender, EventArgs args)
 {
     CommandMgr.LoadCommands();
 }