private async void Update(IWebProxy proxy, int timeout, string url, string userAgent) { try { FreeNodeResult = await AutoGetAsync(url, proxy, userAgent, timeout); } catch (Exception ex) { Logging.Debug(ex.ToString()); } NewFreeNodeFound?.Invoke(this, new EventArgs()); }
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //if(timerDownloadStringAsyncTimeout.Enabled) timerDownloadStringAsyncTimeout.Stop(); try { string response = e.Result; FreeNodeResult = response; //UpdateSubscribeManager.countnum += 1; if (trieduseproxy) { trieduseproxy = false; } //http.Dispose(); //if (NewFreeNodeFound != null) //{ // NewFreeNodeFound(this, new EventArgs()); //} } catch (Exception ex) { if (_config.nodeFeedAutoUpdateTryUseProxy && http.Proxy == null && !trieduseproxy) { trieduseproxy = true; NewFreeNodeFound?.Invoke(this, new EventArgs()); return; } trieduseproxy = false; //countnum += 1; //countfailurenum += 1; if (e.Error != null) { Logging.Debug(e.Error.ToString()); } Logging.Debug(ex.ToString()); //recordfailure(); //http.Dispose(); //if (NewFreeNodeFound != null) //{ // NewFreeNodeFound(this, new EventArgs()); //} //return; } NewFreeNodeFound?.Invoke(this, new EventArgs()); }
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { try { var response = e.Result; FreeNodeResult = response; NewFreeNodeFound?.Invoke(this, new EventArgs()); } catch (Exception ex) { if (e.Error != null) { Logging.Debug(e.Error.ToString()); } Logging.Debug(ex.ToString()); NewFreeNodeFound?.Invoke(this, new EventArgs()); } }
private async void Update(HttpRequestProxyType proxyType, IWebProxy proxy, int timeout, string url, string userAgent) { try { FreeNodeResult = proxyType switch { HttpRequestProxyType.Auto => await AutoGetAsync(url, proxy, userAgent, timeout), HttpRequestProxyType.Direct => await DirectGetAsync(url, userAgent, timeout), HttpRequestProxyType.Proxy => await ProxyGetAsync(url, proxy, userAgent, timeout), HttpRequestProxyType.SystemSetting => await DefaultGetAsync(url, userAgent, timeout), _ => await AutoGetAsync(url, proxy, userAgent, timeout) }; } catch (Exception ex) { Logging.Debug(ex.ToString()); } NewFreeNodeFound?.Invoke(this, new EventArgs()); }
private async void Update(IWebProxy proxy, string url, string userAgent) { try { FreeNodeResult = await Get(url, proxy, userAgent); } catch { try { FreeNodeResult = await Get(url, null, userAgent); } catch (Exception ex) { Logging.Debug(ex.ToString()); } } NewFreeNodeFound?.Invoke(this, new EventArgs()); }
private async void Update(IWebProxy proxy, int timeout, string url, string userAgent) { try { if (await HeadAsync(url, proxy, timeout)) { Logging.Info($@"Update Nodes from {url} by proxy."); FreeNodeResult = await GetAsync(url, proxy, userAgent); } else { Logging.Info($@"Update Nodes from {url} directly."); FreeNodeResult = await GetAsync(url, null, userAgent); } } catch (Exception ex) { Logging.Debug(ex.ToString()); } NewFreeNodeFound?.Invoke(this, new EventArgs()); }
private void thInvokeNewFeedNodeFound(object _obj) { NewFreeNodeFound?.Invoke(_obj, new EventArgs()); }