/// <summary> /// Parse TS_REFRESH_RECT_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_REFRESH_RECT_PDU</returns> private TS_REFRESH_RECT_PDU ParseTsRefreshRectPdu(byte[] data, ref int currentIndex) { TS_REFRESH_RECT_PDU pdu = new TS_REFRESH_RECT_PDU(); pdu.shareDataHeader = ParseTsShareDataHeader(data, ref currentIndex); pdu.numberOfAreas = ParseByte(data, ref currentIndex); pdu.pad3Octects = GetBytes(data, ref currentIndex, 3); pdu.areasToRefresh = new Collection<TS_RECTANGLE16>(); for (int i = 0; i < pdu.numberOfAreas; ++i) { pdu.areasToRefresh.Add(ParseInclusiveRect(data, ref currentIndex)); } return pdu; }
/// <summary> /// Encode refreshRectPduData field. /// </summary> /// <param name="refreshRectPduData">The data to be encoded.</param> /// <returns>The encoded data.</returns> private static byte[] EncodeRefreshData(TS_REFRESH_RECT_PDU refreshRectPduData) { List<byte> refreshRectBuffer = new List<byte>(); RdpbcgrEncoder.EncodeStructure(refreshRectBuffer, refreshRectPduData.shareDataHeader); RdpbcgrEncoder.EncodeStructure(refreshRectBuffer, refreshRectPduData.numberOfAreas); RdpbcgrEncoder.EncodeBytes(refreshRectBuffer, refreshRectPduData.pad3Octects); if (refreshRectPduData.areasToRefresh != null) { foreach (TS_RECTANGLE16 reshArea in refreshRectPduData.areasToRefresh) { RdpbcgrEncoder.EncodeStructure(refreshRectBuffer, reshArea); } } return refreshRectBuffer.ToArray(); }