/// <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); } }
/// <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); } }
/// <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); } }
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("更新錯誤,請重新嘗試更新", "更新錯誤"); } }
/// <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); } }
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); } }
/// <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); } }
/// <summary> /// Télécharge la mise à jour et l'installe /// </summary> /// <param name="update">Les informations de Xml</param> private void DownloadUpdate(SharpUpdateXml update) { var form = new SharpUpdateDownloadForm(update.Uri, update.MD5, applicationInfo.ApplicationIcon); var result = form.ShowDialog(applicationInfo.Context); if (result == DialogResult.OK) { var currentPath = applicationInfo.ApplicationAssembly.Location; var newPath = Path.GetDirectoryName(currentPath) + "\\" + update.Filename; UpdateApplication(form.tempFilePath, currentPath, newPath, update.LaunchArgs); Application.Exit(); } else if (result == DialogResult.Abort) { MessageBox.Show("La mise à jour à été abortée.\nLe logiciel n'a pas été modifié.", "Mise à jour abortée", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Une erreur est survenue lors de la mise à jour.\nVeuillez essayer de nouveau.", "Échec de la mise à jour", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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(SharpUpdateXml update, SharpUpdateLocalAppInfo 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; } SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(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); } }
/// <summary> /// Download the update /// </summary> /// <param name="update">The update xml info</param> /// <param name="applicationInfo">An SharpUpdateInfo object containing application's info</param> /// ОШИБКА НАЧИНАЕТСЯ ОТ СЮДА RESULT = NO private void DownloadUpdate(SharpUpdateXml update, SharpUpdateLocalAppInfo 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; } SharpUpdateDownloadForm form = new SharpUpdateDownloadForm(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, "Загрузка обновления была отменена.\n Эта программа не была изменена.", "Обновление отменено", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBoxEx.Show(ParentForm, "При загрузке обновления возникла проблема.\n Пожалуйста, попробуйте позже", "Ошибка загрузки обновления", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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); } }
/// <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); } }