Exemplo n.º 1
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form   = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult            result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                // "Install" it
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("Обновление было преравано.\nПрограмма не будет обновлена.", "Отмена обновления", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Была обнаружена ошибка загрузки обновления.\nПожалуйста, попробуйте позже.", "Ошибка загрузки обновления", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    // Ask to accept the update
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);                         // Do the update
                    }
                }
                else
                {
                    MessageBox.Show("У Вас установлена последняя версия программы");
                }
            }
            else
            {
                MessageBox.Show("Не найдена информация об обновлении");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    // Ask to accept the update
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);                         // Do the update
                    }
                }
                else
                {
                    MessageBox.Show("You have the latest version already!");
                }
            }
            else
            {
                MessageBox.Show("No update information found!");
            }
        }
Exemplo n.º 4
0
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);

            fc.ErrorLog("this.applicationInfo.Context=" + this.applicationInfo.Context);
            Form         f      = this.applicationInfo.Context;
            DialogResult result = form.ShowDialog();

            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                UpdateAoolication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);
                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                fc.Msg("更新被取消,程式將不會異動", "更新取消");
            }
            else
            {
                fc.Msg("更新錯誤,請重新嘗試更新", "更新錯誤");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form   = new SharpUpdateDownloadForm(update.Uri, this.applicationInfo.ApplicationIcon);
            DialogResult            result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                // "Install" it
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("The update download was cancelled.\nThis program has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null)
                {
                    //Check for missing files
                    if (!update.HasAllFiles(AssemblyDirectory()))
                    {
                        this.DownloadUpdate(update);
                    }
                    else if (update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                    {
                        // Ask to accept the update
                        if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                        {
                            if (doUpdate)
                            {
                                this.DownloadUpdate(update); // Do the update
                            }
                            else
                            {//This is not the only instance
                                MessageBox.Show(SharpUpdate.LanguageFile._default.SharpUpdater_DoubleInstanceWarning,
                                                SharpUpdate.LanguageFile._default.SharpUpdater_DoubleInstanceWarningTitle,
                                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();
            try
            {
                this.applicationInfo     = applicationInfo;
                this.updateInfo          = updateInfo;
                this.Text                = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_Title;
                this.lblUpdateAvail.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_lblUpdateAvail;
                this.lblNewVersion.Text  = String.Format(SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_lblNewVersion, this.updateInfo.Version.ToString());
                this.btnYes.Text         = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnYes;
                this.btnNo.Text          = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnNo;
                this.btnDetails.Text     = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnDetails;
            }
            catch (Exception ee)
            {
                int dds = 0;
            }
            // 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
        }
Exemplo n.º 8
0
        private void DownloadUpdate(SharpUpdateXml update)
        {
            var updateDownloadWindow = new SharpUpdateDownloadWindow(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            updateDownloadWindow.Owner = this.applicationInfo.Context;
            updateDownloadWindow.IsUseMD5 = false;
            bool? result = updateDownloadWindow.ShowDialog();
            if (result == true)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                UpdateApplication(updateDownloadWindow.TempFilePath, currentPath, newPath, update.LunchArgs);

                //Environment.Exit(0);// 强制退出,即使有其他的執行緒没有结束

                Application.Current.Shutdown(); // 關閉當前程序,如果有其他執行緒没有结束,不會關閉

            }
            else if (result == false)
            {
                MessageBox.Show("The update download was cancelled.\nThis program has not been modified.",
                    "Update Download Cancelled", MessageBoxButton.OK,MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("There was a problem downloading the update.\nPlease try again later.",
                    "Update Download Error", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form   = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult            result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                // "Install" it
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("Güncelleme indirimi iptal edildi.\nBu program değiştirilmedi.", "Güncelleştirmeyi İndirme İptal Edildi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Güncelleştirmeyi karşıdan yükleme ile ilgili bir sorun oluştu.\nLütfen daha sonra tekrar deneyiniz.", "Güncelleme Yükleme Hatası", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 10
0
        public SharpUpdateInfoForm(ISharpUpdate applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            this.lblVersions.Text = String.Format("Current Version: {0} \n Update Version: {1}",
                                                  applicationInfo.ApplicationAssembly.GetName().Version.ToString(), updateInfo.Version.ToString());
        }
 public SharpUpdateLocalAppInfo(SharpUpdateXml 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;
 }
 public SharpUpdateLocalAppInfo(SharpUpdateXml 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;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Checks for/parses update.xml on server
 /// </summary>
 private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     // Check for update on server
     if (!SharpUpdateXml.ExistsOnServer(UpdateXmlLocation))
     {
         e.Cancel = true;
     }
     else // Parse update xml
     {
         e.Result = SharpUpdateXml.Parse(UpdateXmlLocation);
     }
 }
Exemplo n.º 14
0
        public SharpUpdateInfoForm(ISharpUpdatable applcationInfo, SharpUpdateXml updateInfo )
        {
            InitializeComponent();

            if (applcationInfo.ApplcationIcon != null)
            {
                this.Icon = applcationInfo.ApplcationIcon;
            }

            this.Text = applcationInfo.ApplicationName + " - Update info";
            this.lblVersions.Text = String.Format("Obecna wersja {0}\nNowa wersja {1}", applcationInfo.ApplcationAssembly.GetName().Version.ToString(), updateInfo.Version.ToString());
            this.txDescription.Text = updateInfo.Description;
        }
        internal SharpUpdateAcceptWindow(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Title = applicationInfo.ApplicationName + " - Update Available";
            if (applicationInfo.ApplicationIcon != null)
                this.Icon = applicationInfo.ApplicationIcon.Source;

            lblNewVersion.Content = string.Format("New Version {0}", updateInfo.Version);
        }
        /// <summary>
        /// Checks for/parse update.xml on server
        /// </summary>
        private void bgWorker_DoWork(Object sender, DoWorkEventArgs e)
        {
            ISharpUpdate application = (ISharpUpdate)e.Argument;

            if (!SharpUpdateXml.ExistsOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = SharpUpdateXml.Parse(application.UpdateXmlLocation, application.ApplicationID);
            }
        }
Exemplo n.º 17
0
        public SharpUpdateFornInfo(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            if (applicationInfo.ApplicationIcon != null)
            {
                this.Icon = applicationInfo.ApplicationIcon;
            }

            this.Text            = applicationInfo.ApplicationName + " - Update Info";
            this.lblVersion.Text = string.Format("Current Version: {0}\nUpdate Version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                 updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml 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 = String.Format("Current Version: {0}\nUpdate version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
Exemplo n.º 19
0
        /// <summary>
        /// Checks for/parses update.xml on server
        /// </summary>
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            ISharpUpdatable application = (ISharpUpdatable)e.Argument;

            // Check for update on server
            if (!SharpUpdateXml.ExistsOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else             // Parse update xml
            {
                e.Result = SharpUpdateXml.Parse(application.UpdateXmlLocation, application.ApplicationID);
            }
        }
        internal SharpUpdateInfoWindow(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            if (applicationInfo.ApplicationIcon != null)
                this.Icon = applicationInfo.ApplicationIcon.Source;

            this.Title = applicationInfo.ApplicationName + " - Update Info";

            this.lblDescription.Content = string.Format("Current Version: {0}\nUpdate Version: {1}",
                applicationInfo.ApplicationAssembly.GetName().Version, updateInfo.Version);

            this.txtDescription.Document.Blocks.Clear();
            this.txtDescription.Document.Blocks.Add(new Paragraph(new Run(updateInfo.Description)));
        }
        private void bgWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);
                    }
                }
            }
        }
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Text = this.applicationInfo.ApplicationName;
            if (this.applicationInfo.ApplcationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplcationIcon;
            }

            lblNewVersion.Text = string.Format("Nowa wersja {0}", this.updateInfo.Version.ToString());
        }
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml 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 + " - Güncelleme Bilgisi";
            this.lblVersions.Text = String.Format("Mevcut version: {0}\nGüncel version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdate applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            //Fill in the UI
            this.Text             = applicationInfo.ApplicationName + " . Update Info";
            this.lblVersions.Text = string.Format("Current Version: {0}\nUpdate Version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Text = this.applicationInfo.ApplicationName + " - Update Available";

            // 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 = String.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }
Exemplo n.º 26
0
        /// <summary>
        /// Constructeur du formulaire
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        public SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            if (applicationInfo.ApplicationIcon != null)
            {
                Icon = applicationInfo.ApplicationIcon;
            }

            this.Text       = applicationInfo.ApplicationName + " - Mise à jour";
            lblVersion.Text = String.Format("Version Actuelle: {0}\nVersion à jour: {1}",
                                            applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                            updateInfo.Version.ToString());

            txtDescription.Text = updateInfo.Description;
        }
Exemplo n.º 27
0
        private void bgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            fc.ErrorLog("bgWorker_DoWork");
            ISharpUpdatable application = (ISharpUpdatable)e.Argument;

            if (!SharpUpdateXml.ExistOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
                fc.ErrorLog("e.Cancel = true;");
            }
            else
            {
                e.Result = SharpUpdateXml.Parse(application.UpdateXmlLocation, application.ApplicationID);
                fc.ErrorLog("application.UpdateXmlLocation=" + application.UpdateXmlLocation + " application.ApplicationID=" + application.ApplicationID);
            }
        }
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml 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;
            this.lblVersions.Text = String.Format("Текущая версия: {0}\nНовая версия: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
Exemplo n.º 29
0
        internal SharpUpdateAcceptForm()
        {
            InitializeComponent();

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

            this.Text = this.applicationInfo.ApplicationName + " - Update Available";

            if (this.applicationInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplicationIcon;
            }

            this.lblUpdateAvali.Text = string.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }
Exemplo n.º 30
0
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            // Fill in the UI

            this.Text = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_Title;
            this.lblVersions.Text = String.Format(SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_Version, applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                updateInfo.Version.ToString());
            this.lblDescription.Text = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_lblDescription;
            this.txtDescription.Text = updateInfo.Description;
            this.btnBack.Text = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_btnBack;
        }
Exemplo n.º 31
0
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();
            fc.ErrorLog("VSharpUpdateAcceptForm");

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

            this.Text = this.applicationInfo.ApplicationName + "";

            if (this.applicationInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplicationIcon;
            }

            this.lbNew.Text = string.Format("新版本 Ver:{0}", this.updateInfo.Version.ToString());
        }
Exemplo n.º 32
0
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(SharpUpdateLocalAppInfo applicationInfo, SharpUpdateXml 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 + " - Информация об обновлении";
            this.lblVersions.Text = updateInfo.Tag == JobType.UPDATE ?
                                    string.Format("Текущая версия: {0}\nВерсия обновления: {1}", applicationInfo.Version.ToString(), updateInfo.Version.ToString()) :
                                    (updateInfo.Tag == JobType.ADD ? string.Format("Версия: {0}", updateInfo.Version.ToString()) : "");

            this.txtDescription.Text = updateInfo.Description;
        }
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Text = "Доступно обновление - " + this.applicationInfo.ApplicationName;

            // 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 = String.Format("Новая версия: {0}", this.updateInfo.Version.ToString());
        }
Exemplo n.º 34
0
        /// <summary>
        /// Constructeur de la frame
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Text = applicationInfo.ApplicationName + " - Mise à jour disponible";

            // Afficher l'icone si ce dernier n'est pas nul
            if (applicationInfo.ApplicationIcon != null)
            {
                Icon = applicationInfo.ApplicationIcon;
            }

            // Afficher le numéro de version
            lblNewVersion.Text = string.Format("Nouvelle version: {0}", updateInfo.Version.ToString());
        }
Exemplo n.º 35
0
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            this.Text = this.applicationInfo.ApplicationName + " - Update Available";

            // 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 = String.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }
Exemplo n.º 36
0
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                System.Diagnostics.FileVersionInfo ver =
                    System.Diagnostics.FileVersionInfo.GetVersionInfo(
                        this.applicationInfo.ApplicationAssembly.Location);

                string[] tmpv = ver.FileVersion.Split('.');
                Version  v    = new Version(Int32.Parse(tmpv[0]),
                                            Int32.Parse(tmpv[1]),
                                            Int32.Parse(tmpv[2]),
                                            Int32.Parse(tmpv[3]));

                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                //if (update != null && update.IsNewerThan(v))
                {
                    fc.ErrorLog("Version=" + this.applicationInfo.ApplicationAssembly.GetName().Version);
                    //fc.ErrorLog("Version=" + v);
                    fc.ErrorLog("this.applicationInfo.Context=" + this.applicationInfo.Context);
                    Form f = this.applicationInfo.Context;
                    fc.ErrorLog("f=" + f.ToString());

                    if (FBool)
                    {
                        return;
                    }
                    else if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(f) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);
                    }
                }
                else
                {
                    if (!FBool)
                    {
                        fc.Msg("版本:" + this.applicationInfo.ApplicationAssembly.GetName().Version + " 已是最新版!", "提示");
                    }
                    //MessageBox.Show("版本:" + v + " 已是最新版!");
                }
            }
        }
Exemplo n.º 37
0
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

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

            // Fill in the UI

            this.Text             = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_Title;
            this.lblVersions.Text = String.Format(SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_Version, applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  updateInfo.Version.ToString());
            this.lblDescription.Text = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_lblDescription;
            this.txtDescription.Text = updateInfo.Description;
            this.btnBack.Text        = SharpUpdate.LanguageFile._default.SharpUpdateInfoForm_btnBack;
        }
