Exemplo n.º 1
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            num += 8u;
            if (this.HasErrorCode)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt32(this.ErrorCode);
            }
            if (this.HasGameHandle)
            {
                num += 1u;
                uint serializedSize = this.GameHandle.GetSerializedSize();
                num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            }
            if (this.ConnectInfo.get_Count() > 0)
            {
                using (List <ConnectInfo> .Enumerator enumerator = this.ConnectInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ConnectInfo current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize2 = current.GetSerializedSize();
                        num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
                    }
                }
            }
            num += 1u;
            return(num);
        }
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.HasRequestId)
            {
                num += 1u;
                num += 8u;
            }
            if (this.HasQueued)
            {
                num += 1u;
                num += 1u;
            }
            if (this.ConnectInfo.get_Count() > 0)
            {
                using (List <ConnectInfo> .Enumerator enumerator = this.ConnectInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ConnectInfo current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            return(num);
        }
Exemplo n.º 3
0
        public static void Serialize(Stream stream, GameFoundNotification instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(9);
            binaryWriter.Write(instance.RequestId);
            if (instance.HasErrorCode)
            {
                stream.WriteByte(16);
                ProtocolParser.WriteUInt32(stream, instance.ErrorCode);
            }
            if (instance.HasGameHandle)
            {
                stream.WriteByte(26);
                ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
                GameHandle.Serialize(stream, instance.GameHandle);
            }
            if (instance.ConnectInfo.get_Count() > 0)
            {
                using (List <ConnectInfo> .Enumerator enumerator = instance.ConnectInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ConnectInfo current = enumerator.get_Current();
                        stream.WriteByte(34);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        bnet.protocol.game_master.ConnectInfo.Serialize(stream, current);
                    }
                }
            }
        }
        public static void Serialize(Stream stream, JoinGameResponse instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasRequestId)
            {
                stream.WriteByte(9);
                binaryWriter.Write(instance.RequestId);
            }
            if (instance.HasQueued)
            {
                stream.WriteByte(16);
                ProtocolParser.WriteBool(stream, instance.Queued);
            }
            if (instance.ConnectInfo.get_Count() > 0)
            {
                using (List <ConnectInfo> .Enumerator enumerator = instance.ConnectInfo.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ConnectInfo current = enumerator.get_Current();
                        stream.WriteByte(26);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        bnet.protocol.game_master.ConnectInfo.Serialize(stream, current);
                    }
                }
            }
        }