Пример #1
0
        public static GameSessionLocation DeserializeLengthDelimited(Stream stream, GameSessionLocation instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(GameSessionLocation.Deserialize(stream, instance, num));
        }
 public static void Serialize(Stream stream, GameSessionInfo instance)
 {
     if (instance.HasStartTime)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.StartTime);
     }
     if (instance.HasLocation)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteUInt32(stream, instance.Location.GetSerializedSize());
         GameSessionLocation.Serialize(stream, instance.Location);
     }
     if (instance.HasHasBenefactor)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteBool(stream, instance.HasBenefactor);
     }
     if (instance.HasIsUsingIgr)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.IsUsingIgr);
     }
     if (instance.HasParentalControlsActive)
     {
         stream.WriteByte(56);
         ProtocolParser.WriteBool(stream, instance.ParentalControlsActive);
     }
 }
Пример #3
0
        public static GameSessionLocation DeserializeLengthDelimited(Stream stream)
        {
            GameSessionLocation gameSessionLocation = new GameSessionLocation();

            GameSessionLocation.DeserializeLengthDelimited(stream, gameSessionLocation);
            return(gameSessionLocation);
        }
        public static GameSessionLocation DeserializeLengthDelimited(Stream stream, GameSessionLocation instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(GameSessionLocation.Deserialize(stream, instance, position));
        }
Пример #5
0
 public static GameSessionLocation Deserialize(Stream stream, GameSessionLocation instance, long limit)
 {
     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)
                     {
                         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.City = ProtocolParser.ReadString(stream);
                     }
                 }
                 else
                 {
                     instance.Country = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else
             {
                 instance.IpAddress = ProtocolParser.ReadString(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static GameSessionLocation Deserialize(Stream stream, GameSessionLocation instance, long limit)
 {
     while (true)
     {
         if (limit < (long)0 || stream.Position < limit)
         {
             int num = stream.ReadByte();
             if (num == -1)
             {
                 if (limit >= (long)0)
                 {
                     throw new EndOfStreamException();
                 }
                 break;
             }
             else if (num == 10)
             {
                 instance.IpAddress = ProtocolParser.ReadString(stream);
             }
             else if (num == 16)
             {
                 instance.Country = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 26)
             {
                 instance.City = ProtocolParser.ReadString(stream);
             }
             else
             {
                 Key key = ProtocolParser.ReadKey((byte)num, stream);
                 if (key.Field == 0)
                 {
                     throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                 }
                 ProtocolParser.SkipKey(stream, key);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Пример #7
0
 public static void Serialize(Stream stream, GameSessionLocation instance)
 {
     if (instance.HasIpAddress)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.IpAddress));
     }
     if (instance.HasCountry)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.Country);
     }
     if (instance.HasCity)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.City));
     }
 }
        public override bool Equals(object obj)
        {
            GameSessionLocation gameSessionLocation = obj as GameSessionLocation;

            if (gameSessionLocation == null)
            {
                return(false);
            }
            if (this.HasIpAddress != gameSessionLocation.HasIpAddress || this.HasIpAddress && !this.IpAddress.Equals(gameSessionLocation.IpAddress))
            {
                return(false);
            }
            if (this.HasCountry != gameSessionLocation.HasCountry || this.HasCountry && !this.Country.Equals(gameSessionLocation.Country))
            {
                return(false);
            }
            if (this.HasCity == gameSessionLocation.HasCity && (!this.HasCity || this.City.Equals(gameSessionLocation.City)))
            {
                return(true);
            }
            return(false);
        }
Пример #9
0
 public static GameSessionLocation Deserialize(Stream stream, GameSessionLocation instance)
 {
     return(GameSessionLocation.Deserialize(stream, instance, -1L));
 }
Пример #10
0
 public void Deserialize(Stream stream)
 {
     GameSessionLocation.Deserialize(stream, this);
 }
Пример #11
0
        public override bool Equals(object obj)
        {
            GameSessionLocation gameSessionLocation = obj as GameSessionLocation;

            return(gameSessionLocation != null && this.HasIpAddress == gameSessionLocation.HasIpAddress && (!this.HasIpAddress || this.IpAddress.Equals(gameSessionLocation.IpAddress)) && this.HasCountry == gameSessionLocation.HasCountry && (!this.HasCountry || this.Country.Equals(gameSessionLocation.Country)) && this.HasCity == gameSessionLocation.HasCity && (!this.HasCity || this.City.Equals(gameSessionLocation.City)));
        }
 public void SetLocation(GameSessionLocation val)
 {
     this.Location = val;
 }
 public static GameSessionInfo Deserialize(Stream stream, GameSessionInfo instance, long limit)
 {
     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 != 24)
             {
                 if (num2 != 34)
                 {
                     if (num2 != 40)
                     {
                         if (num2 != 48)
                         {
                             if (num2 != 56)
                             {
                                 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.ParentalControlsActive = ProtocolParser.ReadBool(stream);
                             }
                         }
                         else
                         {
                             instance.IsUsingIgr = ProtocolParser.ReadBool(stream);
                         }
                     }
                     else
                     {
                         instance.HasBenefactor = ProtocolParser.ReadBool(stream);
                     }
                 }
                 else if (instance.Location == null)
                 {
                     instance.Location = GameSessionLocation.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     GameSessionLocation.DeserializeLengthDelimited(stream, instance.Location);
                 }
             }
             else
             {
                 instance.StartTime = ProtocolParser.ReadUInt32(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }