public override void WriteExternal(IDataOutput output)
        {
            base.WriteExternal(output);

            if (CorrelationIdBytes == null)
            {
                CorrelationIdBytes = RtmpUtil.ToByteArray(CorrelationId);
            }

            int flag = 0;

            if (CorrelationId != null && CorrelationIdBytes == null)
            {
                flag |= CORRELATION_ID_FLAG;
            }
            if (CorrelationIdBytes != null)
            {
                flag |= CORRELATION_ID_BYTES_FLAG;
            }

            output.WriteByte((byte)flag);

            if (CorrelationId != null && CorrelationIdBytes == null)
            {
                output.WriteObject(CorrelationId);
            }
            if (CorrelationIdBytes != null)
            {
                output.WriteObject(CorrelationIdBytes);
            }
        }
Exemple #2
0
        public virtual void WriteExternal(IDataOutput output)
        {
            if (ClientIdBytes == null)
            {
                ClientIdBytes = RtmpUtil.ToByteArray(ClientId);
            }
            if (MessageIdBytes == null)
            {
                MessageIdBytes = RtmpUtil.ToByteArray(MessageId);
            }

            int firstflags = 0;

            if (Body != null)
            {
                firstflags |= BODY_FLAG;
            }
            if (ClientId != null && ClientIdBytes == null)
            {
                firstflags |= CLIENT_ID_FLAG;
            }
            if (Destination != null)
            {
                firstflags |= DESTINATION_FLAG;
            }
            if (Headers != null)
            {
                firstflags |= HEADERS_FLAG;
            }
            if (MessageId != null && MessageIdBytes == null)
            {
                firstflags |= MESSAGE_ID_FLAG;
            }
            if (TimeStamp != 0)
            {
                firstflags |= TIMESTAMP_FLAG;
            }
            if (TimeToLive != 0)
            {
                firstflags |= TIME_TO_LIVE_FLAG;
            }

            int secondflags = 0;

            if (ClientIdBytes != null)
            {
                secondflags |= CLIENT_ID_BYTES_FLAG;
            }
            if (MessageIdBytes != null)
            {
                secondflags |= MESSAGE_ID_BYTES_FLAG;
            }

            if (secondflags != 0)
            {
                firstflags |= HAS_NEXT_FLAG;
            }

            output.WriteByte((byte)firstflags);
            if (secondflags != 0)
            {
                output.WriteByte((byte)secondflags);
            }

            if (Body != null)
            {
                output.WriteObject(Body);
            }
            if (ClientId != null && ClientIdBytes == null)
            {
                output.WriteObject(ClientId);
            }
            if (Destination != null)
            {
                output.WriteObject(Destination);
            }
            if (Headers != null)
            {
                output.WriteObject(Headers);
            }
            if (MessageId != null && MessageIdBytes == null)
            {
                output.WriteObject(MessageId);
            }
            if (TimeStamp != 0)
            {
                output.WriteObject(TimeStamp);
            }
            if (TimeToLive != 0)
            {
                output.WriteObject(TimeToLive);
            }

            if (ClientIdBytes != null)
            {
                output.WriteObject(ClientIdBytes);
            }
            if (MessageIdBytes != null)
            {
                output.WriteObject(MessageIdBytes);
            }
        }