public async ValueTask <bool> TryCreateAndInject(string exePath, CancellationToken token = default) { if (string.IsNullOrEmpty(exePath)) { return(false); } if (!_hookLifetime.IsHookApplicationStarted) { _hookLifetime.Start(); } var response = await _client.PutAsync(_createAndInjectRoute + exePath, new StringContent(_injectionSettings, Encoding.UTF8, _mediaType), token); return(response.IsSuccessStatusCode); }
public async Task StartAsync(CancellationToken token) { if (_options.OpenHookOnStartup && string.IsNullOrWhiteSpace(_options.InjectToExeOnStartup)) { _hookLifetime.Start(_isProduction); return; } // this method will triggers hook startup await _socketHookService.TryCreateAndInject(_options.InjectToExeOnStartup, token); }