public static GameHandle DeserializeLengthDelimited(Stream stream, GameHandle instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(GameHandle.Deserialize(stream, instance, position));
        }
Esempio n. 2
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, 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, 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);
                }
            }
        }
Esempio n. 5
0
        public static GameHandle DeserializeLengthDelimited(Stream stream, GameHandle instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(GameHandle.Deserialize(stream, instance, num));
        }
        public static GameHandle DeserializeLengthDelimited(Stream stream)
        {
            GameHandle gameHandle = new GameHandle();

            GameHandle.DeserializeLengthDelimited(stream, gameHandle);
            return(gameHandle);
        }
 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. 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.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);
     }
 }
 public static PlayerLeftNotification Deserialize(Stream stream, PlayerLeftNotification instance, long limit)
 {
     instance.Reason = 1u;
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 24)
                 {
                     Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                     uint field = key.Field;
                     if (field == 0u)
                     {
                         throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                     }
                     ProtocolParser.SkipKey(stream, key);
                 }
                 else
                 {
                     instance.Reason = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else if (instance.MemberId == null)
             {
                 instance.MemberId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.MemberId);
             }
         }
         else if (instance.GameHandle == null)
         {
             instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Esempio n. 10
0
 public static JoinGameRequest Deserialize(Stream stream, JoinGameRequest instance, long limit)
 {
     if (instance.Player == null)
     {
         instance.Player = new List <Player>();
     }
     instance.AdvancedNotification = false;
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 24)
                 {
                     Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                     uint field = key.Field;
                     if (field == 0u)
                     {
                         throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                     }
                     ProtocolParser.SkipKey(stream, key);
                 }
                 else
                 {
                     instance.AdvancedNotification = ProtocolParser.ReadBool(stream);
                 }
             }
             else
             {
                 instance.Player.Add(bnet.protocol.game_master.Player.DeserializeLengthDelimited(stream));
             }
         }
         else if (instance.GameHandle == null)
         {
             instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
         }
         else
         {
             GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Esempio n. 11
0
        public static GameHandle Deserialize(Stream stream, GameHandle instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else
                {
                    int num2 = num;
                    if (num2 != 9)
                    {
                        if (num2 != 18)
                        {
                            Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                            uint field = key.Field;
                            if (field == 0u)
                            {
                                throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                            }
                            ProtocolParser.SkipKey(stream, key);
                        }
                        else if (instance.GameId == null)
                        {
                            instance.GameId = EntityId.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            EntityId.DeserializeLengthDelimited(stream, instance.GameId);
                        }
                    }
                    else
                    {
                        instance.FactoryId = binaryReader.ReadUInt64();
                    }
                }
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
        public static void Serialize(Stream stream, GameHandle instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(9);
            binaryWriter.Write(instance.FactoryId);
            if (instance.GameId == null)
            {
                throw new ArgumentNullException("GameId", "Required by proto specification.");
            }
            stream.WriteByte(18);
            ProtocolParser.WriteUInt32(stream, instance.GameId.GetSerializedSize());
            EntityId.Serialize(stream, instance.GameId);
        }
Esempio n. 13
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 override bool Equals(object obj)
        {
            GameHandle gameHandle = obj as GameHandle;

            if (gameHandle == null)
            {
                return(false);
            }
            if (!this.FactoryId.Equals(gameHandle.FactoryId))
            {
                return(false);
            }
            if (!this.GameId.Equals(gameHandle.GameId))
            {
                return(false);
            }
            return(true);
        }
 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. 16
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 static GameFoundNotification Deserialize(Stream stream, GameFoundNotification instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            instance.ErrorCode = 0u;
            if (instance.ConnectInfo == null)
            {
                instance.ConnectInfo = new List <ConnectInfo>();
            }
            while (limit < 0L || stream.Position < limit)
            {
                int num = stream.ReadByte();
                if (num == -1)
                {
                    if (limit >= 0L)
                    {
                        throw new EndOfStreamException();
                    }
                    return(instance);
                }
                else if (num != 9)
                {
                    if (num != 16)
                    {
                        if (num != 26)
                        {
                            if (num != 34)
                            {
                                Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                                uint field = key.Field;
                                if (field == 0u)
                                {
                                    throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                                }
                                ProtocolParser.SkipKey(stream, key);
                            }
                            else
                            {
                                instance.ConnectInfo.Add(bnet.protocol.game_master.ConnectInfo.DeserializeLengthDelimited(stream));
                            }
                        }
                        else if (instance.GameHandle == null)
                        {
                            instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
                        }
                        else
                        {
                            GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
                        }
                    }
                    else
                    {
                        instance.ErrorCode = ProtocolParser.ReadUInt32(stream);
                    }
                }
                else
                {
                    instance.RequestId = binaryReader.ReadUInt64();
                }
            }
            if (stream.Position == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }
Esempio n. 18
0
        public override bool Equals(object obj)
        {
            GameHandle gameHandle = obj as GameHandle;

            return(gameHandle != null && this.FactoryId.Equals(gameHandle.FactoryId) && this.GameId.Equals(gameHandle.GameId));
        }
 public static GameHandle Deserialize(Stream stream, GameHandle instance)
 {
     return(GameHandle.Deserialize(stream, instance, (long)-1));
 }
 public void Deserialize(Stream stream)
 {
     GameHandle.Deserialize(stream, this);
 }
 public void Serialize(Stream stream)
 {
     GameHandle.Serialize(stream, this);
 }
 public void SetGameHandle(GameHandle val)
 {
     this.GameHandle = val;
 }
 public static ChangeGameRequest Deserialize(Stream stream, ChangeGameRequest instance, long limit)
 {
     if (instance.Attribute == null)
     {
         instance.Attribute = new List <Attribute>();
     }
     instance.Replace = false;
     while (limit < 0L || stream.get_Position() < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else
         {
             int num2 = num;
             if (num2 != 10)
             {
                 if (num2 != 16)
                 {
                     if (num2 != 26)
                     {
                         if (num2 != 32)
                         {
                             Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                             uint field = key.Field;
                             if (field == 0u)
                             {
                                 throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                             }
                             ProtocolParser.SkipKey(stream, key);
                         }
                         else
                         {
                             instance.Replace = ProtocolParser.ReadBool(stream);
                         }
                     }
                     else
                     {
                         instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream));
                     }
                 }
                 else
                 {
                     instance.Open = ProtocolParser.ReadBool(stream);
                 }
             }
             else if (instance.GameHandle == null)
             {
                 instance.GameHandle = GameHandle.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameHandle.DeserializeLengthDelimited(stream, instance.GameHandle);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }