From 96397e8c27ee2c2ced4e64906ad66b3f4fec53e7 Mon Sep 17 00:00:00 2001 From: Nova Date: Tue, 18 Oct 2022 17:31:07 -0400 Subject: [PATCH] Update Discord RPC NuGet package --- IndustrialPark/IndustrialPark.csproj | 13 +++++++++++-- IndustrialPark/MainForm/MainForm.cs | 4 ++-- IndustrialPark/Other/DiscordRPCController.cs | 18 +++++++++++------- IndustrialPark/packages.config | 5 ++++- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/IndustrialPark/IndustrialPark.csproj b/IndustrialPark/IndustrialPark.csproj index e7915e24..9f90f99d 100644 --- a/IndustrialPark/IndustrialPark.csproj +++ b/IndustrialPark/IndustrialPark.csproj @@ -72,8 +72,11 @@ ..\packages\AssimpNet.4.1.0\lib\net40\AssimpNet.dll - - ..\packages\DiscordRichPresence.1.0.175\lib\net35\DiscordRPC.dll + + ..\packages\DiscordRichPresence.1.1.1.14\lib\netstandard2.0\DiscordRPC.dll + + + ..\packages\Microsoft.Win32.Registry.4.5.0\lib\net461\Microsoft.Win32.Registry.dll ..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll @@ -107,6 +110,12 @@ + + ..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll + + + ..\packages\System.Security.Principal.Windows.4.5.0\lib\net461\System.Security.Principal.Windows.dll + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll diff --git a/IndustrialPark/MainForm/MainForm.cs b/IndustrialPark/MainForm/MainForm.cs index e1551847..ba55b9da 100644 --- a/IndustrialPark/MainForm/MainForm.cs +++ b/IndustrialPark/MainForm/MainForm.cs @@ -262,7 +262,7 @@ private void newToolStripMenuItem1_Click(object sender, EventArgs e) } // updates presence so that it doesn't get stuck on the previously focused window name - DiscordRPCController.setPresence(idling: true); + DiscordRPCController.SetPresence(idling: true); currentProjectPath = null; ApplyProject(new ProjectJson()); @@ -283,7 +283,7 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e) } // updates presence so that it doesn't get stuck on the previously focused window name - DiscordRPCController.setPresence(idling: true); + DiscordRPCController.SetPresence(idling: true); OpenFileDialog openFile = new OpenFileDialog() { Filter = "JSON files|*.json" }; diff --git a/IndustrialPark/Other/DiscordRPCController.cs b/IndustrialPark/Other/DiscordRPCController.cs index 9142c7d7..39a71ce9 100644 --- a/IndustrialPark/Other/DiscordRPCController.cs +++ b/IndustrialPark/Other/DiscordRPCController.cs @@ -3,6 +3,7 @@ using System.Linq; using DiscordRPC; +using DiscordRPC.Logging; using HipHopFile; namespace IndustrialPark @@ -56,13 +57,16 @@ public static void Initialize() // it can be replaced with any other application ID as long as // the name is "Industrial Park" and the image of the logo has // the name of "icon" - client = new DiscordRpcClient("734104261876514836"); + client = new DiscordRpcClient("734104261876514836") + { + Logger = new ConsoleLogger() { Level = LogLevel.Warning } + }; client.Initialize(); timer1.Start(); - setPresence(idling: true); + SetPresence(idling: true); } - public static void setPresence(ArchiveEditor archiveEditor = null, bool idling = false) + public static void SetPresence(ArchiveEditor archiveEditor = null, bool idling = false) { try { @@ -90,7 +94,7 @@ public static void setPresence(ArchiveEditor archiveEditor = null, bool idling = } currentArchiveEditor = archiveEditor.Text; - game = gameHandler(archiveEditor); + game = GameHandler(archiveEditor); switch (game) { @@ -161,7 +165,7 @@ public static void setPresence(ArchiveEditor archiveEditor = null, bool idling = } } - private static string gameHandler(ArchiveEditor archiveEditor) + private static string GameHandler(ArchiveEditor archiveEditor) { Game game = archiveEditor.archive.game; switch (game) @@ -204,11 +208,11 @@ public static void GetActiveWindow() // ensures that it only updates to archives if (activeEditorName.EndsWith(".hip", StringComparison.InvariantCultureIgnoreCase) || activeEditorName.EndsWith(".hop", StringComparison.InvariantCultureIgnoreCase)) { - setPresence(activeEditor); + SetPresence(activeEditor); } } else if (archiveEditors.Count == 0) - setPresence(idling: true); + SetPresence(idling: true); } } } diff --git a/IndustrialPark/packages.config b/IndustrialPark/packages.config index a6c01a70..533b1ff0 100644 --- a/IndustrialPark/packages.config +++ b/IndustrialPark/packages.config @@ -1,7 +1,8 @@  - + + @@ -9,6 +10,8 @@ + +