Exemplo n.º 1
0
        public static SubscribeResponse DeserializeLengthDelimited(Stream stream)
        {
            SubscribeResponse subscribeResponse = new SubscribeResponse();

            SubscribeResponse.DeserializeLengthDelimited(stream, subscribeResponse);
            return(subscribeResponse);
        }
Exemplo n.º 2
0
        public static SubscribeResponse DeserializeLengthDelimited(Stream stream, SubscribeResponse instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(SubscribeResponse.Deserialize(stream, instance, num));
        }
Exemplo n.º 3
0
        public override bool Equals(object obj)
        {
            SubscribeResponse subscribeResponse = obj as SubscribeResponse;

            if (subscribeResponse == null)
            {
                return(false);
            }
            if (this.Collection.Count != subscribeResponse.Collection.Count)
            {
                return(false);
            }
            for (int i = 0; i < this.Collection.Count; i++)
            {
                if (!this.Collection[i].Equals(subscribeResponse.Collection[i]))
                {
                    return(false);
                }
            }
            if (this.ReceivedInvitation.Count != subscribeResponse.ReceivedInvitation.Count)
            {
                return(false);
            }
            for (int j = 0; j < this.ReceivedInvitation.Count; j++)
            {
                if (!this.ReceivedInvitation[j].Equals(subscribeResponse.ReceivedInvitation[j]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        public override bool Equals(object obj)
        {
            SubscribeResponse subscribeResponse = obj as SubscribeResponse;

            if (subscribeResponse == null)
            {
                return(false);
            }
            if (this.Collection.get_Count() != subscribeResponse.Collection.get_Count())
            {
                return(false);
            }
            for (int i = 0; i < this.Collection.get_Count(); i++)
            {
                if (!this.Collection.get_Item(i).Equals(subscribeResponse.Collection.get_Item(i)))
                {
                    return(false);
                }
            }
            if (this.ReceivedInvitation.get_Count() != subscribeResponse.ReceivedInvitation.get_Count())
            {
                return(false);
            }
            for (int j = 0; j < this.ReceivedInvitation.get_Count(); j++)
            {
                if (!this.ReceivedInvitation.get_Item(j).Equals(subscribeResponse.ReceivedInvitation.get_Item(j)))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
 public static void Serialize(Stream stream, SubscribeResponse instance)
 {
     if (instance.Collection.get_Count() > 0)
     {
         using (List <InvitationCollection> .Enumerator enumerator = instance.Collection.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 InvitationCollection current = enumerator.get_Current();
                 stream.WriteByte(10);
                 ProtocolParser.WriteUInt32(stream, current.GetSerializedSize());
                 InvitationCollection.Serialize(stream, current);
             }
         }
     }
     if (instance.ReceivedInvitation.get_Count() > 0)
     {
         using (List <Invitation> .Enumerator enumerator2 = instance.ReceivedInvitation.GetEnumerator())
         {
             while (enumerator2.MoveNext())
             {
                 Invitation current2 = enumerator2.get_Current();
                 stream.WriteByte(18);
                 ProtocolParser.WriteUInt32(stream, current2.GetSerializedSize());
                 Invitation.Serialize(stream, current2);
             }
         }
     }
 }
Exemplo n.º 6
0
 public static SubscribeResponse Deserialize(Stream stream, SubscribeResponse instance, long limit)
 {
     if (instance.Collection == null)
     {
         instance.Collection = new List <InvitationCollection>();
     }
     if (instance.ReceivedInvitation == null)
     {
         instance.ReceivedInvitation = new List <Invitation>();
     }
     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)
                 {
                     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.ReceivedInvitation.Add(Invitation.DeserializeLengthDelimited(stream));
                 }
             }
             else
             {
                 instance.Collection.Add(InvitationCollection.DeserializeLengthDelimited(stream));
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
Exemplo n.º 7
0
 public static void Serialize(Stream stream, SubscribeResponse instance)
 {
     if (instance.Collection.Count > 0)
     {
         foreach (InvitationCollection invitationCollection in instance.Collection)
         {
             stream.WriteByte(10);
             ProtocolParser.WriteUInt32(stream, invitationCollection.GetSerializedSize());
             InvitationCollection.Serialize(stream, invitationCollection);
         }
     }
     if (instance.ReceivedInvitation.Count > 0)
     {
         foreach (Invitation invitation in instance.ReceivedInvitation)
         {
             stream.WriteByte(18);
             ProtocolParser.WriteUInt32(stream, invitation.GetSerializedSize());
             Invitation.Serialize(stream, invitation);
         }
     }
 }
Exemplo n.º 8
0
 public void Serialize(Stream stream)
 {
     SubscribeResponse.Serialize(stream, this);
 }
Exemplo n.º 9
0
 public static SubscribeResponse Deserialize(Stream stream, SubscribeResponse instance)
 {
     return(SubscribeResponse.Deserialize(stream, instance, -1L));
 }