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

ToBytes() public method

Encode this structure into byte array.
public ToBytes ( ) : byte[]
return byte[]
        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();
        }