Ejemplo n.º 1
0
        public static AccountBlob DeserializeLengthDelimited(Stream stream, AccountBlob instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(AccountBlob.Deserialize(stream, instance, position));
        }
Ejemplo n.º 2
0
        public static AccountBlob DeserializeLengthDelimited(Stream stream, AccountBlob instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(AccountBlob.Deserialize(stream, instance, num));
        }
Ejemplo n.º 3
0
        public static AccountBlob DeserializeLengthDelimited(Stream stream)
        {
            AccountBlob accountBlob = new AccountBlob();

            AccountBlob.DeserializeLengthDelimited(stream, accountBlob);
            return(accountBlob);
        }
Ejemplo n.º 4
0
 public static void Serialize(Stream stream, GetAccountResponse instance)
 {
     if (instance.HasBlob)
     {
         stream.WriteByte(90);
         ProtocolParser.WriteUInt32(stream, instance.Blob.GetSerializedSize());
         AccountBlob.Serialize(stream, instance.Blob);
     }
     if (instance.HasId)
     {
         stream.WriteByte(98);
         ProtocolParser.WriteUInt32(stream, instance.Id.GetSerializedSize());
         AccountId.Serialize(stream, instance.Id);
     }
     if (instance.Email.get_Count() > 0)
     {
         using (List <string> .Enumerator enumerator = instance.Email.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 string current = enumerator.get_Current();
                 stream.WriteByte(106);
                 ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(current));
             }
         }
     }
     if (instance.HasBattleTag)
     {
         stream.WriteByte(114);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.BattleTag));
     }
     if (instance.HasFullName)
     {
         stream.WriteByte(122);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.FullName));
     }
     if (instance.Links.get_Count() > 0)
     {
         using (List <GameAccountLink> .Enumerator enumerator2 = instance.Links.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 GameAccountLink current2 = enumerator2.get_Current();
                 stream.WriteByte(130);
                 stream.WriteByte(1);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 GameAccountLink.Serialize(stream, current2);
             }
         }
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(138);
         stream.WriteByte(1);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
 }
Ejemplo n.º 5
0
 public static void Serialize(Stream stream, AccountBlobList instance)
 {
     if (instance.Blob.Count > 0)
     {
         foreach (AccountBlob accountBlob in instance.Blob)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, accountBlob.GetSerializedSize());
             AccountBlob.Serialize(stream, accountBlob);
         }
     }
 }
Ejemplo n.º 6
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            using (List <AccountBlob> .Enumerator enumerator = this.Blob.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AccountBlob current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            return(num);
        }
Ejemplo n.º 7
0
 public static void Serialize(Stream stream, GetAccountResponse instance)
 {
     if (instance.HasBlob)
     {
         stream.WriteByte(90);
         ProtocolParser.WriteUInt32(stream, instance.Blob.GetSerializedSize());
         AccountBlob.Serialize(stream, instance.Blob);
     }
     if (instance.HasId)
     {
         stream.WriteByte(98);
         ProtocolParser.WriteUInt32(stream, instance.Id.GetSerializedSize());
         AccountId.Serialize(stream, instance.Id);
     }
     if (instance.Email.Count > 0)
     {
         foreach (string s in instance.Email)
         {
             stream.WriteByte(106);
             ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(s));
         }
     }
     if (instance.HasBattleTag)
     {
         stream.WriteByte(114);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.BattleTag));
     }
     if (instance.HasFullName)
     {
         stream.WriteByte(122);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.FullName));
     }
     if (instance.Links.Count > 0)
     {
         foreach (GameAccountLink gameAccountLink in instance.Links)
         {
             stream.WriteByte(130);
             stream.WriteByte(1);
             ProtocolParser.WriteUInt32(stream, gameAccountLink.GetSerializedSize());
             GameAccountLink.Serialize(stream, gameAccountLink);
         }
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(138);
         stream.WriteByte(1);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
 }
