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 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);
|
||||
|
Loading…
Reference in New Issue
Block a user