public static void Serialize(Stream stream, AccountState instance)
 {
     if (instance.HasAccountLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AccountLevelInfo.GetSerializedSize());
         AccountLevelInfo.Serialize(stream, instance.AccountLevelInfo);
     }
     if (instance.HasPrivacyInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.PrivacyInfo.GetSerializedSize());
         PrivacyInfo.Serialize(stream, instance.PrivacyInfo);
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
     if (instance.GameLevelInfo.get_Count() > 0)
     {
         using (List <GameLevelInfo> .Enumerator enumerator = instance.GameLevelInfo.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 GameLevelInfo current = enumerator.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.account.GameLevelInfo.Serialize(stream, current);
             }
         }
     }
     if (instance.GameStatus.get_Count() > 0)
     {
         using (List <GameStatus> .Enumerator enumerator2 = instance.GameStatus.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 GameStatus current2 = enumerator2.get_Current();
                 stream.WriteByte(50);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 bnet.protocol.account.GameStatus.Serialize(stream, current2);
             }
         }
     }
     if (instance.GameAccounts.get_Count() > 0)
     {
         using (List <GameAccountList> .Enumerator enumerator3 = instance.GameAccounts.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 GameAccountList current3 = enumerator3.get_Current();
                 stream.WriteByte(58);
                 ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                 GameAccountList.Serialize(stream, current3);
             }
         }
     }
 }
예제 #2
0
        public static ParentalControlInfo DeserializeLengthDelimited(Stream stream)
        {
            ParentalControlInfo parentalControlInfo = new ParentalControlInfo();

            ParentalControlInfo.DeserializeLengthDelimited(stream, parentalControlInfo);
            return(parentalControlInfo);
        }
예제 #3
0
        public static ParentalControlInfo DeserializeLengthDelimited(Stream stream, ParentalControlInfo instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(ParentalControlInfo.Deserialize(stream, instance, position));
        }
예제 #4
0
        public static ParentalControlInfo DeserializeLengthDelimited(Stream stream, ParentalControlInfo instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(ParentalControlInfo.Deserialize(stream, instance, num));
        }
예제 #5
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);
     }
 }
예제 #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);
     }
 }
예제 #7
0
 public static void Serialize(Stream stream, AccountState instance)
 {
     if (instance.HasAccountLevelInfo)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AccountLevelInfo.GetSerializedSize());
         AccountLevelInfo.Serialize(stream, instance.AccountLevelInfo);
     }
     if (instance.HasPrivacyInfo)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.PrivacyInfo.GetSerializedSize());
         PrivacyInfo.Serialize(stream, instance.PrivacyInfo);
     }
     if (instance.HasParentalControlInfo)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteUInt32(stream, instance.ParentalControlInfo.GetSerializedSize());
         ParentalControlInfo.Serialize(stream, instance.ParentalControlInfo);
     }
     if (instance.GameLevelInfo.Count > 0)
     {
         foreach (GameLevelInfo gameLevelInfo in instance.GameLevelInfo)
         {
             stream.WriteByte(42);
             ProtocolParser.WriteUInt32(stream, gameLevelInfo.GetSerializedSize());
             bnet.protocol.account.GameLevelInfo.Serialize(stream, gameLevelInfo);
         }
     }
     if (instance.GameStatus.Count > 0)
     {
         foreach (GameStatus gameStatus in instance.GameStatus)
         {
             stream.WriteByte(50);
             ProtocolParser.WriteUInt32(stream, gameStatus.GetSerializedSize());
             bnet.protocol.account.GameStatus.Serialize(stream, gameStatus);
         }
     }
     if (instance.GameAccounts.Count > 0)
     {
         foreach (GameAccountList gameAccountList in instance.GameAccounts)
         {
             stream.WriteByte(58);
             ProtocolParser.WriteUInt32(stream, gameAccountList.GetSerializedSize());
             GameAccountList.Serialize(stream, gameAccountList);
         }
     }
 }
