Пример #1
0
        public static InvitationNotification DeserializeLengthDelimited(Stream stream, InvitationNotification instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(InvitationNotification.Deserialize(stream, instance, position));
        }
Пример #2
0
        public static InvitationNotification DeserializeLengthDelimited(Stream stream)
        {
            InvitationNotification invitationNotification = new InvitationNotification();

            InvitationNotification.DeserializeLengthDelimited(stream, invitationNotification);
            return(invitationNotification);
        }
Пример #3
0
        public static InvitationNotification DeserializeLengthDelimited(Stream stream, InvitationNotification instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(InvitationNotification.Deserialize(stream, instance, num));
        }
 public static InvitationNotification Deserialize(Stream stream, InvitationNotification instance, long limit)
 {
     instance.Reason = 0u;
     while (limit < 0L || stream.Position < limit)
     {
         int num = stream.ReadByte();
         if (num == -1)
         {
             if (limit >= 0L)
             {
                 throw new EndOfStreamException();
             }
             return(instance);
         }
         else if (num != 10)
         {
             if (num != 18)
             {
                 if (num != 24)
                 {
                     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.Reason = ProtocolParser.ReadUInt32(stream);
                 }
             }
             else if (instance.GameAccountId == null)
             {
                 instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
             }
         }
         else if (instance.Invitation == null)
         {
             instance.Invitation = Invitation.DeserializeLengthDelimited(stream);
         }
         else
         {
             Invitation.DeserializeLengthDelimited(stream, instance.Invitation);
         }
     }
     if (stream.Position == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Пример #5
0
 public static void Serialize(Stream stream, InvitationNotification instance)
 {
     if (instance.Invitation == null)
     {
         throw new ArgumentNullException("Invitation", "Required by proto specification.");
     }
     stream.WriteByte(10);
     ProtocolParser.WriteUInt32(stream, instance.Invitation.GetSerializedSize());
     bnet.protocol.invitation.Invitation.Serialize(stream, instance.Invitation);
     if (instance.HasGameAccountId)
     {
         stream.WriteByte(18);
         ProtocolParser.WriteUInt32(stream, instance.GameAccountId.GetSerializedSize());
         EntityId.Serialize(stream, instance.GameAccountId);
     }
     if (instance.HasReason)
     {
         stream.WriteByte(24);
         ProtocolParser.WriteUInt32(stream, instance.Reason);
     }
 }
Пример #6
0
        public override bool Equals(object obj)
        {
            InvitationNotification invitationNotification = obj as InvitationNotification;

            if (invitationNotification == null)
            {
                return(false);
            }
            if (!this.Invitation.Equals(invitationNotification.Invitation))
            {
                return(false);
            }
            if (this.HasGameAccountId != invitationNotification.HasGameAccountId || this.HasGameAccountId && !this.GameAccountId.Equals(invitationNotification.GameAccountId))
            {
                return(false);
            }
            if (this.HasReason == invitationNotification.HasReason && (!this.HasReason || this.Reason.Equals(invitationNotification.Reason)))
            {
                return(true);
            }
            return(false);
        }
Пример #7
0
 public static InvitationNotification Deserialize(Stream stream, InvitationNotification instance, long limit)
 {
     instance.Reason = 0;
     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 (instance.Invitation != null)
                 {
                     bnet.protocol.invitation.Invitation.DeserializeLengthDelimited(stream, instance.Invitation);
                 }
                 else
                 {
                     instance.Invitation = bnet.protocol.invitation.Invitation.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 if (num == 24)
                 {
                     instance.Reason = ProtocolParser.ReadUInt32(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.GameAccountId != null)
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.GameAccountId);
             }
             else
             {
                 instance.GameAccountId = EntityId.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
Пример #8
0
 public static InvitationNotification Deserialize(Stream stream, InvitationNotification instance)
 {
     return(InvitationNotification.Deserialize(stream, instance, (long)-1));
 }
Пример #9
0
 public void Deserialize(Stream stream)
 {
     InvitationNotification.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            InvitationNotification invitationNotification = obj as InvitationNotification;

            return(invitationNotification != null && this.Invitation.Equals(invitationNotification.Invitation) && this.HasGameAccountId == invitationNotification.HasGameAccountId && (!this.HasGameAccountId || this.GameAccountId.Equals(invitationNotification.GameAccountId)) && this.HasReason == invitationNotification.HasReason && (!this.HasReason || this.Reason.Equals(invitationNotification.Reason)));
        }