mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 23:23:12 +08:00
Initial commit
This commit is contained in:
parent
c8134162b5
commit
836efe3f7c
@ -37,10 +37,12 @@ namespace osu.Desktop.Updater
|
|||||||
if (game.IsDeployedBuild)
|
if (game.IsDeployedBuild)
|
||||||
{
|
{
|
||||||
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
Splat.Locator.CurrentMutable.Register(() => new SquirrelLogger(), typeof(Splat.ILogger));
|
||||||
Schedule(() => Task.Run(() => checkForUpdateAsync()));
|
CheckForUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void CheckForUpdate() => Schedule(() => Task.Run(() => checkForUpdateAsync()));
|
||||||
|
|
||||||
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
|
||||||
{
|
{
|
||||||
// should we schedule a retry on completion of this check?
|
// should we schedule a retry on completion of this check?
|
||||||
|
@ -5,15 +5,19 @@ using osu.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Updater;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.General
|
namespace osu.Game.Overlays.Settings.Sections.General
|
||||||
{
|
{
|
||||||
public class UpdateSettings : SettingsSubsection
|
public class UpdateSettings : SettingsSubsection
|
||||||
{
|
{
|
||||||
|
[Resolved(CanBeNull = true)]
|
||||||
|
private UpdateManager updateManager { get; set; }
|
||||||
|
|
||||||
protected override string Header => "Updates";
|
protected override string Header => "Updates";
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(Storage storage, OsuConfigManager config)
|
private void load(Storage storage, OsuConfigManager config, OsuGameBase game)
|
||||||
{
|
{
|
||||||
Add(new SettingsEnumDropdown<ReleaseStream>
|
Add(new SettingsEnumDropdown<ReleaseStream>
|
||||||
{
|
{
|
||||||
@ -21,6 +25,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(new SettingsButton
|
||||||
|
{
|
||||||
|
Text = "Check for updates",
|
||||||
|
Action = () => updateManager?.CheckForUpdate(),
|
||||||
|
Enabled = { Value = game.IsDeployedBuild }
|
||||||
|
});
|
||||||
|
|
||||||
if (RuntimeInfo.IsDesktop)
|
if (RuntimeInfo.IsDesktop)
|
||||||
{
|
{
|
||||||
Add(new SettingsButton
|
Add(new SettingsButton
|
||||||
|
@ -30,9 +30,11 @@ namespace osu.Game.Updater
|
|||||||
version = game.Version;
|
version = game.Version;
|
||||||
|
|
||||||
if (game.IsDeployedBuild)
|
if (game.IsDeployedBuild)
|
||||||
Schedule(() => Task.Run(checkForUpdateAsync));
|
CheckForUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void CheckForUpdate() => Schedule(() => Task.Run(checkForUpdateAsync));
|
||||||
|
|
||||||
private async void checkForUpdateAsync()
|
private async void checkForUpdateAsync()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -44,6 +45,11 @@ namespace osu.Game.Updater
|
|||||||
config.Set(OsuSetting.Version, version);
|
config.Set(OsuSetting.Version, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void CheckForUpdate()
|
||||||
|
{
|
||||||
|
Logger.Log("CheckForUpdate was called on the base class (UpdateManager)", LoggingTarget.Information);
|
||||||
|
}
|
||||||
|
|
||||||
private class UpdateCompleteNotification : SimpleNotification
|
private class UpdateCompleteNotification : SimpleNotification
|
||||||
{
|
{
|
||||||
private readonly string version;
|
private readonly string version;
|
||||||
|
Loading…
Reference in New Issue
Block a user