예제 #8
0
        public override bool Equals(object obj)
        {
            ParentalControlInfo parentalControlInfo = obj as ParentalControlInfo;

            if (parentalControlInfo == null)
            {
                return(false);
            }
            if (this.HasTimezone != parentalControlInfo.HasTimezone || this.HasTimezone && !this.Timezone.Equals(parentalControlInfo.Timezone))
            {
                return(false);
            }
            if (this.HasMinutesPerDay != parentalControlInfo.HasMinutesPerDay || this.HasMinutesPerDay && !this.MinutesPerDay.Equals(parentalControlInfo.MinutesPerDay))
            {
                return(false);
            }
            if (this.HasMinutesPerWeek != parentalControlInfo.HasMinutesPerWeek || this.HasMinutesPerWeek && !this.MinutesPerWeek.Equals(parentalControlInfo.MinutesPerWeek))
            {
                return(false);
            }
            if (this.HasCanReceiveVoice != parentalControlInfo.HasCanReceiveVoice || this.HasCanReceiveVoice && !this.CanReceiveVoice.Equals(parentalControlInfo.CanReceiveVoice))
            {
                return(false);
            }
            if (this.HasCanSendVoice != parentalControlInfo.HasCanSendVoice || this.HasCanSendVoice && !this.CanSendVoice.Equals(parentalControlInfo.CanSendVoice))
            {
                return(false);
            }
            if (this.PlaySchedule.Count != parentalControlInfo.PlaySchedule.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.PlaySchedule.Count; i++)
            {
                if (!this.PlaySchedule[i].Equals(parentalControlInfo.PlaySchedule[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #9
0
 public static void Serialize(Stream stream, ParentalControlInfo instance)
 {
     if (instance.HasTimezone)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.Timezone));
     }
     if (instance.HasMinutesPerDay)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.MinutesPerDay);
     }
     if (instance.HasMinutesPerWeek)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt32(stream, instance.MinutesPerWeek);
     }
     if (instance.HasCanReceiveVoice)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.CanReceiveVoice);
     }
     if (instance.HasCanSendVoice)
     {
         stream.WriteByte(56);
         ProtocolParser.WriteBool(stream, instance.CanSendVoice);
     }
     if (instance.PlaySchedule.get_Count() > 0)
     {
         using (List <bool> .Enumerator enumerator = instance.PlaySchedule.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 bool current = enumerator.get_Current();
                 stream.WriteByte(64);
                 ProtocolParser.WriteBool(stream, current);
             }
         }
     }
 }
예제 #10
0
 public static void Serialize(Stream stream, ParentalControlInfo instance)
 {
     if (instance.HasTimezone)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Timezone));
     }
     if (instance.HasMinutesPerDay)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteUInt32(stream, instance.MinutesPerDay);
     }
     if (instance.HasMinutesPerWeek)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteUInt32(stream, instance.MinutesPerWeek);
     }
     if (instance.HasCanReceiveVoice)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteBool(stream, instance.CanReceiveVoice);
     }
     if (instance.HasCanSendVoice)
     {
         stream.WriteByte(56);
         ProtocolParser.WriteBool(stream, instance.CanSendVoice);
     }
     if (instance.PlaySchedule.Count > 0)
     {
         foreach (bool playSchedule in instance.PlaySchedule)
         {
             stream.WriteByte(64);
             ProtocolParser.WriteBool(stream, playSchedule);
         }
     }
 }
