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

ToBytes() public method

public ToBytes ( ) : byte[]
return byte[]
        public override byte[] ToBytes()
        {
            List<byte> dataList = new List<byte>();
            RdpbcgrEncoder.EncodeStructure(dataList, (byte)preamble.bMsgType);
            RdpbcgrEncoder.EncodeStructure(dataList, (byte)preamble.bVersion);
            RdpbcgrEncoder.EncodeStructure(dataList, preamble.wMsgSize);
            RdpbcgrEncoder.EncodeStructure(dataList, (uint)validClientMessage.dwErrorCode);
            RdpbcgrEncoder.EncodeStructure(dataList, (uint)validClientMessage.dwStateTransition);
            RdpbcgrEncoder.EncodeStructure(dataList, (ushort)validClientMessage.bbErrorInfo.wBlobType);
            RdpbcgrEncoder.EncodeStructure(dataList, validClientMessage.bbErrorInfo.wBlobLen);
            RdpbcgrEncoder.EncodeBytes(dataList, validClientMessage.bbErrorInfo.blobData);

            byte[] dataBuffer = dataList.ToArray();

            List<byte> totalBuffer = new List<byte>();
            RdpbcgrEncoder.EncodeSlowPathPdu(totalBuffer, commonHeader, dataBuffer, 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, dataBuffer);

            return encodedBytes;
        }