public override byte[] ToBytes()
{
List<byte> totalBuffer = new List<byte>();
RdpbcgrEncoder.EncodeStructure(totalBuffer, tpktHeader);
RdpbcgrEncoder.EncodeStructure(totalBuffer, x224Ccf);
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.selectedProtocol);
}
byte[] encodedBytes = totalBuffer.ToArray();
// ToDo: Ugly dump message code here
// ETW Provider Dump Code
RdpbcgrUtility.ETWProviderDump(this.GetType().Name, encodedBytes);
return encodedBytes;
}