Microsoft.Protocols.TestTools.StackSdk.RemoteDesktop.Rdpbcgr.Enhanced_Security_Server_Redirection_Pdu.ToBytes C# (CSharp) Method

ToBytes() public method

public ToBytes ( ) : byte[]
return byte[]
        public override byte[] ToBytes()
        {
            List<byte> dataBuffer = new List<byte>();
            RdpbcgrEncoder.EncodeStructure(dataBuffer, shareControlHeader);
            RdpbcgrEncoder.EncodeStructure(dataBuffer, pad);
            RdpbcgrEncoder.EncodeBytes(dataBuffer, EncodeRedirectionData(serverRedirectionPdu));
            RdpbcgrEncoder.EncodeBytes(dataBuffer, pad1Octet);

            byte[] byteBuffer = RdpbcgrUtility.ToBytes(dataBuffer);

            List<byte> totalBuffer = new List<byte>();
            RdpbcgrEncoder.EncodeSlowPathPdu(totalBuffer, commonHeader, byteBuffer, serverSessionContext);

            byte[] encodedBytes = RdpbcgrUtility.ToBytes(totalBuffer);

            // ToDo: Ugly dump message code here
            // ETW Provider Dump Code
            bool isEncrypted = serverSessionContext.RdpEncryptionLevel != EncryptionLevel.ENCRYPTION_LEVEL_NONE && serverSessionContext.RdpEncryptionLevel != EncryptionLevel.ENCRYPTION_LEVEL_LOW;
            RdpbcgrUtility.ETWProviderDump(this.GetType().Name, encodedBytes, isEncrypted, byteBuffer);

            return encodedBytes;
        }