From 2f4855b00ffc4cb89cd79d4fc132be86f9bf47ba Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 17 Feb 2017 21:07:59 +0300 Subject: [PATCH] Added exception --- osu.Desktop/Overlays/VersionManager.cs | 45 +++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 6c34838130..d7e5454b6a 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Desktop.Overlays { @@ -112,27 +113,35 @@ namespace osu.Desktop.Overlays private async void updateChecker() { - updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true); - - if (!updateManager.IsInstalledApp) - return; - - var info = await updateManager.CheckForUpdate(); - if (info.ReleasesToApply.Count > 0) + try { - ProgressNotification n = new UpdateProgressNotification - { - Text = @"Downloading update..." - }; - Schedule(() => notification.Post(n)); - Schedule(() => n.State = ProgressNotificationState.Active); - await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f)); - Schedule(() => n.Text = @"Installing update..."); - await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f)); - Schedule(() => n.State = ProgressNotificationState.Completed); + updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true); + if (!updateManager.IsInstalledApp) + return; + + var info = await updateManager.CheckForUpdate(); + if (info.ReleasesToApply.Count > 0) + { + ProgressNotification n = new UpdateProgressNotification + { + Text = @"Downloading update..." + }; + Schedule(() => notification.Post(n)); + Schedule(() => n.State = ProgressNotificationState.Active); + await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f)); + Schedule(() => n.Text = @"Installing update..."); + await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f)); + Schedule(() => n.State = ProgressNotificationState.Completed); + + } + else + { + //check again every 30 minutes. + Scheduler.AddDelayed(updateChecker, 60000 * 30); + } } - else + catch(Exception e) { //check again every 30 minutes. Scheduler.AddDelayed(updateChecker, 60000 * 30);