public static GameAccountLink DeserializeLengthDelimited(Stream stream)
        {
            GameAccountLink gameAccountLink = new GameAccountLink();

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

            position += stream.Position;
            return(GameAccountLink.Deserialize(stream, instance, position));
        }
        public static GameAccountLink DeserializeLengthDelimited(Stream stream, GameAccountLink instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(GameAccountLink.Deserialize(stream, instance, num));
        }
Exemple #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);
     }
 }
 public static GameAccountLink Deserialize(Stream stream, GameAccountLink 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)
             {
                 if (num == 18)
                 {
                     instance.Name = 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 (instance.GameAccount != null)
             {
                 GameAccountHandle.DeserializeLengthDelimited(stream, instance.GameAccount);
             }
             else
             {
                 instance.GameAccount = GameAccountHandle.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Exemple #6
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);
     }
 }
 public static GameAccountLink Deserialize(Stream stream, GameAccountLink 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 != 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
                 {
                     instance.Name = ProtocolParser.ReadString(stream);
                 }
             }
             else if (instance.GameAccount == null)
             {
                 instance.GameAccount = GameAccountHandle.DeserializeLengthDelimited(stream);
             }
             else
             {
                 GameAccountHandle.DeserializeLengthDelimited(stream, instance.GameAccount);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, GameAccountLink instance)
 {
     if (instance.GameAccount == null)
     {
         throw new ArgumentNullException("GameAccount", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.GameAccount.GetSerializedSize());
     GameAccountHandle.Serialize(stream, instance.GameAccount);
     if (instance.Name == null)
     {
         throw new ArgumentNullException("Name", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Name));
 }
        public override bool Equals(object obj)
        {
            GameAccountLink gameAccountLink = obj as GameAccountLink;

            if (gameAccountLink == null)
            {
                return(false);
            }
            if (!this.GameAccount.Equals(gameAccountLink.GameAccount))
            {
                return(false);
            }
            if (!this.Name.Equals(gameAccountLink.Name))
            {
                return(false);
            }
            return(true);
        }
Exemple #10
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            if (this.HasBlob)
            {
                num ^= this.Blob.GetHashCode();
            }
            if (this.HasId)
            {
                num ^= this.Id.GetHashCode();
            }
            using (List <string> .Enumerator enumerator = this.Email.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            if (this.HasBattleTag)
            {
                num ^= this.BattleTag.GetHashCode();
            }
            if (this.HasFullName)
            {
                num ^= this.FullName.GetHashCode();
            }
            using (List <GameAccountLink> .Enumerator enumerator2 = this.Links.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    GameAccountLink current2 = enumerator2.get_Current();
                    num ^= current2.GetHashCode();
                }
            }
            if (this.HasParentalControlInfo)
            {
                num ^= this.ParentalControlInfo.GetHashCode();
            }
            return(num);
        }
Exemple #11
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");
 }
Exemple #12
0
        public override int GetHashCode()
        {
            int num = base.GetType().GetHashCode();

            num ^= this.Id.GetHashCode();
            num ^= this.Region.GetHashCode();
            using (List <string> .Enumerator enumerator = this.Email.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string current = enumerator.get_Current();
                    num ^= current.GetHashCode();
                }
            }
            num ^= this.Flags.GetHashCode();
            if (this.HasSecureRelease)
            {
                num ^= this.SecureRelease.GetHashCode();
            }
            if (this.HasWhitelistStart)
            {
                num ^= this.WhitelistStart.GetHashCode();
            }
            if (this.HasWhitelistEnd)
            {
                num ^= this.WhitelistEnd.GetHashCode();
            }
            num ^= this.FullName.GetHashCode();
            using (List <AccountLicense> .Enumerator enumerator2 = this.Licenses.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    AccountLicense current2 = enumerator2.get_Current();
                    num ^= current2.GetHashCode();
                }
            }
            using (List <AccountCredential> .Enumerator enumerator3 = this.Credentials.GetEnumerator())
            {
                while (enumerator3.MoveNext())
                {
                    AccountCredential current3 = enumerator3.get_Current();
                    num ^= current3.GetHashCode();
                }
            }
            using (List <GameAccountLink> .Enumerator enumerator4 = this.AccountLinks.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    GameAccountLink current4 = enumerator4.get_Current();
                    num ^= current4.GetHashCode();
                }
            }
            if (this.HasBattleTag)
            {
                num ^= this.BattleTag.GetHashCode();
            }
            if (this.HasDefaultCurrency)
            {
                num ^= this.DefaultCurrency.GetHashCode();
            }
            if (this.HasLegalRegion)
            {
                num ^= this.LegalRegion.GetHashCode();
            }
            if (this.HasLegalLocale)
            {
                num ^= this.LegalLocale.GetHashCode();
            }
            num ^= this.CacheExpiration.GetHashCode();
            if (this.HasParentalControlInfo)
            {
                num ^= this.ParentalControlInfo.GetHashCode();
            }
            if (this.HasCountry)
            {
                num ^= this.Country.GetHashCode();
            }
            if (this.HasPreferredRegion)
            {
                num ^= this.PreferredRegion.GetHashCode();
            }
            return(num);
        }
