Exemple #1
0
        public bool OnSetRevivableAttReq(NetCommand command)
        {
            string strServerName;
            bool   bRevivable;

            if (command.ReadString(out strServerName) == false)
            {
                return(false);
            }
            if (command.ReadBoolean(out bRevivable) == false)
            {
                return(false);
            }

            m_refServerMonitor.SetServerRevivable(strServerName, bRevivable);

            TRANS_SERVERINFONODE[] serverInfo = new TRANS_SERVERINFONODE[1];
            if (m_refServerMonitor.refServerInfoMgr.GetTRANS_SERVERINFONODE(strServerName, ref serverInfo[0]) == false)
            {
                return(false);
            }

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

            return(true);
        }
        private bool OnCheckCommandVersionRes(NetCommand command)
        {
            bool bSuccess = false;

            if (command.ReadBoolean(out bSuccess) == false)
            {
                return(false);
            }

            if (false == bSuccess)
            {
                MachineInfo refMachineInfo = m_refServerMonitorClient.refMachineInfoMgr.Find(command.SessionID);
                if (null == refMachineInfo)
                {
                    return(false);
                }

                System.Windows.Forms.MessageBox.Show(refMachineInfo.GetName() + " 머신과 커맨드 버젼이 일치하지 않아 종료합니다.");
                System.Windows.Forms.Application.Exit();
                return(true);
            }

            m_refCommandSender.SendRequestServerList(command.SessionID);

            return(true);
        }
        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);
        }
        private bool OnCheckCommandVersionRes(NetCommand command)
        {
            bool bSuccess = false;

            if (command.ReadBoolean(out bSuccess) == false)
            {
                return(false);
            }

            if (bSuccess == false)
            {
                FileLog.Instance.Write("커맨드 버젼이 일치하지 않아 종료합니다. 새 버젼으로 업데이트가 필요합니다.");
                System.Windows.Forms.Application.Exit();
                return(false);
            }

            if (m_refAutoModeClient.Mode == AUTO_MODE_TYPE.JUST_START)
            {
                if (m_refAutoModeClient.TargetServerName.ToLower().Equals("all"))
                {
                    if (m_refCommandSender.SendStartAllServer(command.SessionID) == false)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (m_refCommandSender.SendStartServer(command.SessionID, m_refAutoModeClient.TargetServerName) == false)
                    {
                        return(false);
                    }
                }
            }
            else if (m_refAutoModeClient.Mode == AUTO_MODE_TYPE.JUST_STOP)
            {
                if (m_refAutoModeClient.TargetServerName.ToLower().Equals("all"))
                {
                    if (m_refCommandSender.SendTerminateAllServer(command.SessionID) == false)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (m_refCommandSender.SendTerminateServer(command.SessionID, m_refAutoModeClient.TargetServerName) == false)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        private bool OnConnected(NetCommand command)
        {
            UInt64 nSessionID;
            bool   bIsSuccess;

            if (command.ReadUInt64(out nSessionID) == false)
            {
                return(false);
            }
            if (command.ReadBoolean(out bIsSuccess) == false)
            {
                return(false);
            }

            m_refServerMonitorClient.OnConnectedMachine(nSessionID, bIsSuccess);
            return(true);
        }
        private bool OnConnected(NetCommand command)
        {
            UInt64 nSessionID;
            bool   bIsSuccess;

            if (command.ReadUInt64(out nSessionID) == false)
            {
                return(false);
            }
            if (command.ReadBoolean(out bIsSuccess) == false)
            {
                return(false);
            }

            if (bIsSuccess)
            {
                m_refAutoModeClient.OnConnected();
            }
            else
            {
                System.Windows.Forms.Application.Exit();
            }
            return(true);
        }