Ejemplo n.º 8
0
 public static void Serialize(Stream stream, AccountBlobList instance)
 {
     if (instance.Blob.get_Count() > 0)
     {
         using (List <AccountBlob> .Enumerator enumerator = instance.Blob.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 AccountBlob current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 AccountBlob.Serialize(stream, current);
             }
         }
     }
 }
Ejemplo n.º 9
0
 public static AccountBlobList Deserialize(Stream stream, AccountBlobList instance, long limit)
 {
     if (instance.Blob == null)
     {
         instance.Blob = new List <AccountBlob>();
     }
     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.Blob.Add(AccountBlob.DeserializeLengthDelimited(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);
 }
Ejemplo n.º 10
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.Blob.get_Count() > 0)
            {
                using (List <AccountBlob> .Enumerator enumerator = this.Blob.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AccountBlob current = enumerator.get_Current();
                        num += 1u;
                        uint serializedSize = current.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            return(num);
        }
Ejemplo n.º 11
0
 public static AccountBlobList Deserialize(Stream stream, AccountBlobList instance, long limit)
 {
     if (instance.Blob == null)
     {
         instance.Blob = new List <AccountBlob>();
     }
     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)
             {
                 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.Blob.Add(AccountBlob.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Ejemplo n.º 12
0
        public static void Serialize(Stream stream, AccountBlob instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(21);
            binaryWriter.Write(instance.Id);
            stream.WriteByte(24);
            ProtocolParser.WriteUInt32(stream, instance.Region);
            if (instance.Email.Count > 0)
            {
                foreach (string email in instance.Email)
                {
                    stream.WriteByte(34);
                    ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(email));
                }
            }
            stream.WriteByte(40);
            ProtocolParser.WriteUInt64(stream, instance.Flags);
            if (instance.HasSecureRelease)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt64(stream, instance.SecureRelease);
            }
            if (instance.HasWhitelistStart)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistStart);
            }
            if (instance.HasWhitelistEnd)
            {
                stream.WriteByte(64);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistEnd);
            }
            if (instance.FullName == null)
            {
                throw new ArgumentNullException("FullName", "Required by proto specification.");
            }
            stream.WriteByte(82);
            ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.FullName));
            if (instance.Licenses.Count > 0)
            {
                foreach (AccountLicense license in instance.Licenses)
                {
                    stream.WriteByte(162);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, license.GetSerializedSize());
                    AccountLicense.Serialize(stream, license);
                }
            }
            if (instance.Credentials.Count > 0)
            {
                foreach (AccountCredential credential in instance.Credentials)
                {
                    stream.WriteByte(170);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, credential.GetSerializedSize());
                    AccountCredential.Serialize(stream, credential);
                }
            }
            if (instance.AccountLinks.Count > 0)
            {
                foreach (GameAccountLink accountLink in instance.AccountLinks)
                {
                    stream.WriteByte(178);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, accountLink.GetSerializedSize());
                    GameAccountLink.Serialize(stream, accountLink);
                }
            }
            if (instance.HasBattleTag)
            {
                stream.WriteByte(186);
                stream.WriteByte(1);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.BattleTag));
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(205);
                stream.WriteByte(1);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasLegalRegion)
            {
                stream.WriteByte(208);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.LegalRegion);
            }
            if (instance.HasLegalLocale)
            {
                stream.WriteByte(221);
                stream.WriteByte(1);
                binaryWriter.Write(instance.LegalLocale);
            }
            stream.WriteByte(240);
            stream.WriteByte(1);
            ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
            if (instance.HasParentalControlInfo)
            {
                stream.WriteByte(250);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
                bnet.protocol.account.ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(130);
                stream.WriteByte(2);
                ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(136);
                stream.WriteByte(2);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }
Ejemplo n.º 13
0
 public void AddBlob(AccountBlob val)
 {
     this._Blob.Add(val);
 }
