public static SubscribeToFriendsResponse DeserializeLengthDelimited(Stream stream)
        {
            SubscribeToFriendsResponse subscribeToFriendsResponse = new SubscribeToFriendsResponse();

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

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

            num += stream.get_Position();
            return(SubscribeToFriendsResponse.Deserialize(stream, instance, num));
        }
 public static void Serialize(Stream stream, SubscribeToFriendsResponse instance)
 {
     if (instance.HasMaxFriends)
     {
         stream.WriteByte(8);
         ProtocolParser.WriteUInt32(stream, instance.MaxFriends);
     }
     if (instance.HasMaxReceivedInvitations)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.MaxReceivedInvitations);
     }
     if (instance.HasMaxSentInvitations)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.MaxSentInvitations);
     }
     if (instance.Role.Count > 0)
     {
         foreach (bnet.protocol.Role role in instance.Role)
         {
             stream.WriteByte(34);
             ProtocolParser.WriteUInt32(stream, role.GetSerializedSize());
             bnet.protocol.Role.Serialize(stream, role);
         }
     }
     if (instance.Friends.Count > 0)
     {
         foreach (Friend friend in instance.Friends)
         {
             stream.WriteByte(42);
             ProtocolParser.WriteUInt32(stream, friend.GetSerializedSize());
             Friend.Serialize(stream, friend);
         }
     }
     if (instance.SentInvitations.Count > 0)
     {
         foreach (Invitation sentInvitation in instance.SentInvitations)
         {
             stream.WriteByte(50);
             ProtocolParser.WriteUInt32(stream, sentInvitation.GetSerializedSize());
             Invitation.Serialize(stream, sentInvitation);
         }
     }
     if (instance.ReceivedInvitations.Count > 0)
     {
         foreach (Invitation receivedInvitation in instance.ReceivedInvitations)
         {
             stream.WriteByte(58);
             ProtocolParser.WriteUInt32(stream, receivedInvitation.GetSerializedSize());
             Invitation.Serialize(stream, receivedInvitation);
         }
     }
 }
 public void Serialize(Stream stream)
 {
     SubscribeToFriendsResponse.Serialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            SubscribeToFriendsResponse subscribeToFriendsResponse = obj as SubscribeToFriendsResponse;

            if (subscribeToFriendsResponse == null)
            {
                return(false);
            }
            if (this.HasMaxFriends != subscribeToFriendsResponse.HasMaxFriends || this.HasMaxFriends && !this.MaxFriends.Equals(subscribeToFriendsResponse.MaxFriends))
            {
                return(false);
            }
            if (this.HasMaxReceivedInvitations != subscribeToFriendsResponse.HasMaxReceivedInvitations || this.HasMaxReceivedInvitations && !this.MaxReceivedInvitations.Equals(subscribeToFriendsResponse.MaxReceivedInvitations))
            {
                return(false);
            }
            if (this.HasMaxSentInvitations != subscribeToFriendsResponse.HasMaxSentInvitations || this.HasMaxSentInvitations && !this.MaxSentInvitations.Equals(subscribeToFriendsResponse.MaxSentInvitations))
            {
                return(false);
            }
            if (this.Role.Count != subscribeToFriendsResponse.Role.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Role.Count; i++)
            {
                if (!this.Role[i].Equals(subscribeToFriendsResponse.Role[i]))
                {
                    return(false);
                }
            }
            if (this.Friends.Count != subscribeToFriendsResponse.Friends.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.Friends.Count; j++)
            {
                if (!this.Friends[j].Equals(subscribeToFriendsResponse.Friends[j]))
                {
                    return(false);
                }
            }
            if (this.SentInvitations.Count != subscribeToFriendsResponse.SentInvitations.Count)
            {
                return(false);
            }
            for (int k = 0; k < this.SentInvitations.Count; k++)
            {
                if (!this.SentInvitations[k].Equals(subscribeToFriendsResponse.SentInvitations[k]))
                {
                    return(false);
                }
            }
            if (this.ReceivedInvitations.Count != subscribeToFriendsResponse.ReceivedInvitations.Count)
            {
                return(false);
            }
            for (int l = 0; l < this.ReceivedInvitations.Count; l++)
            {
                if (!this.ReceivedInvitations[l].Equals(subscribeToFriendsResponse.ReceivedInvitations[l]))
                {
                    return(false);
                }
            }
            return(true);
        }
 public static SubscribeToFriendsResponse Deserialize(Stream stream, SubscribeToFriendsResponse instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <bnet.protocol.Role>();
     }
     if (instance.Friends == null)
     {
         instance.Friends = new List <Friend>();
     }
     if (instance.SentInvitations == null)
     {
         instance.SentInvitations = new List <Invitation>();
     }
     if (instance.ReceivedInvitations == null)
     {
         instance.ReceivedInvitations = new List <Invitation>();
     }
     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 == 8)
             {
                 instance.MaxFriends = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 16)
             {
                 instance.MaxReceivedInvitations = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 24)
             {
                 instance.MaxSentInvitations = ProtocolParser.ReadUInt32(stream);
             }
             else if (num == 34)
             {
                 instance.Role.Add(bnet.protocol.Role.DeserializeLengthDelimited(stream));
             }
             else if (num == 42)
             {
                 instance.Friends.Add(Friend.DeserializeLengthDelimited(stream));
             }
             else if (num == 50)
             {
                 instance.SentInvitations.Add(Invitation.DeserializeLengthDelimited(stream));
             }
             else if (num == 58)
             {
                 instance.ReceivedInvitations.Add(Invitation.DeserializeLengthDelimited(stream));
             }
             else
             {
                 Key key = ProtocolParser.ReadKey((byte)num, stream);
                 if (key.Field == 0)
                 {
                     throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream");
                 }
                 ProtocolParser.SkipKey(stream, key);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static SubscribeToFriendsResponse Deserialize(Stream stream, SubscribeToFriendsResponse instance)
 {
     return(SubscribeToFriendsResponse.Deserialize(stream, instance, (long)-1));
 }
        public override bool Equals(object obj)
        {
            SubscribeToFriendsResponse subscribeToFriendsResponse = obj as SubscribeToFriendsResponse;

            if (subscribeToFriendsResponse == null)
            {
                return(false);
            }
            if (this.HasMaxFriends != subscribeToFriendsResponse.HasMaxFriends || (this.HasMaxFriends && !this.MaxFriends.Equals(subscribeToFriendsResponse.MaxFriends)))
            {
                return(false);
            }
            if (this.HasMaxReceivedInvitations != subscribeToFriendsResponse.HasMaxReceivedInvitations || (this.HasMaxReceivedInvitations && !this.MaxReceivedInvitations.Equals(subscribeToFriendsResponse.MaxReceivedInvitations)))
            {
                return(false);
            }
            if (this.HasMaxSentInvitations != subscribeToFriendsResponse.HasMaxSentInvitations || (this.HasMaxSentInvitations && !this.MaxSentInvitations.Equals(subscribeToFriendsResponse.MaxSentInvitations)))
            {
                return(false);
            }
            if (this.Role.get_Count() != subscribeToFriendsResponse.Role.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Role.get_Count(); i++)
            {
                if (!this.Role.get_Item(i).Equals(subscribeToFriendsResponse.Role.get_Item(i)))
                {
                    return(false);
                }
            }
            if (this.Friends.get_Count() != subscribeToFriendsResponse.Friends.get_Count())
            {
                return(false);
            }
            for (int j = 0; j < this.Friends.get_Count(); j++)
            {
                if (!this.Friends.get_Item(j).Equals(subscribeToFriendsResponse.Friends.get_Item(j)))
                {
                    return(false);
                }
            }
            if (this.SentInvitations.get_Count() != subscribeToFriendsResponse.SentInvitations.get_Count())
            {
                return(false);
            }
            for (int k = 0; k < this.SentInvitations.get_Count(); k++)
            {
                if (!this.SentInvitations.get_Item(k).Equals(subscribeToFriendsResponse.SentInvitations.get_Item(k)))
                {
                    return(false);
                }
            }
            if (this.ReceivedInvitations.get_Count() != subscribeToFriendsResponse.ReceivedInvitations.get_Count())
            {
                return(false);
            }
            for (int l = 0; l < this.ReceivedInvitations.get_Count(); l++)
            {
                if (!this.ReceivedInvitations.get_Item(l).Equals(subscribeToFriendsResponse.ReceivedInvitations.get_Item(l)))
                {
                    return(false);
                }
            }
            return(true);
        }
 public static void Serialize(Stream stream, SubscribeToFriendsResponse instance)
 {
     if (instance.HasMaxFriends)
     {
         stream.WriteByte(8);
         ProtocolParser.WriteUInt32(stream, instance.MaxFriends);
     }
     if (instance.HasMaxReceivedInvitations)
     {
         stream.WriteByte(16);
         ProtocolParser.WriteUInt32(stream, instance.MaxReceivedInvitations);
     }
     if (instance.HasMaxSentInvitations)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.MaxSentInvitations);
     }
     if (instance.Role.get_Count() > 0)
     {
         using (List <Role> .Enumerator enumerator = instance.Role.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Role current = enumerator.get_Current();
                 stream.WriteByte(34);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 bnet.protocol.Role.Serialize(stream, current);
             }
         }
     }
     if (instance.Friends.get_Count() > 0)
     {
         using (List <Friend> .Enumerator enumerator2 = instance.Friends.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 Friend current2 = enumerator2.get_Current();
                 stream.WriteByte(42);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 Friend.Serialize(stream, current2);
             }
         }
     }
     if (instance.SentInvitations.get_Count() > 0)
     {
         using (List <Invitation> .Enumerator enumerator3 = instance.SentInvitations.GetEnumerator())
         {
             while (enumerator3.MoveNext())
             {
                 Invitation current3 = enumerator3.get_Current();
                 stream.WriteByte(50);
                 ProtocolParser.WriteUInt32(stream, current3.GetSerializedSize());
                 Invitation.Serialize(stream, current3);
             }
         }
     }
     if (instance.ReceivedInvitations.get_Count() > 0)
     {
         using (List <Invitation> .Enumerator enumerator4 = instance.ReceivedInvitations.GetEnumerator())
         {
             while (enumerator4.MoveNext())
             {
                 Invitation current4 = enumerator4.get_Current();
                 stream.WriteByte(58);
                 ProtocolParser.WriteUInt32(stream, current4.GetSerializedSize());
                 Invitation.Serialize(stream, current4);
             }
         }
     }
 }