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); }
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 OnMonitoringLog(NetCommand command) { string strDateTime; string strServerName; int nWorldID; int nServerID; string strLogMessage; if (command.ReadString(out strDateTime) == false) { return(false); } if (command.ReadString(out strServerName) == false) { return(false); } if (command.ReadInt32(out nWorldID) == false) { return(false); } if (command.ReadInt32(out nServerID) == false) { return(false); } if (command.ReadString(out strLogMessage) == false) { return(false); } UInt64 nSessionID = command.SessionID; m_refServerMonitorClient.AddMonitoringLog(strDateTime, nSessionID, strServerName, nWorldID, nServerID, strLogMessage); string[] arrServerName = { strServerName }; m_refCommandSender.SendRequestServerInfo(nSessionID, arrServerName); return(true); }
public bool OnCheckCommandVersionReq(NetCommand command) { int nCommadVersion = 0; if (command.ReadInt32(out nCommadVersion) == false) { return(false); } if (CMD.COMMAND_VERSION == nCommadVersion) { m_refCommandSender.SendCheckCommandVersionRes(command.SessionID, true); m_refServerMonitor.OnSetReliableClient(command.SessionID); } else { m_refCommandSender.SendCheckCommandVersionRes(command.SessionID, false); m_refServerMonitor.DisconnectSession(command.SessionID); } return(true); }