Ejemplo n.º 14
0
        public static void Serialize(Stream stream, AccountBlob instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            stream.WriteByte(21);
            binaryWriter.Write(instance.Id);
            stream.WriteByte(24);
            ProtocolParser.WriteUInt32(stream, instance.Region);
            if (instance.Email.get_Count() > 0)
            {
                using (List <string> .Enumerator enumerator = instance.Email.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.get_Current();
                        stream.WriteByte(34);
                        ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(current));
                    }
                }
            }
            stream.WriteByte(40);
            ProtocolParser.WriteUInt64(stream, instance.Flags);
            if (instance.HasSecureRelease)
            {
                stream.WriteByte(48);
                ProtocolParser.WriteUInt64(stream, instance.SecureRelease);
            }
            if (instance.HasWhitelistStart)
            {
                stream.WriteByte(56);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistStart);
            }
            if (instance.HasWhitelistEnd)
            {
                stream.WriteByte(64);
                ProtocolParser.WriteUInt64(stream, instance.WhitelistEnd);
            }
            if (instance.FullName == null)
            {
                throw new ArgumentNullException("FullName", "Required by proto specification.");
            }
            stream.WriteByte(82);
            ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.FullName));
            if (instance.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator2 = instance.Licenses.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        AccountLicense current2 = enumerator2.get_Current();
                        stream.WriteByte(162);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                        AccountLicense.Serialize(stream, current2);
                    }
                }
            }
            if (instance.Credentials.get_Count() > 0)
            {
                using (List <AccountCredential> .Enumerator enumerator3 = instance.Credentials.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        AccountCredential current3 = enumerator3.get_Current();
                        stream.WriteByte(170);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                        AccountCredential.Serialize(stream, current3);
                    }
                }
            }
            if (instance.AccountLinks.get_Count() > 0)
            {
                using (List <GameAccountLink> .Enumerator enumerator4 = instance.AccountLinks.GetEnumerator())
                {
                    while (enumerator4.MoveNext())
                    {
                        GameAccountLink current4 = enumerator4.get_Current();
                        stream.WriteByte(178);
                        stream.WriteByte(1);
                        ProtocolParser.WriteUInt32(stream, current4.GetSerializedSize());
                        GameAccountLink.Serialize(stream, current4);
                    }
                }
            }
            if (instance.HasBattleTag)
            {
                stream.WriteByte(186);
                stream.WriteByte(1);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.BattleTag));
            }
            if (instance.HasDefaultCurrency)
            {
                stream.WriteByte(205);
                stream.WriteByte(1);
                binaryWriter.Write(instance.DefaultCurrency);
            }
            if (instance.HasLegalRegion)
            {
                stream.WriteByte(208);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.LegalRegion);
            }
            if (instance.HasLegalLocale)
            {
                stream.WriteByte(221);
                stream.WriteByte(1);
                binaryWriter.Write(instance.LegalLocale);
            }
            stream.WriteByte(240);
            stream.WriteByte(1);
            ProtocolParser.WriteUInt64(stream, instance.CacheExpiration);
            if (instance.HasParentalControlInfo)
            {
                stream.WriteByte(250);
                stream.WriteByte(1);
                ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
                ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
            }
            if (instance.HasCountry)
            {
                stream.WriteByte(130);
                stream.WriteByte(2);
                ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Country));
            }
            if (instance.HasPreferredRegion)
            {
                stream.WriteByte(136);
                stream.WriteByte(2);
                ProtocolParser.WriteUInt32(stream, instance.PreferredRegion);
            }
        }
