Skip to content

Commit

Permalink
Add support for Squirrel installation
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanicArts committed Jun 18, 2022
1 parent ce8dcd1 commit 86c6820
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bin/
obj/
build/
/Releases
/publish
/publish.sh
/packages/
riderModule.iml
/_ReSharper.Caches/
Expand Down
25 changes: 25 additions & 0 deletions VRCOSC.Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
// See the LICENSE file in the repository root for full license text.

using System.Runtime.Versioning;
using osu.Framework;
using osu.Framework.Platform;
using Squirrel;
using VRCOSC.Game;

namespace VRCOSC.Desktop;
Expand All @@ -11,8 +13,31 @@ public static class Program
{
public static void Main()
{
initSquirrel();

using GameHost host = Host.GetSuitableDesktopHost(@"VRCOSC");
using osu.Framework.Game game = new VRCOSCGame();
host.Run(game);
}

[SupportedOSPlatform("windows")]
private static void initSquirrel()
{
SquirrelAwareApp.HandleEvents(onInitialInstall: OnAppInstall, onAppUninstall: OnAppUninstall, onEveryRun: OnAppRun);
}

private static void OnAppInstall(SemanticVersion version, IAppTools tools)
{
tools.CreateShortcutForThisExe();
}

private static void OnAppUninstall(SemanticVersion version, IAppTools tools)
{
tools.RemoveShortcutForThisExe();
}

private static void OnAppRun(SemanticVersion version, IAppTools tools, bool firstRun)
{
tools.SetProcessAppUserModelId();
}
}
3 changes: 3 additions & 0 deletions VRCOSC.Desktop/VRCOSC.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
<ItemGroup Label="Resources">
<EmbeddedResource Include="game.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Clowd.Squirrel" Version="2.9.40" />
</ItemGroup>
</Project>

0 comments on commit 86c6820

Please sign in to comment.