Ejemplo n.º 1
0
        public bool Read(ByteArrayReaderWriter reader)
        {
            char[] vInfo = new char[13];
            reader.ReadASCIICharsIntoBuffer(vInfo, 13);
            if (!MiscUtils.MatchChars(vInfo, Defines.NETCODE_VERSION_INFO_STR))
            {
                return(false);
            }

            ProtocolID = reader.ReadUInt64();

            CreateTimestamp          = reader.ReadUInt64();
            ExpireTimestamp          = reader.ReadUInt64();
            ConnectTokenSequence     = reader.ReadUInt64();
            PrivateConnectTokenBytes = reader.ReadBytes(Defines.NETCODE_CONNECT_TOKEN_PRIVATE_BYTES);

            int numServers = (int)reader.ReadUInt32();

            if (numServers < 1 || numServers > Defines.MAX_SERVER_ADDRESSES)
            {
                return(false);
            }

            this.ConnectServers = new ConnectTokenServerEntry[numServers];
            for (int i = 0; i < numServers; i++)
            {
                this.ConnectServers[i] = new ConnectTokenServerEntry();
                this.ConnectServers[i].ReadData(reader);
            }

            ClientToServerKey = reader.ReadBytes(32);
            ServerToClientKey = reader.ReadBytes(32);
            TimeoutSeconds    = reader.ReadUInt32();

            return(true);
        }