Beispiel #1
0
        /// <summary>
        /// Button clicked to update plugins.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        private void btnupdateplugins_Click(object sender, EventArgs e)
        {
            this.btnUpdatePlugins.Enabled    = false;
            this.updatedplugins              = new List <int>();
            this.frmdownloader               = new FrmDownloader(Strings.T("Updating plugins.."));
            this.chxlbxPluginUpdates.Enabled = false;
            for (int i = 0; i < this.chxlbxPluginUpdates.Items.Count; i++)
            {
                if (this.chxlbxPluginUpdates.GetItemChecked(i))
                {
                    // checked for update plugin
                    if (this.updatableplugins[i] == null)
                    {
                        continue;
                    }

                    this.updatedplugins.Add(i);
                }
            }

            this.frmdownloader.Show();
            this.frmdownloader.AllDownloadsCompleted += new FrmDownloader.DownloadCompleetHandler(this.DownloadUpdatesPluginsCompleet);
            string[] alldownloadurls = this.GetAllDownloadUrls(updatedplugins.ToArray());
            this.frmdownloader.BeginDownload(alldownloadurls, Program.GetNewPluginFolder(true));
        }
Beispiel #2
0
        /// <summary>
        /// Compare the latest version and this programme version,
        /// if this is a old release ask to update.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">RunWorkerCompleted event arguments</param>
        private static void UpdateCompareVersion(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            string response = (string)e.Result;

            short[] thisversion          = GetVersion();
            string  downloadurl          = string.Empty;
            string  rsasignature         = string.Empty;
            string  latestversionquality = string.Empty;

            short[] latestversion = xmlUtil.ParserLatestVersion(response, out latestversionquality, out downloadurl, out rsasignature);
            Program.updateprogramrsasignature = rsasignature;

            int compareversionsresult = Program.CompareVersions(latestversion, thisversion);

            if (compareversionsresult > 0 || (compareversionsresult == 0 && Program.AssemblyVersionQuality != latestversionquality))
            {
                Log.Write(LogType.info, "Update check done. New version available.");
                if (!string.IsNullOrEmpty(downloadurl))
                {
                    StringBuilder sbmsg = new StringBuilder();
                    sbmsg.AppendLine(Strings.T("There's a new version of {0} available.", Program.AssemblyTitle));
                    sbmsg.Append(Strings.T("Your version: "));
                    sbmsg.AppendLine(Program.AssemblyVersionAsString + " " + Program.AssemblyVersionQuality);
                    sbmsg.Append(Strings.T("New version: "));
                    sbmsg.AppendLine(latestversion[0] + "." + latestversion[1] + "." + latestversion[2] + " " + latestversionquality);
                    sbmsg.Append(Strings.T("Do you want to download and install the new version now?"));
                    System.Windows.Forms.DialogResult updres = System.Windows.Forms.MessageBox.Show(sbmsg.ToString(), Strings.T("update available"), System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk);
                    if (updres == System.Windows.Forms.DialogResult.Yes)
                    {
                        FrmDownloader frmdownloader = new FrmDownloader(string.Format(Strings.T("Downloading {0} update"), Program.AssemblyTitle));
                        frmdownloader.AllDownloadsCompleted += new FrmDownloader.DownloadCompleetHandler(frmupdater_DownloadCompleetSuccesfull);
                        frmdownloader.Show();
                        if (Settings.UpdatecheckUseGPG)
                        {
                            string[] downloads = new string[2];
                            downloads[0] = downloadurl;
                            downloads[1] = downloadurl + GPGVerifyWrapper.GPGSIGNATUREEXTENSION;
                            frmdownloader.BeginDownload(downloads, Program.GetTempFolder());
                        }
                        else
                        {
                            frmdownloader.BeginDownload(downloadurl, Program.GetTempFolder());
                        }
                    }
                }
                else
                {
                    string networkerrortitle = Strings.T("Network error");
                    string downloadurlunset  = Strings.T("Downloadurl is of new vesion is not set.");
                    Log.Write(LogType.exception, downloadurlunset);
                    System.Windows.Forms.MessageBox.Show(downloadurlunset, networkerrortitle, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }
            }
            else
            {
                Log.Write(LogType.info, "Update check done. You have the latest version.");
            }
        }
Beispiel #3
0
 /// <summary>
 /// Start download of plugin.
 /// </summary>
 /// <param name="sender">Sender object</param>
 /// <param name="e">Event arguments</param>
 private void btnPluginDownload_Click(object sender, EventArgs e)
 {
     if (this.selectedplugindetails != null)
     {
         this.frmdownloader = new FrmDownloader(Strings.T("Downloading plugin.."));
         this.frmdownloader.AllDownloadsCompleted += new FrmDownloader.DownloadCompleetHandler(this.downloader_DownloadCompleet);
         this.frmdownloader.Show();
         this.frmdownloader.BeginDownload(this.selectedplugindetails.DownloadUrl, Settings.ProgramPluginsFolder);
     }
 }