/// <summary> /// Decode Monitor Layout PDU /// </summary> /// <param name="data">data to be parsed</param> /// <param name="decryptedUserData">decrypted user data to be parsed</param> /// <param name="type">security header type</param> /// <returns>decoded Monitor Layout PDU</returns> public StackPacket DecodeMonitorLayoutPDU( byte[] data, byte[] decryptedUserData, SecurityHeaderType type) { TS_MONITOR_LAYOUT_PDU pdu = new TS_MONITOR_LAYOUT_PDU(); // data index int dataIndex = 0; // TS_MONITOR_LAYOUT_PDU: commonHeader pdu.commonHeader = ParseMcsCommonHeader(data, ref dataIndex, type); // user data index int userDataIndex = 0; // TS_MONITOR_LAYOUT_PDU: shareDataHeader pdu.shareDataHeader = ParseTsShareDataHeader(decryptedUserData, ref userDataIndex); // TS_MONITOR_LAYOUT_PDU: monitorCount pdu.monitorCount = ParseUInt32(decryptedUserData, ref userDataIndex, false); // TS_MONITOR_LAYOUT_PDU: monitorDefArray pdu.monitorDefArray = new TS_MONITOR_DEF[pdu.monitorCount]; for (int i = 0; i < pdu.monitorDefArray.Length; i++) { pdu.monitorDefArray[i] = ParseTsMonitorDef(decryptedUserData, ref userDataIndex); } // Check if data length exceeded expectation VerifyDataLength(decryptedUserData.Length, userDataIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED); return pdu; }
/// <summary> /// Create an instance of the class that is identical to the current PDU. /// </summary> /// <returns>The new instance.</returns> public override StackPacket Clone() { TS_MONITOR_LAYOUT_PDU cloneMonitorLayoutpdu = new TS_MONITOR_LAYOUT_PDU(); cloneMonitorLayoutpdu.commonHeader = commonHeader.Clone(); cloneMonitorLayoutpdu.shareDataHeader = shareDataHeader; cloneMonitorLayoutpdu.monitorCount = monitorCount; if (monitorDefArray != null) { cloneMonitorLayoutpdu.monitorDefArray = (TS_MONITOR_DEF[])monitorDefArray.Clone(); } return cloneMonitorLayoutpdu; }