Exemple #13
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            num += 4u;
            num += ProtocolParser.SizeOfUInt32(this.Region);
            if (this.Email.get_Count() > 0)
            {
                using (List <string> .Enumerator enumerator = this.Email.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.get_Current();
                        num += 1u;
                        uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(current);
                        num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount;
                    }
                }
            }
            num += ProtocolParser.SizeOfUInt64(this.Flags);
            if (this.HasSecureRelease)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.SecureRelease);
            }
            if (this.HasWhitelistStart)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.WhitelistStart);
            }
            if (this.HasWhitelistEnd)
            {
                num += 1u;
                num += ProtocolParser.SizeOfUInt64(this.WhitelistEnd);
            }
            uint byteCount2 = (uint)Encoding.get_UTF8().GetByteCount(this.FullName);

            num += ProtocolParser.SizeOfUInt32(byteCount2) + byteCount2;
            if (this.Licenses.get_Count() > 0)
            {
                using (List <AccountLicense> .Enumerator enumerator2 = this.Licenses.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        AccountLicense current2 = enumerator2.get_Current();
                        num += 2u;
                        uint serializedSize = current2.GetSerializedSize();
                        num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
                    }
                }
            }
            if (this.Credentials.get_Count() > 0)
            {
                using (List <AccountCredential> .Enumerator enumerator3 = this.Credentials.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        AccountCredential current3 = enumerator3.get_Current();
                        num += 2u;
                        uint serializedSize2 = current3.GetSerializedSize();
                        num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
                    }
                }
            }
            if (this.AccountLinks.get_Count() > 0)
            {
                using (List <GameAccountLink> .Enumerator enumerator4 = this.AccountLinks.GetEnumerator())
                {
                    while (enumerator4.MoveNext())
                    {
                        GameAccountLink current4 = enumerator4.get_Current();
                        num += 2u;
                        uint serializedSize3 = current4.GetSerializedSize();
                        num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3);
                    }
                }
            }
            if (this.HasBattleTag)
            {
                num += 2u;
                uint byteCount3 = (uint)Encoding.get_UTF8().GetByteCount(this.BattleTag);
                num += ProtocolParser.SizeOfUInt32(byteCount3) + byteCount3;
            }
            if (this.HasDefaultCurrency)
            {
                num += 2u;
                num += 4u;
            }
            if (this.HasLegalRegion)
            {
                num += 2u;
                num += ProtocolParser.SizeOfUInt32(this.LegalRegion);
            }
            if (this.HasLegalLocale)
            {
                num += 2u;
                num += 4u;
            }
            num += ProtocolParser.SizeOfUInt64(this.CacheExpiration);
            if (this.HasParentalControlInfo)
            {
                num += 2u;
                uint serializedSize4 = this.ParentalControlInfo.GetSerializedSize();
                num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4);
            }
            if (this.HasCountry)
            {
                num += 2u;
                uint byteCount4 = (uint)Encoding.get_UTF8().GetByteCount(this.Country);
                num += ProtocolParser.SizeOfUInt32(byteCount4) + byteCount4;
            }
            if (this.HasPreferredRegion)
            {
                num += 2u;
                num += ProtocolParser.SizeOfUInt32(this.PreferredRegion);
            }
            num += 6u;
            return(num);
        }
Exemple #14
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);
        }
Exemple #15
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);
            }
        }
 public static GameAccountLink Deserialize(Stream stream, GameAccountLink instance)
 {
     return(GameAccountLink.Deserialize(stream, instance, -1L));
 }
Exemple #17
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);
            }
        }
Exemple #18
0
 public void AddLinks(GameAccountLink val)
 {
     this._Links.Add(val);
 }
Exemple #19
0
        public uint GetSerializedSize()
        {
            uint num = 0u;

            if (this.HasBlob)
            {
                num += 1u;
                uint serializedSize = this.Blob.GetSerializedSize();
                num += serializedSize + ProtocolParser.SizeOfUInt32(serializedSize);
            }
            if (this.HasId)
            {
                num += 1u;
                uint serializedSize2 = this.Id.GetSerializedSize();
                num += serializedSize2 + ProtocolParser.SizeOfUInt32(serializedSize2);
            }
            if (this.Email.get_Count() > 0)
            {
                using (List <string> .Enumerator enumerator = this.Email.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string current = enumerator.get_Current();
                        num += 1u;
                        uint byteCount = (uint)Encoding.get_UTF8().GetByteCount(current);
                        num += ProtocolParser.SizeOfUInt32(byteCount) + byteCount;
                    }
                }
            }
            if (this.HasBattleTag)
            {
                num += 1u;
                uint byteCount2 = (uint)Encoding.get_UTF8().GetByteCount(this.BattleTag);
                num += ProtocolParser.SizeOfUInt32(byteCount2) + byteCount2;
            }
            if (this.HasFullName)
            {
                num += 1u;
                uint byteCount3 = (uint)Encoding.get_UTF8().GetByteCount(this.FullName);
                num += ProtocolParser.SizeOfUInt32(byteCount3) + byteCount3;
            }
            if (this.Links.get_Count() > 0)
            {
                using (List <GameAccountLink> .Enumerator enumerator2 = this.Links.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        GameAccountLink current2 = enumerator2.get_Current();
                        num += 2u;
                        uint serializedSize3 = current2.GetSerializedSize();
                        num += serializedSize3 + ProtocolParser.SizeOfUInt32(serializedSize3);
                    }
                }
            }
            if (this.HasParentalControlInfo)
            {
                num += 2u;
                uint serializedSize4 = this.ParentalControlInfo.GetSerializedSize();
                num += serializedSize4 + ProtocolParser.SizeOfUInt32(serializedSize4);
            }
            return(num);
        }
        public override bool Equals(object obj)
        {
            GameAccountLink gameAccountLink = obj as GameAccountLink;

            return(gameAccountLink != null && this.GameAccount.Equals(gameAccountLink.GameAccount) && this.Name.Equals(gameAccountLink.Name));
        }
 public void Deserialize(Stream stream)
 {
     GameAccountLink.Deserialize(stream, this);
 }
Exemple #22
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");
        }