public static GenericFriendRequest DeserializeLengthDelimited(Stream stream)
        {
            GenericFriendRequest genericFriendRequest = new GenericFriendRequest();

            GenericFriendRequest.DeserializeLengthDelimited(stream, genericFriendRequest);
            return(genericFriendRequest);
        }
        public static GenericFriendRequest DeserializeLengthDelimited(Stream stream, GenericFriendRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.Position;
            return(GenericFriendRequest.Deserialize(stream, instance, num));
        }
Example #3
0
 public static GenericFriendRequest Deserialize(Stream stream, GenericFriendRequest instance, long limit)
 {
     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.AgentId != null)
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
                 }
                 else
                 {
                     instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
                 }
             }
             else if (num != 18)
             {
                 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.TargetId != null)
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.TargetId);
             }
             else
             {
                 instance.TargetId = EntityId.DeserializeLengthDelimited(stream);
             }
         }
         else
         {
             if (stream.Position != limit)
             {
                 throw new ProtocolBufferException("Read past max limit");
             }
             break;
         }
     }
     return(instance);
 }
 public static GenericFriendRequest Deserialize(Stream stream, GenericFriendRequest instance, long limit)
 {
     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 if (instance.TargetId == null)
                 {
                     instance.TargetId = EntityId.DeserializeLengthDelimited(stream);
                 }
                 else
                 {
                     EntityId.DeserializeLengthDelimited(stream, instance.TargetId);
                 }
             }
             else if (instance.AgentId == null)
             {
                 instance.AgentId = EntityId.DeserializeLengthDelimited(stream);
             }
             else
             {
                 EntityId.DeserializeLengthDelimited(stream, instance.AgentId);
             }
         }
     }
     if (stream.get_Position() == limit)
     {
         return(instance);
     }
     throw new ProtocolBufferException("Read past max limit");
 }
 public static void Serialize(Stream stream, GenericFriendRequest instance)
 {
     if (instance.HasAgentId)
     {
         stream.WriteByte(10);
         ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
         EntityId.Serialize(stream, instance.AgentId);
     }
     if (instance.TargetId == null)
     {
         throw new ArgumentNullException("TargetId", "Required by proto specification.");
     }
     stream.WriteByte(18);
     ProtocolParser.WriteUInt32(stream, instance.TargetId.GetSerializedSize());
     EntityId.Serialize(stream, instance.TargetId);
 }
Example #6
0
        public override bool Equals(object obj)
        {
            GenericFriendRequest genericFriendRequest = obj as GenericFriendRequest;

            if (genericFriendRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != genericFriendRequest.HasAgentId || this.HasAgentId && !this.AgentId.Equals(genericFriendRequest.AgentId))
            {
                return(false);
            }
            if (!this.TargetId.Equals(genericFriendRequest.TargetId))
            {
                return(false);
            }
            return(true);
        }
 public static GenericFriendRequest Deserialize(Stream stream, GenericFriendRequest instance)
 {
     return(GenericFriendRequest.Deserialize(stream, instance, -1L));
 }
 public void Deserialize(Stream stream)
 {
     GenericFriendRequest.Deserialize(stream, this);
 }
        public override bool Equals(object obj)
        {
            GenericFriendRequest genericFriendRequest = obj as GenericFriendRequest;

            return(genericFriendRequest != null && this.HasAgentId == genericFriendRequest.HasAgentId && (!this.HasAgentId || this.AgentId.Equals(genericFriendRequest.AgentId)) && this.TargetId.Equals(genericFriendRequest.TargetId));
        }