public static void Serialize(Stream stream, RevokeInvitationRequest instance)
        {
            BinaryWriter binaryWriter = new BinaryWriter(stream);

            if (instance.HasAgentId)
            {
                stream.WriteByte(10);
                ProtocolParser.WriteUInt32(stream, instance.AgentId.GetSerializedSize());
                EntityId.Serialize(stream, instance.AgentId);
            }
            if (instance.HasTargetId)
            {
                stream.WriteByte(18);
                ProtocolParser.WriteUInt32(stream, instance.TargetId.GetSerializedSize());
                EntityId.Serialize(stream, instance.TargetId);
            }
            stream.WriteByte(25);
            binaryWriter.Write(instance.InvitationId);
            if (instance.ChannelId == null)
            {
                throw new ArgumentNullException("ChannelId", "Required by proto specification.");
            }
            stream.WriteByte(34);
            ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize());
            EntityId.Serialize(stream, instance.ChannelId);
        }
        public override bool Equals(object obj)
        {
            RevokeInvitationRequest revokeInvitationRequest = obj as RevokeInvitationRequest;

            if (revokeInvitationRequest == null)
            {
                return(false);
            }
            if (this.HasAgentId != revokeInvitationRequest.HasAgentId || this.HasAgentId && !this.AgentId.Equals(revokeInvitationRequest.AgentId))
            {
                return(false);
            }
            if (this.HasTargetId != revokeInvitationRequest.HasTargetId || this.HasTargetId && !this.TargetId.Equals(revokeInvitationRequest.TargetId))
            {
                return(false);
            }
            if (!this.InvitationId.Equals(revokeInvitationRequest.InvitationId))
            {
                return(false);
            }
            if (!this.ChannelId.Equals(revokeInvitationRequest.ChannelId))
            {
                return(false);
            }
            return(true);
        }
        public static RevokeInvitationRequest DeserializeLengthDelimited(Stream stream, RevokeInvitationRequest instance)
        {
            long position = (long)ProtocolParser.ReadUInt32(stream);

            position += stream.Position;
            return(RevokeInvitationRequest.Deserialize(stream, instance, position));
        }
        public static RevokeInvitationRequest DeserializeLengthDelimited(Stream stream)
        {
            RevokeInvitationRequest revokeInvitationRequest = new RevokeInvitationRequest();

            RevokeInvitationRequest.DeserializeLengthDelimited(stream, revokeInvitationRequest);
            return(revokeInvitationRequest);
        }
Beispiel #5
0
        public static RevokeInvitationRequest DeserializeLengthDelimited(Stream stream, RevokeInvitationRequest instance)
        {
            long num = (long)((ulong)ProtocolParser.ReadUInt32(stream));

            num += stream.get_Position();
            return(RevokeInvitationRequest.Deserialize(stream, instance, num));
        }
        public static RevokeInvitationRequest Deserialize(Stream stream, RevokeInvitationRequest instance, long limit)
        {
            BinaryReader binaryReader = new BinaryReader(stream);

            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)
                    {
                        if (instance.TargetId != null)
                        {
                            EntityId.DeserializeLengthDelimited(stream, instance.TargetId);
                        }
                        else
                        {
                            instance.TargetId = EntityId.DeserializeLengthDelimited(stream);
                        }
                    }
                    else if (num == 25)
                    {
                        instance.InvitationId = binaryReader.ReadUInt64();
                    }
                    else if (num != 34)
                    {
                        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.ChannelId != null)
                    {
                        EntityId.DeserializeLengthDelimited(stream, instance.ChannelId);
                    }
                    else
                    {
                        instance.ChannelId = EntityId.DeserializeLengthDelimited(stream);
                    }
                }
                else
                {
                    if (stream.Position != limit)
                    {
                        throw new ProtocolBufferException("Read past max limit");
                    }
                    break;
                }
            }
            return(instance);
        }
 public static RevokeInvitationRequest Deserialize(Stream stream, RevokeInvitationRequest instance)
 {
     return(RevokeInvitationRequest.Deserialize(stream, instance, (long)-1));
 }
 public void Deserialize(Stream stream)
 {
     RevokeInvitationRequest.Deserialize(stream, this);
 }
Beispiel #9
0
        public override bool Equals(object obj)
        {
            RevokeInvitationRequest revokeInvitationRequest = obj as RevokeInvitationRequest;

            return(revokeInvitationRequest != null && this.HasAgentId == revokeInvitationRequest.HasAgentId && (!this.HasAgentId || this.AgentId.Equals(revokeInvitationRequest.AgentId)) && this.HasTargetId == revokeInvitationRequest.HasTargetId && (!this.HasTargetId || this.TargetId.Equals(revokeInvitationRequest.TargetId)) && this.InvitationId.Equals(revokeInvitationRequest.InvitationId) && this.ChannelId.Equals(revokeInvitationRequest.ChannelId));
        }