mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add startup squirrel icon/association handling
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Desktop.LegacyIpc;
|
using osu.Desktop.LegacyIpc;
|
||||||
@ -12,6 +13,7 @@ using osu.Framework.Logging;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.IPC;
|
using osu.Game.IPC;
|
||||||
using osu.Game.Tournament;
|
using osu.Game.Tournament;
|
||||||
|
using Squirrel;
|
||||||
|
|
||||||
namespace osu.Desktop
|
namespace osu.Desktop
|
||||||
{
|
{
|
||||||
@ -24,6 +26,10 @@ namespace osu.Desktop
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// run Squirrel first, as the app may exit after these run
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
setupSquirrel();
|
||||||
|
|
||||||
// Back up the cwd before DesktopGameHost changes it
|
// Back up the cwd before DesktopGameHost changes it
|
||||||
string cwd = Environment.CurrentDirectory;
|
string cwd = Environment.CurrentDirectory;
|
||||||
|
|
||||||
@ -104,6 +110,25 @@ namespace osu.Desktop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
private static void setupSquirrel()
|
||||||
|
{
|
||||||
|
SquirrelAwareApp.HandleEvents(onInitialInstall: (version, tools) =>
|
||||||
|
{
|
||||||
|
tools.CreateShortcutForThisExe();
|
||||||
|
}, onAppUninstall: (version, tools) =>
|
||||||
|
{
|
||||||
|
tools.RemoveShortcutForThisExe();
|
||||||
|
tools.RemoveUninstallerRegistryEntry();
|
||||||
|
}, onEveryRun: (version, tools, firstRun) =>
|
||||||
|
{
|
||||||
|
tools.SetProcessAppUserModelId();
|
||||||
|
|
||||||
|
if (firstRun)
|
||||||
|
tools.CreateUninstallerRegistryEntry();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static int allowableExceptions = DebugUtils.IsDebugBuild ? 0 : 1;
|
private static int allowableExceptions = DebugUtils.IsDebugBuild ? 0 : 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user