public override byte[] ToBytes()
{
List<byte> totalBuffer = new List<byte>();
RdpbcgrEncoder.EncodeStructure(totalBuffer, tpktHeader);
RdpbcgrEncoder.EncodeStructure(totalBuffer, x224Ccf);
if (rdpNegFailure != null)
{
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpNegFailure.type);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (byte)rdpNegFailure.flags);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (ushort)rdpNegFailure.length);
RdpbcgrEncoder.EncodeStructure(totalBuffer, (uint)rdpNegFailure.failureCode);
}
byte[] encodedBytes = totalBuffer.ToArray();
// ToDo: Ugly dump message code here
// ETW Provider Dump Code
RdpbcgrUtility.ETWProviderDump(this.GetType().Name, encodedBytes);
return encodedBytes;
}