Beispiel #1
0
        private void DownloadAndInstallSync(NetSparkleAppCastItem item)
        {
            // get the filename of the download link
            String[] segments = item.DownloadLink.Split('/');
            String   fileName = segments[segments.Length - 1];

            // download sync
            String _tempName = Environment.ExpandEnvironmentVariables("%temp%\\" + fileName);

            // start async download
            WebClient Client = new WebClient();
            Uri       url    = new Uri(item.DownloadLink);

            Client.DownloadFile(url, _tempName);

            if (NetSparkleCheckAndInstall.CheckDSA(this, item, _tempName))
            {
                NetSparkleCheckAndInstall.Install(this, _tempName);
            }
        }
        private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            progressDownload.Visible      = false;
            btnInstallAndReLaunch.Visible = true;

            // report message
            _sparkle.ReportDiagnosticMessage("Finished downloading file to: " + _tempName);

            if (!NetSparkleCheckAndInstall.CheckDSA(_sparkle, _item, _tempName))
            {
                Size = new Size(Size.Width, 137);
                lblSecurityHint.Visible = true;
                BackColor = Color.Tomato;
            }

            // Check the unattended mode
            if (_unattend)
            {
                btnInstallAndReLaunch_Click(null, null);
            }
        }
 private void btnInstallAndReLaunch_Click(object sender, EventArgs e)
 {
     NetSparkleCheckAndInstall.Install(_sparkle, _tempName);
 }