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

            num += stream.get_Position();
            return(FriendInvitationParams.Deserialize(stream, instance, num));
        }
        public static FriendInvitationParams DeserializeLengthDelimited(Stream stream)
        {
            FriendInvitationParams friendInvitationParams = new FriendInvitationParams();

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

            position += stream.Position;
            return(FriendInvitationParams.Deserialize(stream, instance, position));
        }
 public static void Serialize(Stream stream, FriendInvitationParams instance)
 {
     if (instance.HasTargetEmail)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.TargetEmail));
     }
     if (instance.HasTargetBattleTag)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.TargetBattleTag));
     }
     if (instance.HasInviterBattleTag)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.InviterBattleTag));
     }
     if (instance.HasInviterFullName)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.InviterFullName));
     }
     if (instance.HasInviteeDisplayName)
     {
         stream.WriteByte(42);
         ProtocolParser.WriteBytes(stream, Encoding.get_UTF8().GetBytes(instance.InviteeDisplayName));
     }
     if (instance.Role.get_Count() > 0)
     {
         stream.WriteByte(50);
         uint num = 0u;
         using (List <uint> .Enumerator enumerator = instance.Role.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 uint current = enumerator.get_Current();
                 num += ProtocolParser.SizeOfUInt32(current);
             }
         }
         ProtocolParser.WriteUInt32(stream, num);
         using (List <uint> .Enumerator enumerator2 = instance.Role.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 uint current2 = enumerator2.get_Current();
                 ProtocolParser.WriteUInt32(stream, current2);
             }
         }
     }
 }
 public static void Serialize(Stream stream, FriendInvitationParams instance)
 {
     if (instance.HasTargetEmail)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.TargetEmail));
     }
     if (instance.HasTargetBattleTag)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.TargetBattleTag));
     }
     if (instance.HasInviterBattleTag)
     {
         stream.WriteByte(26);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.InviterBattleTag));
     }
     if (instance.HasInviterFullName)
     {
         stream.WriteByte(34);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.InviterFullName));
     }
     if (instance.HasInviteeDisplayName)
     {
         stream.WriteByte(42);
         ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.InviteeDisplayName));
     }
     if (instance.Role.Count > 0)
     {
         stream.WriteByte(50);
         uint num = 0u;
         foreach (uint val in instance.Role)
         {
             num += ProtocolParser.SizeOfUInt32(val);
         }
         ProtocolParser.WriteUInt32(stream, num);
         foreach (uint val2 in instance.Role)
         {
             ProtocolParser.WriteUInt32(stream, val2);
         }
     }
 }
        public override bool Equals(object obj)
        {
            FriendInvitationParams friendInvitationParams = obj as FriendInvitationParams;

            if (friendInvitationParams == null)
            {
                return(false);
            }
            if (this.HasTargetEmail != friendInvitationParams.HasTargetEmail || (this.HasTargetEmail && !this.TargetEmail.Equals(friendInvitationParams.TargetEmail)))
            {
                return(false);
            }
            if (this.HasTargetBattleTag != friendInvitationParams.HasTargetBattleTag || (this.HasTargetBattleTag && !this.TargetBattleTag.Equals(friendInvitationParams.TargetBattleTag)))
            {
                return(false);
            }
            if (this.HasInviterBattleTag != friendInvitationParams.HasInviterBattleTag || (this.HasInviterBattleTag && !this.InviterBattleTag.Equals(friendInvitationParams.InviterBattleTag)))
            {
                return(false);
            }
            if (this.HasInviterFullName != friendInvitationParams.HasInviterFullName || (this.HasInviterFullName && !this.InviterFullName.Equals(friendInvitationParams.InviterFullName)))
            {
                return(false);
            }
            if (this.HasInviteeDisplayName != friendInvitationParams.HasInviteeDisplayName || (this.HasInviteeDisplayName && !this.InviteeDisplayName.Equals(friendInvitationParams.InviteeDisplayName)))
            {
                return(false);
            }
            if (this.Role.get_Count() != friendInvitationParams.Role.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Role.get_Count(); i++)
            {
                if (!this.Role.get_Item(i).Equals(friendInvitationParams.Role.get_Item(i)))
                {
                    return(false);
                }
            }
            return(true);
        }
 public void Serialize(Stream stream)
 {
     FriendInvitationParams.Serialize(stream, this);
 }
 public static FriendInvitationParams Deserialize(Stream stream, FriendInvitationParams instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     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 != 34)
                         {
                             if (num2 != 42)
                             {
                                 if (num2 != 50)
                                 {
                                     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
                                 {
                                     long num3 = (long)((ulong)ProtocolParser.ReadUInt32(stream));
                                     num3 += stream.get_Position();
                                     while (stream.get_Position() < num3)
                                     {
                                         instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                                     }
                                     if (stream.get_Position() != num3)
                                     {
                                         throw new ProtocolBufferException("Read too many bytes in packed data");
                                     }
                                 }
                             }
                             else
                             {
                                 instance.InviteeDisplayName = ProtocolParser.ReadString(stream);
                             }
                         }
                         else
                         {
                             instance.InviterFullName = ProtocolParser.ReadString(stream);
                         }
                     }
                     else
                     {
                         instance.InviterBattleTag = ProtocolParser.ReadString(stream);
                     }
                 }
                 else
                 {
                     instance.TargetBattleTag = ProtocolParser.ReadString(stream);
                 }
             }
             else
             {
                 instance.TargetEmail = ProtocolParser.ReadString(stream);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static FriendInvitationParams Deserialize(Stream stream, FriendInvitationParams instance)
 {
     return(FriendInvitationParams.Deserialize(stream, instance, -1L));
 }
 public static FriendInvitationParams Deserialize(Stream stream, FriendInvitationParams instance, long limit)
 {
     if (instance.Role == null)
     {
         instance.Role = new List <uint>();
     }
     while (true)
     {
         if (limit < (long)0 || stream.Position < limit)
         {
             int num = stream.ReadByte();
             if (num == -1)
             {
                 if (limit >= (long)0)
                 {
                     throw new EndOfStreamException();
                 }
                 break;
             }
             else if (num == 10)
             {
                 instance.TargetEmail = ProtocolParser.ReadString(stream);
             }
             else if (num == 18)
             {
                 instance.TargetBattleTag = ProtocolParser.ReadString(stream);
             }
             else if (num == 26)
             {
                 instance.InviterBattleTag = ProtocolParser.ReadString(stream);
             }
             else if (num == 34)
             {
                 instance.InviterFullName = ProtocolParser.ReadString(stream);
             }
             else if (num == 42)
             {
                 instance.InviteeDisplayName = ProtocolParser.ReadString(stream);
             }
             else if (num == 50)
             {
                 long position = (long)ProtocolParser.ReadUInt32(stream);
                 position += stream.Position;
                 while (stream.Position < position)
                 {
                     instance.Role.Add(ProtocolParser.ReadUInt32(stream));
                 }
                 if (stream.Position != position)
                 {
                     throw new ProtocolBufferException("Read too many bytes in packed data");
                 }
             }
             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);
 }