/// <summary>
        /// Generate sub header Data of BW result
        /// </summary>
        /// <param name="sequenceNumber"></param>
        /// <returns></returns>
        public byte[] GenerateSubHander_BWResult()
        {
            RDP_BW_RESULTS bwresult = RdpbcgrUtility.GenerateBandwidthMeasureResults(AUTO_DETECT_RESPONSE_TYPE.RDP_BW_RESULTS_AFTER_CONNECT, bwStopSequenceNumber, timeDelta, bandwidthMeasurePayloadByteCount);

            byte[] subHeaderbytes = RdpbcgrClient.EncodeNetworkDetectionResponse(bwresult, true);
            return(subHeaderbytes);
        }
 /// <summary>
 /// Dispose
 /// </summary>
 public void Dispose()
 {
     if (rdpbcgrClient != null)
     {
         rdpbcgrClient.Dispose();
         rdpbcgrClient = null;
     }
 }
        /// <summary>
        /// RDPBCGR Decoder Constructor
        /// </summary>
        /// <param name="rdpbcgrClient">client</param>
        /// <param name="rdpbcgrClientContext">client context</param>
        public RdpbcgrDecoder(RdpbcgrClient rdpbcgrClient, RdpbcgrClientContext rdpbcgrClientContext)
        {
            // initialize client
            client = rdpbcgrClient;

            // initialize client context
            clientContext = rdpbcgrClientContext;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="client"></param>
        /// <param name="context"></param>
        /// <param name="autoCreateChannel"></param>
        /// <param name="callBackMethodsDic"></param>
        public RdpedycClient(RdpbcgrClient client, RdpbcgrClientContext context, bool autoCreateChannel = true)
        {
            this.rdpbcgrClient        = client;
            this.clientSessionContext = context;
            transportDic = new Dictionary <DynamicVC_TransportType, IDVCTransport>();
            unprocessedDVCPacketBuffer = new List <UnprocessedDVCPDUInfo>();
            Rdpbcgr_DVCClientTransport transport = new Rdpbcgr_DVCClientTransport(context);

            channelDicbyId = new Dictionary <uint, DynamicVirtualChannel>();

            this.autoCreateChannel = autoCreateChannel;

            pduBuilder = new PduBuilder();

            transport.Received += ProcessPacketFromTCP;
            transportDic.Add(DynamicVC_TransportType.RDP_TCP, transport);
        }
        private void Initialize(Configs config)
        {
            receiveBuffer = new List <StackPacket>();
            SVCNames      = new string[] { SVCNAME_RDPEDYC };
            clientName    = config.ClientName;
            LoadConfig();

            int port;

            rdpbcgrClient = new RdpbcgrClient(
                config.ServerDomain,
                config.ServerName,
                config.ServerUserName,
                config.ServerUserPassword,
                clientAddress.ToString(),
                Int32.TryParse(config.ServerPort, out port) ? port : defaultPort
                );
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="client"></param>
        /// <param name="context"></param>
        /// <param name="autoCreateChannel"></param>
        /// <param name="callBackMethodsDic"></param>
        public RdpedycClient(RdpbcgrClient client, RdpbcgrClientContext context, bool autoCreateChannel = true, Dictionary<string, ReceiveData> callBackMethodsDic = null)
        {
            this.rdpbcgrClient = client;
            this.clientSessionContext = context;
            transportDic = new Dictionary<DynamicVC_TransportType, IDVCTransport>();
            unprocessedDVCPacketBuffer = new List<UnprocessedDVCPDUInfo>();
            Rdpbcgr_DVCClientTransport transport = new Rdpbcgr_DVCClientTransport(context);

            channelDicbyId = new Dictionary<uint, DynamicVirtualChannel>();

            this.autoCreateChannel = autoCreateChannel;
            this.callBackMethodsDic = callBackMethodsDic;

            pduBuilder = new PduBuilder();

            transport.Received += ProcessPacketFromTCP;
            transportDic.Add(DynamicVC_TransportType.RDP_TCP, transport);
        }
 /// <summary>
 /// Create a RdpbcgrClientContext to store important data.
 /// </summary>
 public RdpbcgrClientContext(RdpbcgrClient bcgrClient)
 {
     contextLock = new object();
     ClearAll();
     pduCountToUpdate = ConstValue.PDU_COUNT_TO_UPDATE_SESSION_KEY;
     this.client = bcgrClient;
     isSwitchOn = true;
     unprocessedPacketBuffer = new List<StackPacket>(); ;
 }
 public RdpeleClient(RdpbcgrClient rdpbcgrClient)
 {
     this.rdpbcgrClient = rdpbcgrClient;
 }