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