mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 09:03:01 +08:00
Update obsolete usages in line with Clowd.Squirrel
changes
This commit is contained in:
parent
411252e004
commit
6a4d731eb3
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -96,6 +97,8 @@ namespace osu.Desktop
|
|||||||
switch (RuntimeInfo.OS)
|
switch (RuntimeInfo.OS)
|
||||||
{
|
{
|
||||||
case RuntimeInfo.Platform.Windows:
|
case RuntimeInfo.Platform.Windows:
|
||||||
|
Debug.Assert(OperatingSystem.IsWindows());
|
||||||
|
|
||||||
return new SquirrelUpdateManager();
|
return new SquirrelUpdateManager();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -16,10 +17,11 @@ using osu.Game.Overlays.Notifications;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using Squirrel;
|
using Squirrel;
|
||||||
using LogLevel = Splat.LogLevel;
|
using Squirrel.SimpleSplat;
|
||||||
|
|
||||||
namespace osu.Desktop.Updater
|
namespace osu.Desktop.Updater
|
||||||
{
|
{
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
public class SquirrelUpdateManager : osu.Game.Updater.UpdateManager
|
public class SquirrelUpdateManager : osu.Game.Updater.UpdateManager
|
||||||
{
|
{
|
||||||
private UpdateManager updateManager;
|
private UpdateManager updateManager;
|
||||||
@ -34,12 +36,14 @@ namespace osu.Desktop.Updater
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool updatePending;
|
private bool updatePending;
|
||||||
|
|
||||||
|
private readonly SquirrelLogger squirrelLogger = new SquirrelLogger();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(NotificationOverlay notification)
|
private void load(NotificationOverlay notification)
|
||||||
{
|
{
|
||||||
notificationOverlay = notification;
|
notificationOverlay = notification;
|
||||||
|
|
||||||
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
SquirrelLocator.CurrentMutable.Register(() => squirrelLogger, typeof(ILogger));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<bool> PerformUpdateCheck() => await checkForUpdateAsync().ConfigureAwait(false);
|
protected override async Task<bool> PerformUpdateCheck() => await checkForUpdateAsync().ConfigureAwait(false);
|
||||||
@ -49,9 +53,11 @@ namespace osu.Desktop.Updater
|
|||||||
// should we schedule a retry on completion of this check?
|
// should we schedule a retry on completion of this check?
|
||||||
bool scheduleRecheck = true;
|
bool scheduleRecheck = true;
|
||||||
|
|
||||||
|
const string github_token = null; // TODO: populate.
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
updateManager ??= await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true).ConfigureAwait(false);
|
updateManager ??= new GithubUpdateManager(@"https://github.com/ppy/osu", false, github_token, @"osulazer");
|
||||||
|
|
||||||
var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false);
|
var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -201,11 +207,11 @@ namespace osu.Desktop.Updater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SquirrelLogger : Splat.ILogger, IDisposable
|
private class SquirrelLogger : ILogger, IDisposable
|
||||||
{
|
{
|
||||||
public LogLevel Level { get; set; } = LogLevel.Info;
|
public Squirrel.SimpleSplat.LogLevel Level { get; set; } = Squirrel.SimpleSplat.LogLevel.Info;
|
||||||
|
|
||||||
public void Write(string message, LogLevel logLevel)
|
public void Write(string message, Squirrel.SimpleSplat.LogLevel logLevel)
|
||||||
{
|
{
|
||||||
if (logLevel < Level)
|
if (logLevel < Level)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user