예제 #1
0
        public static void Serialize(Stream stream, FindGameRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.Player.get_Count() > 0)
            {
                using (List <Player> .Enumerator enumerator = instance.Player.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Player current = enumerator.get_Current();
                        stream.WriteByte(10);
                        ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                        bnet.protocol.game_master.Player.Serialize(stream, current);
                    }
                }
            }
            if (instance.HasFactoryId)
            {
                stream.WriteByte(17);
                binaryWriter.Write(instance.FactoryId);
            }
            if (instance.HasProperties)
            {
                stream.WriteByte(26);
                ProtocolParser.WriteUInt32(stream, instance.Properties.GetSerializedSize());
                GameProperties.Serialize(stream, instance.Properties);
            }
            if (instance.HasObjectId)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteUInt64(stream, instance.ObjectId);
            }
            if (instance.HasRequestId)
            {
                stream.WriteByte(41);
                binaryWriter.Write(instance.RequestId);
            }
            if (instance.HasAdvancedNotification)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.AdvancedNotification);
            }
        }
예제 #2
0
        public static void Serialize(Stream stream, FindGameRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.Player.Count > 0)
            {
                foreach (Player player in instance.Player)
                {
                    stream.WriteByte(10);
                    ProtocolParser.WriteUInt32(stream, player.GetSerializedSize());
                    bnet.protocol.game_master.Player.Serialize(stream, player);
                }
            }
            if (instance.HasFactoryId)
            {
                stream.WriteByte(17);
                binaryWriter.Write(instance.FactoryId);
            }
            if (instance.HasProperties)
            {
                stream.WriteByte(26);
                ProtocolParser.WriteUInt32(stream, instance.Properties.GetSerializedSize());
                GameProperties.Serialize(stream, instance.Properties);
            }
            if (instance.HasObjectId)
            {
                stream.WriteByte(32);
                ProtocolParser.WriteUInt64(stream, instance.ObjectId);
            }
            if (instance.HasRequestId)
            {
                stream.WriteByte(41);
                binaryWriter.Write(instance.RequestId);
            }
            if (instance.HasAdvancedNotification)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteBool(stream, instance.AdvancedNotification);
            }
        }
예제 #3
0
 public void Serialize(Stream stream)
 {
     GameProperties.Serialize(stream, this);
 }