Esempio n. 1
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, 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.Count > 0)
            {
                foreach (ConnectInfo connectInfo in instance.ConnectInfo)
                {
                    stream.WriteByte(34);
                    ProtocolParser.WriteUInt32(stream, connectInfo.GetSerializedSize());
                    bnet.protocol.game_master.ConnectInfo.Serialize(stream, connectInfo);
                }
            }
        }
 public static void Serialize(Stream stream, ChangeGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.HasOpen)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteBool(stream, instance.Open);
     }
     if (instance.Attribute.get_Count() > 0)
     {
         using (List <Attribute> .Enumerator enumerator = instance.Attribute.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Attribute current = enumerator.get_Current();
                 stream.WriteByte(26);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.attribute.Attribute.Serialize(stream, current);
             }
         }
     }
     if (instance.HasReplace)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteBool(stream, instance.Replace);
     }
 }
 public static void Serialize(Stream stream, ChangeGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.HasOpen)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteBool(stream, instance.Open);
     }
     if (instance.Attribute.Count > 0)
     {
         foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute)
         {
             stream.WriteByte(26);
             ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize());
             bnet.protocol.attribute.Attribute.Serialize(stream, attribute);
         }
     }
     if (instance.HasReplace)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteBool(stream, instance.Replace);
     }
 }
Esempio n. 5
0
 public static void Serialize(Stream stream, JoinGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.Player.get_Count() > 0)
     {
         using (List <Player> .Enumerator enumerator = instance.Player.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Player current = enumerator.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.game_master.Player.Serialize(stream, current);
             }
         }
     }
     if (instance.HasAdvancedNotification)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteBool(stream, instance.AdvancedNotification);
     }
 }
Esempio n. 6
0
 public static void Serialize(Stream stream, GameEndedNotification instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.HasReason)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.Reason);
     }
 }
 public static void Serialize(Stream stream, PlayerLeftNotification instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.MemberId == null)
     {
         throw new ArgumentNullException("MemberId", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.MemberId.GetSerializedSize());
     EntityId.Serialize(stream, instance.MemberId);
     if (instance.HasReason)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.Reason);
     }
 }
Esempio n. 8
0
 public static void Serialize(Stream stream, JoinGameRequest instance)
 {
     if (instance.GameHandle == null)
     {
         throw new ArgumentNullException("GameHandle", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameHandle.GetSerializedSize());
     GameHandle.Serialize(stream, instance.GameHandle);
     if (instance.Player.Count > 0)
     {
         foreach (Player player in instance.Player)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, player.GetSerializedSize());
             bnet.protocol.game_master.Player.Serialize(stream, player);
         }
     }
     if (instance.HasAdvancedNotification)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteBool(stream, instance.AdvancedNotification);
     }
 }
 public void Serialize(Stream stream)
 {
     GameHandle.Serialize(stream, this);
 }