public static PrivacyInfo DeserializeLengthDelimited(Stream stream, PrivacyInfo instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(PrivacyInfo.Deserialize(stream, instance, num));
        }
Exemple #2
0
 public static PrivacyInfo Deserialize(Stream stream, PrivacyInfo instance, long limit)
 {
     instance.GameInfoPrivacy = PrivacyInfo.Types.GameInfoPrivacy.PRIVACY_FRIENDS;
     while (limit < 0L || stream.get_Position() < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else
         {
             int num2 = num;
             if (num2 != 24)
             {
                 if (num2 != 32)
                 {
                     if (num2 != 40)
                     {
                         if (num2 != 48)
                         {
                             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.GameInfoPrivacy = (PrivacyInfo.Types.GameInfoPrivacy)ProtocolParser.ReadUInt64(stream);
                         }
                     }
                     else
                     {
                         instance.IsHiddenFromFriendFinder = ProtocolParser.ReadBool(stream);
                     }
                 }
                 else
                 {
                     instance.IsRealIdVisibleForViewFriends = ProtocolParser.ReadBool(stream);
                 }
             }
             else
             {
                 instance.IsUsingRid = ProtocolParser.ReadBool(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
        public static PrivacyInfo DeserializeLengthDelimited(Stream stream)
        {
            PrivacyInfo privacyInfo = new PrivacyInfo();

            PrivacyInfo.DeserializeLengthDelimited(stream, privacyInfo);
            return(privacyInfo);
        }
        public override bool Equals(object obj)
        {
            PrivacyInfo privacyInfo = obj as PrivacyInfo;

            if (privacyInfo == null)
            {
                return(false);
            }
            if (this.HasIsUsingRid != privacyInfo.HasIsUsingRid || this.HasIsUsingRid && !this.IsUsingRid.Equals(privacyInfo.IsUsingRid))
            {
                return(false);
            }
            if (this.HasIsRealIdVisibleForViewFriends != privacyInfo.HasIsRealIdVisibleForViewFriends || this.HasIsRealIdVisibleForViewFriends && !this.IsRealIdVisibleForViewFriends.Equals(privacyInfo.IsRealIdVisibleForViewFriends))
            {
                return(false);
            }
            if (this.HasIsHiddenFromFriendFinder != privacyInfo.HasIsHiddenFromFriendFinder || this.HasIsHiddenFromFriendFinder && !this.IsHiddenFromFriendFinder.Equals(privacyInfo.IsHiddenFromFriendFinder))
            {
                return(false);
            }
            if (this.HasGameInfoPrivacy == privacyInfo.HasGameInfoPrivacy && (!this.HasGameInfoPrivacy || this.GameInfoPrivacy.Equals(privacyInfo.GameInfoPrivacy)))
            {
                return(true);
            }
            return(false);
        }
 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);
             }
         }
     }
 }
Exemple #6
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);
         }
     }
 }
 public static void Serialize(Stream stream, PrivacyInfo instance)
 {
     if (instance.HasIsUsingRid)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteBool(stream, instance.IsUsingRid);
     }
     if (instance.HasIsRealIdVisibleForViewFriends)
     {
         stream.WriteByte(32);
         ProtocolParser.WriteBool(stream, instance.IsRealIdVisibleForViewFriends);
     }
     if (instance.HasIsHiddenFromFriendFinder)
     {
         stream.WriteByte(40);
         ProtocolParser.WriteBool(stream, instance.IsHiddenFromFriendFinder);
     }
     if (instance.HasGameInfoPrivacy)
     {
         stream.WriteByte(48);
         ProtocolParser.WriteUInt64(stream, (ulong)((long)instance.GameInfoPrivacy));
     }
 }
 public void Serialize(Stream stream)
 {
     PrivacyInfo.Serialize(stream, this);
 }
 public static PrivacyInfo Deserialize(Stream stream, PrivacyInfo instance)
 {
     return(PrivacyInfo.Deserialize(stream, instance, -1L));
 }
        public override bool Equals(object obj)
        {
            PrivacyInfo privacyInfo = obj as PrivacyInfo;

            return(privacyInfo != null && this.HasIsUsingRid == privacyInfo.HasIsUsingRid && (!this.HasIsUsingRid || this.IsUsingRid.Equals(privacyInfo.IsUsingRid)) && this.HasIsRealIdVisibleForViewFriends == privacyInfo.HasIsRealIdVisibleForViewFriends && (!this.HasIsRealIdVisibleForViewFriends || this.IsRealIdVisibleForViewFriends.Equals(privacyInfo.IsRealIdVisibleForViewFriends)) && this.HasIsHiddenFromFriendFinder == privacyInfo.HasIsHiddenFromFriendFinder && (!this.HasIsHiddenFromFriendFinder || this.IsHiddenFromFriendFinder.Equals(privacyInfo.IsHiddenFromFriendFinder)) && this.HasGameInfoPrivacy == privacyInfo.HasGameInfoPrivacy && (!this.HasGameInfoPrivacy || this.GameInfoPrivacy.Equals(privacyInfo.GameInfoPrivacy)));
        }
 public void SetPrivacyInfo(PrivacyInfo val)
 {
     this.PrivacyInfo = val;
 }
 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");
 }