mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:02:54 +08:00
Added exception
This commit is contained in:
parent
6a58d7ab2a
commit
2f4855b00f
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Desktop.Overlays
|
namespace osu.Desktop.Overlays
|
||||||
{
|
{
|
||||||
@ -112,27 +113,35 @@ namespace osu.Desktop.Overlays
|
|||||||
|
|
||||||
private async void updateChecker()
|
private async void updateChecker()
|
||||||
{
|
{
|
||||||
updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
|
try
|
||||||
|
|
||||||
if (!updateManager.IsInstalledApp)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var info = await updateManager.CheckForUpdate();
|
|
||||||
if (info.ReleasesToApply.Count > 0)
|
|
||||||
{
|
{
|
||||||
ProgressNotification n = new UpdateProgressNotification
|
updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
|
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.
|
//check again every 30 minutes.
|
||||||
Scheduler.AddDelayed(updateChecker, 60000 * 30);
|
Scheduler.AddDelayed(updateChecker, 60000 * 30);
|
||||||
|
Loading…
Reference in New Issue
Block a user