Esempio n. 1
0
 /// <summary>
 /// Send a RDPEDISP Pdu
 /// </summary>
 /// <param name="pdu"></param>
 public void SendRdpedispPdu(RdpedispPdu pdu)
 {
     byte[] data = PduMarshaler.Marshal(pdu);
     if (RdpedispDVC == null)
     {
         throw new InvalidOperationException("DVC instance of RDPEDISP is null, Dynamic virtual channel must be created before sending data.");
     }
     RdpedispDVC.Send(data);
 }
Esempio n. 2
0
 /// <summary>
 /// The callback method to receive data from transport layer.
 /// </summary>
 private void OnDataReceived(byte[] data, uint channelID)
 {
     lock (receivedList)
     {
         RdpedispPdu basePDU  = new RdpedispPdu();
         bool        fSucceed = false;
         bool        fResult  = PduMarshaler.Unmarshal(data, basePDU);
         if (fResult)
         {
             byte[] pduData = new byte[basePDU.Header.Length];
             Array.Copy(data, pduData, basePDU.Header.Length);
             if (basePDU.Header.Type == PDUTypeValues.DISPLAYCONTROL_PDU_TYPE_CAPS)
             {
                 DISPLAYCONTROL_CAPS_PDU capsPDU = new DISPLAYCONTROL_CAPS_PDU();
                 try
                 {
                     fSucceed = PduMarshaler.Unmarshal(pduData, capsPDU);
                     receivedList.Add(capsPDU);
                 }
                 catch (PDUDecodeException decodeException)
                 {
                     RdpedispUnkownPdu unkonw = new RdpedispUnkownPdu();
                     fSucceed = PduMarshaler.Unmarshal(decodeException.DecodingData, unkonw);
                     receivedList.Add(unkonw);
                 }
             }
             else if (basePDU.Header.Type == PDUTypeValues.DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT)
             {
                 DISPLAYCONTROL_MONITOR_LAYOUT_PDU monitorLayoutPDU = new DISPLAYCONTROL_MONITOR_LAYOUT_PDU();
                 try
                 {
                     fSucceed = PduMarshaler.Unmarshal(pduData, monitorLayoutPDU);
                     receivedList.Add(monitorLayoutPDU);
                 }
                 catch (PDUDecodeException decodeException)
                 {
                     RdpedispUnkownPdu unkonw = new RdpedispUnkownPdu();
                     fSucceed = PduMarshaler.Unmarshal(decodeException.DecodingData, unkonw);
                     receivedList.Add(unkonw);
                 }
             }
             else
             {
                 RdpedispUnkownPdu unkonw = new RdpedispUnkownPdu();
                 fSucceed = PduMarshaler.Unmarshal(pduData, unkonw);
                 receivedList.Add(unkonw);
             }
         }
         if (!fSucceed || !fResult)
         {
             RdpedispUnkownPdu unkonw = new RdpedispUnkownPdu();
             fSucceed = PduMarshaler.Unmarshal(data, unkonw);
             receivedList.Add(unkonw);
         }
     }
 }