Ejemplo n.º 15
0
        public static AccountBlob Deserialize(Stream stream, AccountBlob instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Email == null)
            {
                instance.Email = new List <string>();
            }
            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            if (instance.Credentials == null)
            {
                instance.Credentials = new List <AccountCredential>();
            }
            if (instance.AccountLinks == null)
            {
                instance.AccountLinks = new List <GameAccountLink>();
            }
            while (true)
            {
                if (limit < (long)0 || stream.Position < limit)
                {
                    int num = stream.ReadByte();
                    if (num != -1)
                    {
                        switch (num)
                        {
                        case 21:
                        {
                            instance.Id = binaryReader.ReadUInt32();
                            continue;
                        }

                        case 24:
                        {
                            instance.Region = ProtocolParser.ReadUInt32(stream);
                            continue;
                        }

                        default:
                        {
                            if (num == 34)
                            {
                                instance.Email.Add(ProtocolParser.ReadString(stream));
                                continue;
                            }
                            else if (num == 40)
                            {
                                instance.Flags = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 48)
                            {
                                instance.SecureRelease = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 56)
                            {
                                instance.WhitelistStart = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 64)
                            {
                                instance.WhitelistEnd = ProtocolParser.ReadUInt64(stream);
                                continue;
                            }
                            else if (num == 82)
                            {
                                instance.FullName = ProtocolParser.ReadString(stream);
                                continue;
                            }
                            else
                            {
                                Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                                uint field = key.Field;
                                switch (field)
                                {
                                case 20:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 21:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Credentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 22:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.AccountLinks.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 23:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.BattleTag = ProtocolParser.ReadString(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 25:
                                {
                                    if (key.WireType == Wire.Fixed32)
                                    {
                                        instance.DefaultCurrency = binaryReader.ReadUInt32();
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 26:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.LegalRegion = ProtocolParser.ReadUInt32(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 27:
                                {
                                    if (key.WireType == Wire.Fixed32)
                                    {
                                        instance.LegalLocale = binaryReader.ReadUInt32();
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 30:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.CacheExpiration = ProtocolParser.ReadUInt64(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 31:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        if (instance.ParentalControlInfo != null)
                                        {
                                            bnet.protocol.account.ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                        }
                                        else
                                        {
                                            instance.ParentalControlInfo = bnet.protocol.account.ParentalControlInfo.DeserializeLengthDelimited(stream);
                                        }
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 32:
                                {
                                    if (key.WireType == Wire.LengthDelimited)
                                    {
                                        instance.Country = ProtocolParser.ReadString(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                case 33:
                                {
                                    if (key.WireType == Wire.Varint)
                                    {
                                        instance.PreferredRegion = ProtocolParser.ReadUInt32(stream);
                                        continue;
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }

                                default:
                                {
                                    if (field == 0)
                                    {
                                        throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                                    }
                                    ProtocolParser.SkipKey(stream, key);
                                    break;
                                }
                                }
                                continue;
                            }
                        }
                        }
                    }
                    else
                    {
                        if (limit >= (long)0)
                        {
                            throw new EndOfStreamException();
                        }
                        break;
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
Ejemplo n.º 16
0
 public static AccountBlob Deserialize(Stream stream, AccountBlob instance)
 {
     return(AccountBlob.Deserialize(stream, instance, (long)-1));
 }
Ejemplo n.º 17
0
 public void SetBlob(AccountBlob val)
 {
     this.Blob = val;
 }
Ejemplo n.º 18
0
        public override bool Equals(object obj)
        {
            AccountBlob accountBlob = obj as AccountBlob;

            if (accountBlob == null)
            {
                return(false);
            }
            if (!this.Id.Equals(accountBlob.Id))
            {
                return(false);
            }
            if (!this.Region.Equals(accountBlob.Region))
            {
                return(false);
            }
            if (this.Email.Count != accountBlob.Email.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Email.Count; i++)
            {
                if (!this.Email[i].Equals(accountBlob.Email[i]))
                {
                    return(false);
                }
            }
            if (!this.Flags.Equals(accountBlob.Flags))
            {
                return(false);
            }
            if (this.HasSecureRelease != accountBlob.HasSecureRelease || this.HasSecureRelease && !this.SecureRelease.Equals(accountBlob.SecureRelease))
            {
                return(false);
            }
            if (this.HasWhitelistStart != accountBlob.HasWhitelistStart || this.HasWhitelistStart && !this.WhitelistStart.Equals(accountBlob.WhitelistStart))
            {
                return(false);
            }
            if (this.HasWhitelistEnd != accountBlob.HasWhitelistEnd || this.HasWhitelistEnd && !this.WhitelistEnd.Equals(accountBlob.WhitelistEnd))
            {
                return(false);
            }
            if (!this.FullName.Equals(accountBlob.FullName))
            {
                return(false);
            }
            if (this.Licenses.Count != accountBlob.Licenses.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.Licenses.Count; j++)
            {
                if (!this.Licenses[j].Equals(accountBlob.Licenses[j]))
                {
                    return(false);
                }
            }
            if (this.Credentials.Count != accountBlob.Credentials.Count)
            {
                return(false);
            }
            for (int k = 0; k < this.Credentials.Count; k++)
            {
                if (!this.Credentials[k].Equals(accountBlob.Credentials[k]))
                {
                    return(false);
                }
            }
            if (this.AccountLinks.Count != accountBlob.AccountLinks.Count)
            {
                return(false);
            }
            for (int l = 0; l < this.AccountLinks.Count; l++)
            {
                if (!this.AccountLinks[l].Equals(accountBlob.AccountLinks[l]))
                {
                    return(false);
                }
            }
            if (this.HasBattleTag != accountBlob.HasBattleTag || this.HasBattleTag && !this.BattleTag.Equals(accountBlob.BattleTag))
            {
                return(false);
            }
            if (this.HasDefaultCurrency != accountBlob.HasDefaultCurrency || this.HasDefaultCurrency && !this.DefaultCurrency.Equals(accountBlob.DefaultCurrency))
            {
                return(false);
            }
            if (this.HasLegalRegion != accountBlob.HasLegalRegion || this.HasLegalRegion && !this.LegalRegion.Equals(accountBlob.LegalRegion))
            {
                return(false);
            }
            if (this.HasLegalLocale != accountBlob.HasLegalLocale || this.HasLegalLocale && !this.LegalLocale.Equals(accountBlob.LegalLocale))
            {
                return(false);
            }
            if (!this.CacheExpiration.Equals(accountBlob.CacheExpiration))
            {
                return(false);
            }
            if (this.HasParentalControlInfo != accountBlob.HasParentalControlInfo || this.HasParentalControlInfo && !this.ParentalControlInfo.Equals(accountBlob.ParentalControlInfo))
            {
                return(false);
            }
            if (this.HasCountry != accountBlob.HasCountry || this.HasCountry && !this.Country.Equals(accountBlob.Country))
            {
                return(false);
            }
            if (this.HasPreferredRegion == accountBlob.HasPreferredRegion && (!this.HasPreferredRegion || this.PreferredRegion.Equals(accountBlob.PreferredRegion)))
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 19
0
 public static GetAccountResponse Deserialize(Stream stream, GetAccountResponse instance, long limit)
 {
     if (instance.Email == null)
     {
         instance.Email = new List <string>();
     }
     if (instance.Links == null)
     {
         instance.Links = new List <GameAccountLink>();
     }
     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 != 90)
             {
                 if (num2 != 98)
                 {
                     if (num2 != 106)
                     {
                         if (num2 != 114)
                         {
                             if (num2 != 122)
                             {
                                 Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                                 uint field = key.Field;
                                 if (field != 16u)
                                 {
                                     if (field != 17u)
                                     {
                                         if (field == 0u)
                                         {
                                             throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                                         }
                                         ProtocolParser.SkipKey(stream, key);
                                     }
                                     else if (key.WireType == Wire.LengthDelimited)
                                     {
                                         if (instance.ParentalControlInfo == null)
                                         {
                                             instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                                         }
                                         else
                                         {
                                             ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                         }
                                     }
                                 }
                                 else if (key.WireType == Wire.LengthDelimited)
                                 {
                                     instance.Links.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                 }
                             }
                             else
                             {
                                 instance.FullName = ProtocolParser.ReadString(stream);
                             }
                         }
                         else
                         {
                             instance.BattleTag = ProtocolParser.ReadString(stream);
                         }
                     }
                     else
                     {
                         instance.Email.Add(ProtocolParser.ReadString(stream));
                     }
                 }
                 else if (instance.Id == null)
                 {
                     instance.Id = AccountId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     AccountId.DeserializeLengthDelimited(stream, instance.Id);
                 }
             }
             else if (instance.Blob == null)
             {
                 instance.Blob = AccountBlob.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AccountBlob.DeserializeLengthDelimited(stream, instance.Blob);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Ejemplo n.º 20
0
 public void Serialize(Stream stream)
 {
     AccountBlob.Serialize(stream, this);
 }
Ejemplo n.º 21
0
        public static AccountBlob Deserialize(Stream stream, AccountBlob instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            if (instance.Email == null)
            {
                instance.Email = new List <string>();
            }
            if (instance.Licenses == null)
            {
                instance.Licenses = new List <AccountLicense>();
            }
            if (instance.Credentials == null)
            {
                instance.Credentials = new List <AccountCredential>();
            }
            if (instance.AccountLinks == null)
            {
                instance.AccountLinks = new List <GameAccountLink>();
            }
            while (limit < 0L || stream.get_Position() < limit)
            {
                int num = stream.ReadByte();
                if (num != -1)
                {
                    int num2 = num;
                    switch (num2)
                    {
                    case 21:
                        instance.Id = binaryReader.ReadUInt32();
                        continue;

                    case 22:
                    case 23:
IL_CB:
                        if (num2 == 34)
                        {
                            instance.Email.Add(ProtocolParser.ReadString(stream));
                            continue;
                        }
                        if (num2 == 40)
                        {
                            instance.Flags = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 48)
                        {
                            instance.SecureRelease = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 56)
                        {
                            instance.WhitelistStart = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 == 64)
                        {
                            instance.WhitelistEnd = ProtocolParser.ReadUInt64(stream);
                            continue;
                        }
                        if (num2 != 82)
                        {
                            Key  key   = ProtocolParser.ReadKey((byte)num, stream);
                            uint field = key.Field;
                            switch (field)
                            {
                            case 20u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Licenses.Add(AccountLicense.DeserializeLengthDelimited(stream));
                                continue;

                            case 21u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Credentials.Add(AccountCredential.DeserializeLengthDelimited(stream));
                                continue;

                            case 22u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.AccountLinks.Add(GameAccountLink.DeserializeLengthDelimited(stream));
                                continue;

                            case 23u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.BattleTag = ProtocolParser.ReadString(stream);
                                continue;

                            case 24u:
                            case 28u:
                            case 29u:
IL_1E0:
                                if (field != 0u)
                                {
                                    ProtocolParser.SkipKey(stream, key);
                                    continue;
                                }
                                throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");

                            case 25u:
                                if (key.WireType != Wire.Fixed32)
                                {
                                    continue;
                                }
                                instance.DefaultCurrency = binaryReader.ReadUInt32();
                                continue;

                            case 26u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.LegalRegion = ProtocolParser.ReadUInt32(stream);
                                continue;

                            case 27u:
                                if (key.WireType != Wire.Fixed32)
                                {
                                    continue;
                                }
                                instance.LegalLocale = binaryReader.ReadUInt32();
                                continue;

                            case 30u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.CacheExpiration = ProtocolParser.ReadUInt64(stream);
                                continue;

                            case 31u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                if (instance.ParentalControlInfo == null)
                                {
                                    instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                                }
                                else
                                {
                                    ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                                }
                                continue;

                            case 32u:
                                if (key.WireType != Wire.LengthDelimited)
                                {
                                    continue;
                                }
                                instance.Country = ProtocolParser.ReadString(stream);
                                continue;

                            case 33u:
                                if (key.WireType != Wire.Varint)
                                {
                                    continue;
                                }
                                instance.PreferredRegion = ProtocolParser.ReadUInt32(stream);
                                continue;
                            }
                            goto IL_1E0;
                            continue;
                        }
                        instance.FullName = ProtocolParser.ReadString(stream);
                        continue;

                    case 24:
                        instance.Region = ProtocolParser.ReadUInt32(stream);
                        continue;
                    }
                    goto IL_CB;
                }
                if (limit >= 0L)
                {
                    throw new EndOfStreamException();
                }
                return(instance);
            }
            if (stream.get_Position() == limit)
            {
                return(instance);
            }
            throw new ProtocolBufferException("Read past max limit");
        }