public virtual bool SendRequestServerInfo(UInt64 nSessionID, string[] arrServerNames) { if (nSessionID == 0 || arrServerNames.Length == 0) { return(false); } try { NetCommand commandSend = new NetCommand(nSessionID, CMD.GET_SERVERINFO_REQ); if (commandSend.WriteByte((byte)arrServerNames.Length) == false) { return(false); } for (int i = 0; i < arrServerNames.Length; ++i) { if (commandSend.WriteString(arrServerNames[i]) == false) { return(false); } } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
public virtual bool SendToggleReviveServer(UInt64 nSessionID, string strServerName, bool bRevive) { if (nSessionID == 0 || strServerName.Length == 0) { return(false); } try { NetCommand commandSend = new NetCommand(nSessionID, CMD.SET_REVIVABLE_ATT_REQ); if (commandSend.WriteString(strServerName) == false) { return(false); } if (commandSend.WriteBoolean(bRevive) == false) { return(false); } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
public virtual bool SendStartServer(UInt64 nSessionID, string strServerName) { if (nSessionID == 0 || strServerName.Length == 0) { return(false); } try { NetCommand commandSend = new NetCommand(nSessionID, CMD.START_SERVER_REQ); if (commandSend.WriteString(strServerName) == false) { return(false); } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
private void PostDisconnected() { NetCommand command = new NetCommand(0, LocalCMD.DISCONNECTED); command.WriteUInt64(m_nSessionID); command.MakingComplete(); m_refCommandQueue.PushCommand(command); }
private void PostConnected(bool bIsSuccess) { NetCommand command = new NetCommand(0, LocalCMD.CONNECTED); command.WriteUInt64(m_nSessionID); command.WriteBoolean(bIsSuccess); command.MakingComplete(); m_refCommandQueue.PushCommand(command); }
public bool SendGetServerInfoRes(UInt64 nSessionID, ref TRANS_SERVERINFONODE[] arrServerInfo) { NetCommand commandSend = new NetCommand(nSessionID, CMD.GET_SERVERINFO_RES); if (commandSend.WriteByte((byte)arrServerInfo.Length) == false) { return(false); } for (int i = 0; i < arrServerInfo.Length; ++i) { if (commandSend.WriteString(arrServerInfo[i].strServerName) == false) { return(false); } if (commandSend.WriteByte((byte)arrServerInfo[i].nProcessState) == false) { return(false); } if (commandSend.WriteByte((byte)arrServerInfo[i].nServableState) == false) { return(false); } if (commandSend.WriteBoolean(arrServerInfo[i].bRevivable) == false) { return(false); } if (commandSend.WriteInt32(arrServerInfo[i].nCurServerPlayerCount) == false) { return(false); } } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetServer.Send(commandSend) == false) { return(false); } return(true); }
public bool SendCheckCommandVersionRes(UInt64 nSessionID, bool bSuccess) { NetCommand commandSend = new NetCommand(nSessionID, CMD.CHECK_CMD_VERSION_RES); if (commandSend.WriteBoolean(bSuccess) == false) { return(false); } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetServer.Send(commandSend) == false) { return(false); } return(true); }
public bool SendGetServerListRes(UInt64 nSessionID, ref TRANS_SERVERLISTNODE[] arrServerListNodes) { NetCommand commandSend = new NetCommand(nSessionID, CMD.GET_SERVERLIST_RES); if (commandSend.WriteByte((byte)arrServerListNodes.Length) == false) { return(false); } for (int i = 0; i < arrServerListNodes.Length; ++i) { if (commandSend.WriteString(arrServerListNodes[i].strServerName) == false) { return(false); } if (commandSend.WriteByte((byte)arrServerListNodes[i].nServerType) == false) { return(false); } if (commandSend.WriteInt32(arrServerListNodes[i].nWorldID) == false) { return(false); } if (commandSend.WriteInt32(arrServerListNodes[i].nServerID) == false) { return(false); } } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetServer.Send(commandSend) == false) { return(false); } return(true); }
public virtual bool SendCheckCommandVersionReq(UInt64 nSessionID, int nCommandVersion) { try { NetCommand commandSend = new NetCommand(nSessionID, CMD.CHECK_CMD_VERSION_REQ); if (commandSend.WriteInt32(nCommandVersion) == false) { return(false); } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
public virtual bool SendStartAllServer(UInt64 nSessionID) { if (nSessionID == 0) { return(false); } try { NetCommand commandSend = new NetCommand(nSessionID, CMD.START_ALL_SERVER_REQ); if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
public virtual bool SendRequestServerList(UInt64 nSessionID) { if (nSessionID == 0) { return(false); } try { NetCommand commandSend = new NetCommand(nSessionID, CMD.GET_SERVERLIST_REQ); if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetClient.Post(commandSend) == false) { return(false); } } catch { return(false); } return(true); }
public bool SendSetverMonitoringLog(UInt64 nSessionID, string strDateTime, string strServerName, int nWorldID, int nServerID, string strLogString) { NetCommand commandSend = new NetCommand(nSessionID, CMD.MONITORING_LOG); if (commandSend.WriteString(strDateTime) == false) { return(false); } if (commandSend.WriteString(strServerName) == false) { return(false); } if (commandSend.WriteInt32(nWorldID) == false) { return(false); } if (commandSend.WriteInt32(nServerID) == false) { return(false); } if (commandSend.WriteString(strLogString) == false) { return(false); } if (commandSend.MakingComplete() == false) { return(false); } if (m_refNetServer.Send(commandSend) == false) { return(false); } return(true); }
private void ProcAccept() { bool bRun = true; while (bRun) { try { Socket socketClient = m_tcpListener.AcceptSocket(); if (socketClient.Connected == false) { continue; } UInt64 nSessionID = m_dlgtCreateSession(socketClient); NetCommand command = new NetCommand(0, LocalCMD.ACCEPTED); command.WriteUInt64(nSessionID); command.MakingComplete(); m_refCmdQueue.PushCommand(command); } catch { bRun = false; } } }