The TS_FP_UPDATE_PALETTE structure is the fast-path variant of the TS_UPDATE_PALETTE_PDU_DATA structure.
file:///C:/ts_dev/TestSuites/MS-RDPBCGR/TestSuite/Src/TD/latest_XMLS_16may/RDPBCGR/ _rfc_ms-rdpbcgr2_1_8_1_2_1_1.xml
Наследование: TS_FP_UPDATE
        /// <summary>
        /// Parse TS_FP_UPDATE_PALETTE
        /// </summary>
        /// <param name="updateHeader">update header</param>
        /// <param name="compressionFlags">compression flags</param>
        /// <param name="size">update data size(before decompression)</param>
        /// <param name="updateData">update data(decompressed)</param>
        /// <returns>TS_FP_UPDATE_PALETTE</returns>
        private TS_FP_UPDATE_PALETTE ParseTsFpUpdatePalette(
            byte updateHeader,
            compressedType_Values compressionFlags,
            UInt16 size,
            byte[] updateData)
        {
            TS_FP_UPDATE_PALETTE palette = new TS_FP_UPDATE_PALETTE();

            // TS_FP_UPDATE_PALETTE: updateHeader
            palette.updateHeader = updateHeader;

            // TS_FP_UPDATE_PALETTE: compressionFlags
            palette.compressionFlags = compressionFlags;

            // TS_FP_UPDATE_PALETTE: size
            palette.size = size;

            // TS_FP_UPDATE_PALETTE: paletteUpdateData
            int index = 0;
            palette.paletteUpdateData = ParseTsUpdatePaletteData(updateData, ref index);

            // Check if data length exceeded expectation
            VerifyDataLength(updateData.Length, index, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
            return palette;
        }
Пример #2
0
        private byte[] EncodePalette(TS_FP_UPDATE_PALETTE paletteData)
        {
            List<byte> totalBuffer = new List<byte>();

            List<byte> buffer = new List<byte>();
            RdpbcgrEncoder.EncodeStructure(buffer, (ushort)paletteData.paletteUpdateData.updateType);
            RdpbcgrEncoder.EncodeStructure(buffer, paletteData.paletteUpdateData.pad2Octets);
            RdpbcgrEncoder.EncodeStructure(buffer, paletteData.paletteUpdateData.numberColors);
            if (paletteData.paletteUpdateData.paletteEntries != null)
            {
                for (int i = 0; i < paletteData.paletteUpdateData.paletteEntries.Length; ++i)
                {
                    RdpbcgrEncoder.EncodeStructure(buffer, paletteData.paletteUpdateData.paletteEntries[i].red);
                    RdpbcgrEncoder.EncodeStructure(buffer, paletteData.paletteUpdateData.paletteEntries[i].green);
                    RdpbcgrEncoder.EncodeStructure(buffer, paletteData.paletteUpdateData.paletteEntries[i].blue);
                }
            }

            if (paletteData.compressionFlags != compressedType_Values.None)
            {
                RdpbcgrEncoder.EncodeBytes(
                    totalBuffer, serverSessionContext.Compress(paletteData.compressionFlags, buffer.ToArray()));
            }
            else
            {
                RdpbcgrEncoder.EncodeBytes(totalBuffer, buffer.ToArray());
            }
            return totalBuffer.ToArray();
        }