public override byte[] ToBytes()
{
List<byte> totalBuffer = new List<byte>();
RdpbcgrEncoder.EncodeStructure(totalBuffer, tpktHeader);
RdpbcgrEncoder.EncodeStructure(totalBuffer, x224Crq);
if (routingToken != null)
{
RdpbcgrEncoder.EncodeBytes(totalBuffer, routingToken);
}
if (rdpNegData != null)
{
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpNegData.type);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpNegData.flags);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (ushort)rdpNegData.length);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (uint)rdpNegData.requestedProtocols);
}
if (rdpCorrelationInfo != null)
{
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpCorrelationInfo.type);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpCorrelationInfo.flags);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (ushort)rdpCorrelationInfo.length);
RdpbcgrEncoder.EncodeBytes(totalBuffer, rdpCorrelationInfo.correlationId);
RdpbcgrEncoder.EncodeBytes(totalBuffer, rdpCorrelationInfo.reserved);
}
return totalBuffer.ToArray();
}