/// <summary> /// Parse TS_BITMAPCACHE_PERSISTENT_LIST_PDU /// (parser index is updated according to parsed length) /// </summary> /// <param name="data">data to be parsed</param> /// <param name="currentIndex">current parser index</param> /// <returns>TS_BITMAPCACHE_PERSISTENT_LIST_PDU</returns> private TS_BITMAPCACHE_PERSISTENT_LIST_PDU ParseTsPersistentListPdu(byte[] data, ref int currentIndex) { TS_BITMAPCACHE_PERSISTENT_LIST_PDU pdu = new TS_BITMAPCACHE_PERSISTENT_LIST_PDU(); // TS_CONTROL_PDU: shareDataHeader pdu.shareDataHeader = ParseTsShareDataHeader(data, ref currentIndex); pdu.numEntriesCache0 = ParseUInt16(data, ref currentIndex, false); pdu.numEntriesCache1 = ParseUInt16(data, ref currentIndex, false); pdu.numEntriesCache2 = ParseUInt16(data, ref currentIndex, false); pdu.numEntriesCache3 = ParseUInt16(data, ref currentIndex, false); pdu.numEntriesCache4 = ParseUInt16(data, ref currentIndex, false); pdu.totalEntriesCache0 = ParseUInt16(data, ref currentIndex, false); pdu.totalEntriesCache1 = ParseUInt16(data, ref currentIndex, false); pdu.totalEntriesCache2 = ParseUInt16(data, ref currentIndex, false); pdu.totalEntriesCache3 = ParseUInt16(data, ref currentIndex, false); pdu.totalEntriesCache4 = ParseUInt16(data, ref currentIndex, false); pdu.bBitMask = (bBitMask_Values)ParseByte(data, ref currentIndex); pdu.Pad2 = ParseByte(data, ref currentIndex); pdu.Pad3 = ParseUInt16(data, ref currentIndex, false); pdu.entries = new List<TS_BITMAPCACHE_PERSISTENT_LIST_ENTRY>(); while (currentIndex < data.Length) { pdu.entries.Add(ParseEntry(data, ref currentIndex)); } return pdu; }
/// <summary> /// Encode controlPduData field. /// </summary> /// <param name="persistentKeyListPduData">The data to be encoded.</param> /// <returns>The encoded data.</returns> private static byte[] EncodePersistentKeyListData(TS_BITMAPCACHE_PERSISTENT_LIST_PDU persistentKeyListPduData) { List<byte> dataBuffer = new List<byte>(); if (persistentKeyListPduData != null) { RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.shareDataHeader); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.numEntriesCache0); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.numEntriesCache1); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.numEntriesCache2); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.numEntriesCache3); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.numEntriesCache4); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.totalEntriesCache0); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.totalEntriesCache1); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.totalEntriesCache2); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.totalEntriesCache3); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.totalEntriesCache4); RdpbcgrEncoder.EncodeStructure(dataBuffer, (byte)persistentKeyListPduData.bBitMask); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.Pad2); RdpbcgrEncoder.EncodeStructure(dataBuffer, persistentKeyListPduData.Pad3); foreach (TS_BITMAPCACHE_PERSISTENT_LIST_ENTRY entry in persistentKeyListPduData.entries) { RdpbcgrEncoder.EncodeStructure(dataBuffer, entry); } } return dataBuffer.ToArray(); }