Exemple #1
0
 public byte[] CompressDataToRdp8BulkEncodedData(byte[] data, PACKET_COMPR_FLAG compressedFlag)
 {
     //When the length of the original uncompressed message data being sent exceeds 1,590 bytes,
     //and bulk data compression of the channel data is desired, the DYNVC_DATA_FIRST_COMPRESSED (section 2.2.3.3) PDU is sent as the first data PDU.
     if (compressedFlag == (PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED))
     {
         CompressFactory cpf = new CompressFactory(
             (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_LITE_MATCH_DISTANCE,
             (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_LITE_SEGMENT_PART_SIZE);
         return(cpf.Compress(data));
     }
     if (compressedFlag == (PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_RDP8 | PACKET_COMPR_FLAG.PACKET_COMPRESSED)
         )
     {
         CompressFactory cpf = new CompressFactory(
             (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_MATCH_DISTANCE,
             (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_SEGMENT_PART_SIZE);
         return(cpf.Compress(data));
     }
     //Otherwise, no compress
     return(data);
 }
        public byte[] CompressDataToRdp8BulkEncodedData(byte[] data, PACKET_COMPR_FLAG compressedFlag)
        {
            //When the length of the original uncompressed message data being sent exceeds 1,590 bytes,
            //and bulk data compression of the channel data is desired, the DYNVC_DATA_FIRST_COMPRESSED (section 2.2.3.3) PDU is sent as the first data PDU.
            if (compressedFlag == (PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_LITE | PACKET_COMPR_FLAG.PACKET_COMPRESSED))
            {
                CompressFactory cpf = new CompressFactory(
                   (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_LITE_MATCH_DISTANCE,
                   (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_LITE_SEGMENT_PART_SIZE);
                return cpf.Compress(data);

            }
            if (compressedFlag == (PACKET_COMPR_FLAG.PACKET_COMPR_TYPE_RDP8 | PACKET_COMPR_FLAG.PACKET_COMPRESSED)
                )
            {
                CompressFactory cpf = new CompressFactory(
                   (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_MATCH_DISTANCE,
                   (int)SEGMENT_PART_SISE.MAX_PACKET_COMPR_TYPE_RDP8_SEGMENT_PART_SIZE);
                return cpf.Compress(data);
            }
            //Otherwise, no compress
            return data;
        }