private void DownloadUpdateDialogLoad(object sender, EventArgs e) { _webClient = new MyWebClient { CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore) }; if (AutoUpdater.Proxy != null) { _webClient.Proxy = AutoUpdater.Proxy; } var uri = new Uri(_downloadURL); _tempFile = string.IsNullOrEmpty(AutoUpdater.DownloadPath) ? Path.GetTempFileName() : Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
internal void Start() { _webClient = new MyWebClient { CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore) }; if (AutoUpdater.Proxy != null) { _webClient.Proxy = AutoUpdater.Proxy; } var uri = new Uri(_downloadURL); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
private void DownloadUpdateDialogLoad(object sender, EventArgs e) { var uri = new Uri(_args.DownloadURL); _webClient = AutoUpdater.GetWebClient(uri, AutoUpdater.BasicAuthDownload); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
private void ButtonUpdateClick(object sender, EventArgs e) { webBrowser.Size = new Size(723, 323); labelInformation.Show(); pictureBox1.Show(); labelfilesize.Show(); labelspeed.Show(); labelPerc.Show(); progressBar.Show(); var uri = new Uri(_args.DownloadURL); _webClient = AutoUpdater.GetWebClient(uri, AutoUpdater.BasicAuthDownload); _tempFile = Path.Combine(exePath + AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(exePath + AutoUpdater.DownloadPath)) { Directory.CreateDirectory(exePath + AutoUpdater.DownloadPath); } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); sw.Start(); labelInformation.Text = "Downloading in... " + _tempFile; progressBar.Cursor = Cursors.WaitCursor; }
private void DownloadUpdateDialogLoad(object sender, EventArgs e) { if (AutoUpdater.DelayOpenDownloadDialog > 0) { this.Hide(); this.Opacity = 0; m_timerDelayOpenDlg = new Timer(); m_timerDelayOpenDlg.Interval = AutoUpdater.DelayOpenDownloadDialog; m_timerDelayOpenDlg.Tick += (sender1, args1) => { this.Show(); AutoUpdater.DelayOpenDownloadDialog = 0; }; m_timerDelayOpenDlg.Start(); } _webClient = new MyWebClient { CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore) }; AutoUpdater.DoWebClientInitialization(_webClient); if (AutoUpdater.Proxy != null) { _webClient.Proxy = AutoUpdater.Proxy; } var uri = new Uri(_downloadURL); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } if (AutoUpdater.BasicAuthDownload != null) { _webClient.Headers[HttpRequestHeader.Authorization] = AutoUpdater.BasicAuthDownload.ToString(); } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
private void DownloadUpdateDialogLoad(object sender, EventArgs e) { var uri = new Uri(_downloadURL); if (uri.Scheme.Equals(Uri.UriSchemeFtp)) { _webClient = new MyWebClient { Credentials = AutoUpdater.FtpCredentials }; } else { _webClient = new MyWebClient(); if (uri.Scheme.Equals(Uri.UriSchemeHttp) || uri.Scheme.Equals(Uri.UriSchemeHttps)) { if (AutoUpdater.BasicAuthDownload != null) { // Apply Authentication AutoUpdater.BasicAuthDownload.Apply(uri, _webClient.Headers); } _webClient.Headers[HttpRequestHeader.UserAgent] = AutoUpdater.GetUserAgent(); } } _webClient.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); if (AutoUpdater.Proxy != null) { _webClient.Proxy = AutoUpdater.Proxy; } if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
private void DownloadUpdateDialogLoad(object sender, EventArgs e) { _webClient = new MyWebClient { CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore) }; if (AutoUpdater.Proxy != null) { _webClient.Proxy = AutoUpdater.Proxy; } var uri = new Uri(_downloadURL); if (string.IsNullOrEmpty(AutoUpdater.DownloadPath)) { _tempFile = Path.GetTempFileName(); } else { _tempFile = Path.Combine(AutoUpdater.DownloadPath, $"{Guid.NewGuid().ToString()}.tmp"); if (!Directory.Exists(AutoUpdater.DownloadPath)) { Directory.CreateDirectory(AutoUpdater.DownloadPath); } } // Assign Credentials var credentialCache = new CredentialCache(); credentialCache.Add(uri, // request url's host "Basic", // authentication type. hopefully they don't change it. AutoUpdater.Credential); // credentials _webClient.UseDefaultCredentials = true; _webClient.Credentials = credentialCache; _webClient.DownloadProgressChanged += OnDownloadProgressChanged; _webClient.DownloadFileCompleted += WebClientOnDownloadFileCompleted; _webClient.DownloadFileAsync(uri, _tempFile); }
public void DownloadFileAsync() { _webClient.DownloadFileAsync(uri, _tempFile); }