/// <summary> /// Parse TS_UPDATE_SYNC /// </summary> /// <param name="updateData">update data (decompressed if were compressed)</param> /// <param name="shareDataHeader">share data header</param> /// <returns>TS_UPDATE_SYNC</returns> private TS_UPDATE_SYNC ParseTsUpdateSyncPduData( byte[] updateData, TS_SHAREDATAHEADER shareDataHeader) { // index of update data int index = 0; TS_UPDATE_SYNC pduData = new TS_UPDATE_SYNC(); // TS_UPDATE_SYNC: shareDataHeader pduData.shareDataHeader = shareDataHeader; // TS_UPDATE_SYNC: updateType pduData.updateType = ParseUInt16(updateData, ref index, false); // TS_UPDATE_SYNC: pad2Octets pduData.pad2Octets = ParseUInt16(updateData, ref index, false); // Check if data length exceeded expectation VerifyDataLength(updateData.Length, index, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED); return pduData; }
private byte[] EncodeSync(TS_UPDATE_SYNC syncData) { List<byte> totalBuffer = new List<byte>(); RdpbcgrEncoder.EncodeStructure(totalBuffer, syncData.shareDataHeader); List<byte> buffer = new List<byte>(); RdpbcgrEncoder.EncodeStructure(buffer, (ushort)syncData.updateType); RdpbcgrEncoder.EncodeStructure(buffer, syncData.pad2Octets); if (syncData.shareDataHeader.compressedType != compressedType_Values.None) { RdpbcgrEncoder.EncodeBytes( totalBuffer, serverSessionContext.Compress(syncData.shareDataHeader.compressedType, buffer.ToArray())); } else { RdpbcgrEncoder.EncodeBytes(totalBuffer, buffer.ToArray()); } return totalBuffer.ToArray(); }