public void StopRecording() { StopRecordingParamsBuilder _stopRecordingBuilder = new StopRecordingParamsBuilder(); if (_userPathExist) { UpdateUserPathParamsBuilder _updateUserPathBuilder = new UpdateUserPathParamsBuilder(); _updateUserPathBuilder.name(_userPathName); _updateUserPathBuilder.deleteRecording(true); _stopRecordingBuilder.updateParams(_updateUserPathBuilder.Build()); } try { _client.StopRecording(_stopRecordingBuilder.Build()); _client.SaveProject(); if (_systemProxyHelper != null) { _systemProxyHelper.restoreProxy(); } } finally { _recordStarted = false; _instance = null; _systemProxyHelper = null; } }
public void StartRecording(Protocol protocol) { _recordStarted = true; try { StartRecordingParamsBuilder _startRecordingPB = new StartRecordingParamsBuilder(); if (_userPathName != null && _userPathName.Length != 0) { ContainsUserPathParamsBuilder _containsBuilder = new ContainsUserPathParamsBuilder(); _containsBuilder.name(_userPathName); _userPathExist = _client.ContainsUserPath(_containsBuilder.Build()); if (_userPathExist) { _startRecordingPB.virtualUser(_userPathName + "_recording"); } else { _startRecordingPB.virtualUser(_userPathName); } } if (Protocol.SAP.Equals(protocol)) { _startRecordingPB.isSapGuiProtocol(true); _startRecordingPB.isCreateTransactionBySapTCode(_createTransactionBySapTCode); } else if (Protocol.WEB.Equals(protocol)) { _startRecordingPB.isHTTP2Protocol(_http2); if (_systemProxyHelper == null) { _systemProxyHelper = new SystemProxyHelper(_apiPort); _systemProxyHelper.setProxy(_apiHost, _recorderProxyPort, ""); } } _client.StartRecording(_startRecordingPB.Build()); } catch (Exception e) { _recordStarted = false; _instance = null; _systemProxyHelper = null; WriteExceptionToFile(e); throw e; } try { NeoloadRestApiInstance.GetInstance().SendUsageEvent("recording", protocol); } catch (Exception e) { // Do nothing if send event fails } }