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()); }
public ServerSubscribe() { _url = UpdateNode.DefaultUpdateUrl; _autoCheckUpdate = true; _proxyType = HttpRequestProxyType.Auto; }