예제 #11
0
 public static ParentalControlInfo Deserialize(Stream stream, ParentalControlInfo instance, long limit)
 {
     if (instance.PlaySchedule == null)
     {
         instance.PlaySchedule = new List <bool>();
     }
     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 == 26)
             {
                 instance.Timezone = ProtocolParser.ReadString(stream);
             }
             else if (num == 32)
             {
                 instance.MinutesPerDay = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 40)
             {
                 instance.MinutesPerWeek = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 48)
             {
                 instance.CanReceiveVoice = ProtocolParser.ReadBool(stream);
             }
             else if (num == 56)
             {
                 instance.CanSendVoice = ProtocolParser.ReadBool(stream);
             }
             else if (num == 64)
             {
                 instance.PlaySchedule.Add(ProtocolParser.ReadBool(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);
 }
 public static AccountState Deserialize(Stream stream, AccountState instance, long limit)
 {
     if (instance.GameLevelInfo == null)
     {
         instance.GameLevelInfo = new List <GameLevelInfo>();
     }
     if (instance.GameStatus == null)
     {
         instance.GameStatus = new List <GameStatus>();
     }
     if (instance.GameAccounts == null)
     {
         instance.GameAccounts = new List <GameAccountList>();
     }
     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)
                 {
                     if (num2 != 26)
                     {
                         if (num2 != 42)
                         {
                             if (num2 != 50)
                             {
                                 if (num2 != 58)
                                 {
                                     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.GameAccounts.Add(GameAccountList.DeserializeLengthDelimited(stream));
                                 }
                             }
                             else
                             {
                                 instance.GameStatus.Add(bnet.protocol.account.GameStatus.DeserializeLengthDelimited(stream));
                             }
                         }
                         else
                         {
                             instance.GameLevelInfo.Add(bnet.protocol.account.GameLevelInfo.DeserializeLengthDelimited(stream));
                         }
                     }
                     else if (instance.ParentalControlInfo == null)
                     {
                         instance.ParentalControlInfo = ParentalControlInfo.DeserializeLengthDelimited(stream);
                     }
                     else
                     {
                         ParentalControlInfo.DeserializeLengthDelimited(stream, instance.ParentalControlInfo);
                     }
                 }
                 else if (instance.PrivacyInfo == null)
                 {
                     instance.PrivacyInfo = PrivacyInfo.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     PrivacyInfo.DeserializeLengthDelimited(stream, instance.PrivacyInfo);
                 }
             }
             else if (instance.AccountLevelInfo == null)
             {
                 instance.AccountLevelInfo = AccountLevelInfo.DeserializeLengthDelimited(stream);
             }
             else
             {
                 AccountLevelInfo.DeserializeLengthDelimited(stream, instance.AccountLevelInfo);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
예제 #13
0
 public static ParentalControlInfo Deserialize(Stream stream, ParentalControlInfo instance)
 {
     return(ParentalControlInfo.Deserialize(stream, instance, (long)-1));
 }
예제 #14
0
 public void SetParentalControlInfo(ParentalControlInfo val)
 {
     this.ParentalControlInfo = val;
 }
예제 #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 (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");
        }
예제 #16
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);
            }
        }
예제 #17
0
 public void Serialize(Stream stream)
 {
     ParentalControlInfo.Serialize(stream, this);
 }
예제 #18
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");
 }
예제 #19
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 s in instance.Email)
                {
                    stream.WriteByte(34);
                    ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(s));
                }
            }
            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 accountLicense in instance.Licenses)
                {
                    stream.WriteByte(162);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, accountLicense.GetSerializedSize());
                    AccountLicense.Serialize(stream, accountLicense);
                }
            }
            if (instance.Credentials.Count > 0)
            {
                foreach (AccountCredential accountCredential in instance.Credentials)
                {
                    stream.WriteByte(170);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, accountCredential.GetSerializedSize());
                    AccountCredential.Serialize(stream, accountCredential);
                }
            }
            if (instance.AccountLinks.Count > 0)
            {
                foreach (GameAccountLink gameAccountLink in instance.AccountLinks)
                {
                    stream.WriteByte(178);
                    stream.WriteByte(1);
                    ProtocolParser.WriteUInt32(stream, gameAccountLink.GetSerializedSize());
                    GameAccountLink.Serialize(stream, gameAccountLink);
                }
            }
            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());
                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);
            }
        }