Ejemplo n.º 1
0
        private bool OnGetServerInfoRes(NetCommand command)
        {
            byte nServerCount;

            if (command.ReadByte(out nServerCount) == false)
            {
                return(false);
            }

            TRANS_SERVERINFONODE[] arrServerInfo = new TRANS_SERVERINFONODE[nServerCount];
            for (int i = 0; i < nServerCount; ++i)
            {
                if (command.ReadString(out arrServerInfo[i].strServerName) == false)
                {
                    return(false);
                }
                if (command.ReadByte(out arrServerInfo[i].nProcessState) == false)
                {
                    return(false);
                }
                if (command.ReadByte(out arrServerInfo[i].nServableState) == false)
                {
                    return(false);
                }
                if (command.ReadBoolean(out arrServerInfo[i].bRevivable) == false)
                {
                    return(false);
                }
                if (command.ReadInt32(out arrServerInfo[i].nCurServerPlayerCount) == false)
                {
                    return(false);
                }
            }

            UInt64 nSessionID = command.SessionID;

            MachineInfo refMachineInfo = m_refServerMonitorClient.refMachineInfoMgr.Find(nSessionID);

            if (null == refMachineInfo)
            {
                return(false);
            }

            for (int i = 0; i < nServerCount; ++i)
            {
                string         strServerName         = arrServerInfo[i].strServerName;
                PROCESS_STATE  eProcessState         = (PROCESS_STATE)arrServerInfo[i].nProcessState;
                SERVABLE_STATE eServableState        = (SERVABLE_STATE)arrServerInfo[i].nServableState;
                bool           bRevivable            = arrServerInfo[i].bRevivable;
                int            nCurServerPlayerCount = arrServerInfo[i].nCurServerPlayerCount;

                m_refServerMonitorClient.UpdateServerInfo(refMachineInfo.GetName(), strServerName, eProcessState, eServableState, bRevivable, nCurServerPlayerCount);
            }

            m_refServerMonitorClient.UpdateMachinePlayerCount(refMachineInfo.GetName());

            return(true);
        }
Ejemplo n.º 2
0
        private bool OnGetServerListRes(NetCommand command)
        {
            byte nServerCount;

            if (command.ReadByte(out nServerCount) == false)
            {
                return(false);
            }

            TRANS_SERVERLISTNODE[] arrServerListNode = new TRANS_SERVERLISTNODE[nServerCount];
            for (int i = 0; i < nServerCount; ++i)
            {
                if (command.ReadString(out arrServerListNode[i].strServerName) == false)
                {
                    return(false);
                }
                if (command.ReadByte(out arrServerListNode[i].nServerType) == false)
                {
                    return(false);
                }
                if (command.ReadInt32(out arrServerListNode[i].nWorldID) == false)
                {
                    return(false);
                }
                if (command.ReadInt32(out arrServerListNode[i].nServerID) == false)
                {
                    return(false);
                }
            }

            UInt64 nSessionID = command.SessionID;

            MachineInfo refMachineInfo = m_refServerMonitorClient.refMachineInfoMgr.Find(nSessionID);

            if (null == refMachineInfo)
            {
                return(false);
            }

            m_refServerMonitorClient.ClearServerInfo(refMachineInfo.GetName());
            for (int i = 0; i < nServerCount; ++i)
            {
                m_refServerMonitorClient.AddServerInfo(refMachineInfo.GetName(), ref arrServerListNode[i]);
            }


            ServerInfoMgr refServerInfoMgr = m_refServerMonitorClient.refMachineInfoMgr.GetServerInfoMgr(refMachineInfo.GetName());

            string[] arrServerNames;
            refServerInfoMgr.GetAllServerName(out arrServerNames);
            m_refCommandSender.SendRequestServerInfo(nSessionID, arrServerNames);
            return(true);
        }
Ejemplo n.º 3
0
        public bool OnGetServerInfoReq(NetCommand command)
        {
            byte nServerNameCount;

            string[] arrServerNames;

            if (command.ReadByte(out nServerNameCount) == false)
            {
                return(false);
            }

            arrServerNames = new string[nServerNameCount];
            for (int i = 0; i < nServerNameCount; ++i)
            {
                if (command.ReadString(out arrServerNames[i]) == false)
                {
                    return(false);
                }
            }


            TRANS_SERVERINFONODE        serverInfo     = new TRANS_SERVERINFONODE();
            List <TRANS_SERVERINFONODE> listServerInfo = new List <TRANS_SERVERINFONODE>();

            for (int i = 0; i < nServerNameCount; ++i)
            {
                if (m_refServerMonitor.refServerInfoMgr.GetTRANS_SERVERINFONODE(arrServerNames[i], ref serverInfo) == false)
                {
                    continue;
                }

                listServerInfo.Add(serverInfo);
            }

            TRANS_SERVERINFONODE[] arrServerInfo = new TRANS_SERVERINFONODE[listServerInfo.Count];
            listServerInfo.CopyTo(arrServerInfo);

            if (m_refCommandSender.SendGetServerInfoRes(command.SessionID, ref arrServerInfo) == false)
            {
                return(false);
            }

            return(true);
        }