コード例 #1
0
        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);
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 private void Init()
 {
     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.DownloadFileCompleted += WebClientOnDownloadFileCompleted;
 }