Exemplo n.º 38
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            List <Uri>    uri = new List <Uri>();
            List <string> md5 = new List <string>();

            foreach (SharpUpdateXmlFile file in update.Files)
            {
                uri.Add(file.Uri);
                md5.Add(file.MD5);
            }
            SharpUpdateDownloadForm form   = new SharpUpdateDownloadForm(uri, md5, this.applicationInfo.ApplicationIcon);
            DialogResult            result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                int i = 0;
                Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), form.TempFolder));
                foreach (string tempFile in form.TempFilesPath)
                {
                    string tempDestFile = Path.Combine(Path.GetTempPath(), form.TempFolder, update.Files[i].FileName);
                    System.IO.File.Copy(tempFile, tempDestFile);
                    i++;
                }

                string executable = Path.Combine(Path.GetTempPath(), form.TempFolder, update.LaunchFile);

                string currentPath = this.applicationInfo.ApplicationAssembly.Location;

                // "Install" it
                UpdateApplication(Path.Combine(Path.GetTempPath(), form.TempFolder), executable, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("The update download was cancelled.\nThis program has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 39
0
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applcationInfo.ApplcationIcon);
            DialogResult result = form.ShowDialog(this.applcationInfo.Context);

            if (result == DialogResult.OK)
            {
                string currentPath = this.applcationInfo.ApplcationAssembly.Location;
                string newPath = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            } else if (result == DialogResult.Abort)
            {
                MessageBox.Show("Anulowano pobieranie.\nProgram nie został zaktualizowany.", "Anulowano pobieranie.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } else
            {
                MessageBox.Show("Wystąpił problem z pobieraniem. Spróbuj ponownie.", "Błąd aktualizacji.", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Exemplo n.º 40
0
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        /// <param name="applicationInfo"></param>
        /// <param name="updateInfo"></param>
        internal SharpUpdateAcceptForm(ISharpUpdatable applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();
            try
            {
                this.applicationInfo = applicationInfo;
                this.updateInfo = updateInfo;
                this.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_Title;
                this.lblUpdateAvail.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_lblUpdateAvail;
                this.lblNewVersion.Text = String.Format(SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_lblNewVersion, this.updateInfo.Version.ToString());
                this.btnYes.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnYes;
                this.btnNo.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnNo;
                this.btnDetails.Text = SharpUpdate.LanguageFile._default.SharpUpdateAcceptForm_btnDetails;
            }
            catch (Exception ee)
            {
                int dds = 0;
            }
            // 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
        }
Exemplo n.º 41
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath = Path.GetDirectoryName(currentPath) + "\\"; //+ update.FileName;

                // "Install" it
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("Обновление было прервано.\nПрограмма не была обновлена.", @"Обновление отменено", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Возникла проблема при загрузке обновления.\nПопробуйте позднее.", @"Ошибка при обновлении", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 42
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(update.UpdateFiles, this.applicationInfo.ApplicationIcon);
            DialogResult result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                // "Install" it
                UpdateApplication(form.TempFilesPath, currentPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show(SharpUpdate.LanguageFile._default.SharpUpdater_DownloadCancelled, SharpUpdate.LanguageFile._default.SharpUpdater_DownloadCancelledTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(SharpUpdate.LanguageFile._default.SharpUpdater_DownloadProblem, SharpUpdate.LanguageFile._default.SharpUpdater_DownloadProblemTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 43
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(SharpUpdateXml update)
        {
            SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult result = form.ShowDialog(this.applicationInfo.Context);

            // Download update
            if (result == DialogResult.OK)
            {
                using (var tmp = new SevenZipExtractor(form.TempFilePath))
                {
                    for (int i = 0; i < tmp.ArchiveFileData.Count; i++)
                    {
                        tmp.ExtractFiles(@"d:\Temp\Result\", tmp.ArchiveFileData[i].Index);
                    }
                }

                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                // "Install" it
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("The update download was cancelled.\nThis program has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }