mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Add squirrel update log output
Also updates squirrel to latest version.
This commit is contained in:
parent
6c9d1e6cf8
commit
375543c644
@ -2,6 +2,8 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,6 +17,7 @@ using osu.Game.Overlays.Notifications;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using Squirrel;
|
using Squirrel;
|
||||||
|
using LogLevel = Splat.LogLevel;
|
||||||
|
|
||||||
namespace osu.Desktop.Updater
|
namespace osu.Desktop.Updater
|
||||||
{
|
{
|
||||||
@ -35,8 +38,11 @@ namespace osu.Desktop.Updater
|
|||||||
notificationOverlay = notification;
|
notificationOverlay = notification;
|
||||||
|
|
||||||
if (game.IsDeployedBuild)
|
if (game.IsDeployedBuild)
|
||||||
|
{
|
||||||
|
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
||||||
Schedule(() => Task.Run(() => checkForUpdateAsync()));
|
Schedule(() => Task.Run(() => checkForUpdateAsync()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
||||||
{
|
{
|
||||||
@ -93,6 +99,7 @@ namespace osu.Desktop.Updater
|
|||||||
{
|
{
|
||||||
// we'll ignore this and retry later. can be triggered by no internet connection or thread abortion.
|
// we'll ignore this and retry later. can be triggered by no internet connection or thread abortion.
|
||||||
}
|
}
|
||||||
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (scheduleRetry)
|
if (scheduleRetry)
|
||||||
@ -159,5 +166,31 @@ namespace osu.Desktop.Updater
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SquirrelLogger : Splat.ILogger, IDisposable
|
||||||
|
{
|
||||||
|
private readonly string path;
|
||||||
|
private readonly object locker = new object();
|
||||||
|
public LogLevel Level { get; set; } = LogLevel.Info;
|
||||||
|
|
||||||
|
public SquirrelLogger()
|
||||||
|
{
|
||||||
|
var file = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "SquirrelSetupUpdater.log");
|
||||||
|
if (File.Exists(file)) File.Delete(file);
|
||||||
|
path = file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Write(string message, LogLevel logLevel)
|
||||||
|
{
|
||||||
|
if (logLevel < Level)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (locker) File.AppendAllText(path, message + "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
|
<PackageReference Include="System.IO.Packaging" Version="4.5.0" />
|
||||||
<PackageReference Include="ppy.squirrel.windows" Version="1.9.0.2" />
|
<PackageReference Include="ppy.squirrel.windows" Version="1.9.0.3" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user