public void StartRecording(string recordMode, string userAgent, bool isHttp2)
        {
            _recordStarted = true;
            StartRecordingParamsBuilder startRecordingPB = new StartRecordingParamsBuilder();

            HandleUserPathName(startRecordingPB);

            bool isSap = recordMode.ToLower().Contains("sap");

            startRecordingPB.isSapGuiProtocol(isSap);
            startRecordingPB.isHTTP2Protocol(isHttp2);
            if (userAgent != null && !userAgent.Equals(""))
            {
                startRecordingPB.userAgent(userAgent);
            }

            try
            {
                _client.StartRecording(startRecordingPB.Build());
            }
            catch (Exception e)
            {
                _recordStarted = false;
                throw e;
            }
        }
        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
            }
        }
        public void start()
        {
            if (projectPath != null)
            {
                openProject();
            }

            this.userPathExist = containsUserPath();

            StartRecordingParamsBuilder startRecordingBuilder = paramBuilderProvider.newStartRecordingBuilder();

            if (!userPathExist)
            {
                startRecordingBuilder.virtualUser(userPathName);
            }
            else
            {
                startRecordingBuilder.virtualUser(userPathName + "_recording");
            }

            designApiClient.StartRecording(startRecordingBuilder.Build());
        }
 private void HandleUserPathName(StartRecordingParamsBuilder startRecordingPB)
 {
     if (_userPathName != null && _userPathName.Length != 0)
     {
         if (_updateUserPath)
         {
             ContainsUserPathParamsBuilder _containsBuilder = new ContainsUserPathParamsBuilder();
             _containsBuilder.name(_userPathName);
             _userPathExist = _client.ContainsUserPath(_containsBuilder.Build());
             if (_userPathExist)
             {
                 startRecordingPB.virtualUser(_userPathName + "_recording");
             }
             else
             {
                 startRecordingPB.virtualUser(_userPathName);
             }
         }
         else
         {
             startRecordingPB.virtualUser(_userPathName);
         }
     }
 }