/// <summary> /// Parse TS_SAVE_SESSION_INFO_PDU_DATA /// (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_SAVE_SESSION_INFO_PDU_DATA</returns> private TS_SAVE_SESSION_INFO_PDU_DATA ParseTsSaveSessionInfoPduData(byte[] data, ref int currentIndex) { TS_SAVE_SESSION_INFO_PDU_DATA pdu = new TS_SAVE_SESSION_INFO_PDU_DATA(); // TS_SAVE_SESSION_INFO_PDU_DATA: shareDataHeader pdu.shareDataHeader = ParseTsShareDataHeader(data, ref currentIndex); // TS_SAVE_SESSION_INFO_PDU_DATA: infoType pdu.infoType = (infoType_Values)ParseUInt32(data, ref currentIndex, false); // TS_SAVE_SESSION_INFO_PDU_DATA: infoData pdu.infoData = ParseInfoData(data, ref currentIndex, pdu.infoType); return pdu; }
private byte[] EncodeSaveSessionInfoData(TS_SAVE_SESSION_INFO_PDU_DATA saveSessionInfoPduData) { List<byte> dataBuffer = new List<byte>(); RdpbcgrEncoder.EncodeStructure(dataBuffer, saveSessionInfoPduData.shareDataHeader); RdpbcgrEncoder.EncodeStructure(dataBuffer, (uint)saveSessionInfoPduData.infoType); switch (saveSessionInfoPduData.infoType) { case infoType_Values.INFOTYPE_LOGON: RdpbcgrEncoder.EncodeBytes(dataBuffer, EncodeLogonInfo((TS_LOGON_INFO)saveSessionInfoPduData.infoData)); break; case infoType_Values.INFOTYPE_LOGON_LONG: RdpbcgrEncoder.EncodeBytes(dataBuffer, EncodeLogonLongInfo((TS_LOGON_INFO_VERSION_2)saveSessionInfoPduData.infoData)); break; case infoType_Values.INFOTYPE_LOGON_EXTENDED_INF: RdpbcgrEncoder.EncodeBytes(dataBuffer, EncodeLogonExtended((TS_LOGON_INFO_EXTENDED)saveSessionInfoPduData.infoData)); break; case infoType_Values.INFOTYPE_LOGON_PLAINNOTIFY: RdpbcgrEncoder.EncodeBytes(dataBuffer, EncodeLogonPlainNotify((TS_PLAIN_NOTIFY)saveSessionInfoPduData.infoData)); break; } return dataBuffer.ToArray(); }