public QubedotUpdateLocalAppInfo(QubedotUpdateXml job)
 {
     ApplicationPath     = job.FilePath;
     ApplicationName     = Path.GetFileNameWithoutExtension(ApplicationPath);
     ApplicationAssembly = (job.Tag == JobType.UPDATE) ? Assembly.Load(ApplicationName) : null;
     ApplicationIcon     = null;
     Context             = null;
     Version             = (job.Tag == JobType.UPDATE) ? ApplicationAssembly.GetName().Version : job.Version;
     Tag = job.Tag;
 }
 public QubedotUpdateLocalAppInfo(QubedotUpdateXml job, Assembly ass, Form f)
 {
     ApplicationPath     = job.FilePath;
     ApplicationName     = Path.GetFileNameWithoutExtension(ApplicationPath);
     ApplicationAssembly = ass;
     ApplicationIcon     = f.Icon;
     Context             = f;
     Version             = (job.Tag == JobType.UPDATE) ? ApplicationAssembly.GetName().Version : job.Version;
     Tag = job.Tag;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks for/parses update.xml on server
 /// </summary>
 private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     // Check for update on server
     if (!QubedotUpdateXml.ExistsOnServer(UpdateXmlLocation))
     {
         e.Cancel = true;
     }
     else // Parse update xml
     {
         e.Result = QubedotUpdateXml.Parse(UpdateXmlLocation);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal QubedotUpdateInfoForm(QubedotUpdateLocalAppInfo applicationInfo, QubedotUpdateXml updateInfo)
        {
            InitializeComponent();

            // Sets the icon if it's not null
            if (applicationInfo.ApplicationIcon != null)
            {
                this.Icon = applicationInfo.ApplicationIcon;
            }

            // Fill in the UI
            this.Text             = applicationInfo.ApplicationName + " - Update Info";
            this.lblVersions.Text = updateInfo.Tag == JobType.UPDATE ?
                                    string.Format("Current Version: {0}\nUpdate version: {1}", applicationInfo.Version.ToString(), updateInfo.Version.ToString()) :
                                    (updateInfo.Tag == JobType.ADD ? string.Format("Version: {0}", updateInfo.Version.ToString()) :
                                     "");

            this.txtDescription.Text = updateInfo.Description;
        }
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal QubedotUpdateAcceptForm(QubedotUpdateLocalAppInfo applicationInfo, QubedotUpdateXml updateInfo, int num_cur_update, int num_total_update)
        {
            InitializeComponent();

            this.applicationInfo = applicationInfo;
            this.updateInfo      = updateInfo;

            this.Text = string.Format("{0} - ({1}/{2}) Available Update", this.applicationInfo.ApplicationName, num_cur_update, num_total_update);
            //this.lblUpdateAvail.Text = "An update for \"" + this.applicationInfo.ApplicationID + "\" is available.\r\nWould you like to update?";

            // Assigns the icon if it isn't null
            if (this.applicationInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplicationIcon;
            }

            // Adds the update version # to the form
            this.lblNewVersion.Text = updateInfo.Tag != JobType.REMOVE ?
                                      string.Format(updateInfo.Tag == JobType.UPDATE ? "Update: {0}\nNew Version: {1}" : "New: {0}\nVersion: {1}", Path.GetFileName(this.applicationInfo.ApplicationPath), this.updateInfo.Version.ToString()) :
                                      string.Format("Remove: {0}", Path.GetFileName(this.applicationInfo.ApplicationPath));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Download the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        /// <param name="applicationInfo">An SharpUpdateInfo object containing application's info</param>
        private void DownloadUpdate(QubedotUpdateXml update, QubedotUpdateLocalAppInfo applicationInfo)
        {
            if (update.Tag == JobType.REMOVE)
            {
                tempFilePaths.Add("");
                currentPaths.Add("");
                newPaths.Add(Path.GetFullPath(applicationInfo.ApplicationPath));
                launchArgss.Add(update.LaunchArgs);
                jobtypes.Add(update.Tag);
                return;
            }

            QubedotUpdateDownloadForm form = new QubedotUpdateDownloadForm(update.Uri, update.MD5, applicationInfo.ApplicationIcon);
            DialogResult result            = form.ShowDialog(applicationInfo.Context);

            if (result == DialogResult.OK)
            {
                string currentPath = (update.Tag == JobType.UPDATE) ? applicationInfo.ApplicationAssembly.Location : "";
                string newPath     = (update.Tag == JobType.UPDATE) ? Path.GetFullPath(Path.GetDirectoryName(currentPath).ToString() + update.FilePath) : Path.GetFullPath(applicationInfo.ApplicationPath);
                Directory.CreateDirectory(Path.GetDirectoryName(newPath));

                tempFilePaths.Add(form.TempFilePath);
                currentPaths.Add(currentPath);
                newPaths.Add(newPath);
                launchArgss.Add(update.LaunchArgs);
                jobtypes.Add(update.Tag);
            }
            else if (result == DialogResult.Abort)
            {
                MessageBoxEx.Show(ParentForm, "The update download was cancelled.\nThis program has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBoxEx.Show(ParentForm, "There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }