protected virtual T GetResponse <T>(string requestUrl) where T : class { if (requestUrl == null) { throw new ArgumentNullException(nameof(requestUrl)); } var json = _apiWebClient.DownloadString(requestUrl); if (TryGetResult(json, out var result)) { var reader = result.CreateReader(); return(Serializer.Deserialize <T>(reader)); } return(default(T)); }
private void ReadSession() { while (_running) { try { var json = _webClient.DownloadString(_sessionUrl); if (json != null && json.Length > 0) { lock (sessionJsonLock) { sessionJson = json; } } } catch (Exception e) { FetchError?.Invoke(this, e); } } }