Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }