public static FriendInvitation DeserializeLengthDelimited(Stream stream, FriendInvitation instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.Position; return(FriendInvitation.Deserialize(stream, instance, num)); }
public override bool Equals(object obj) { FriendInvitation friendInvitation = obj as FriendInvitation; if (friendInvitation == null) { return(false); } if (this.HasFirstReceived != friendInvitation.HasFirstReceived || (this.HasFirstReceived && !this.FirstReceived.Equals(friendInvitation.FirstReceived))) { return(false); } if (this.Role.Count != friendInvitation.Role.Count) { return(false); } for (int i = 0; i < this.Role.Count; i++) { if (!this.Role[i].Equals(friendInvitation.Role[i])) { return(false); } } return(true); }
public static FriendInvitation DeserializeLengthDelimited(Stream stream) { FriendInvitation friendInvitation = new FriendInvitation(); FriendInvitation.DeserializeLengthDelimited(stream, friendInvitation); return(friendInvitation); }
public static void Serialize(Stream stream, FriendInvitation instance) { if (instance.HasFirstReceived) { stream.WriteByte(8); ProtocolParser.WriteBool(stream, instance.FirstReceived); } if (instance.Role.get_Count() > 0) { stream.WriteByte(18); 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 FriendInvitation Deserialize(Stream stream, FriendInvitation instance, long limit) { instance.FirstReceived = false; 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 != 8) { 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 { 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.FirstReceived = ProtocolParser.ReadBool(stream); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }
public static FriendInvitation Deserialize(Stream stream, FriendInvitation instance, long limit) { instance.FirstReceived = false; 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 == 8) { instance.FirstReceived = ProtocolParser.ReadBool(stream); } else if (num == 18) { 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); }
public static void Serialize(Stream stream, FriendInvitation instance) { if (instance.HasFirstReceived) { stream.WriteByte(8); ProtocolParser.WriteBool(stream, instance.FirstReceived); } if (instance.Role.Count > 0) { stream.WriteByte(18); 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 void Serialize(Stream stream) { FriendInvitation.Serialize(stream, this); }
public static FriendInvitation Deserialize(Stream stream, FriendInvitation instance) { return(FriendInvitation.Deserialize(stream, instance, -1L)); }