From 3173c291f5a08f42506a9ee7c577b74625492855 Mon Sep 17 00:00:00 2001 From: EnderIce2 <38536866+EnderIce2@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:35:14 +0200 Subject: [PATCH] Fix #13 --- MainPlugin.cs | 21 ++++++++++++++++++--- Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/MainPlugin.cs b/MainPlugin.cs index 9af4bd3..72ad3ff 100644 --- a/MainPlugin.cs +++ b/MainPlugin.cs @@ -4,6 +4,7 @@ using SDRSharp.Common; using SDRSharp.Radio; using System; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using System.Windows.Forms; @@ -44,10 +45,24 @@ public void Initialize(ISharpControl control) _control = control; if (Utils.GetBooleanSetting("EnableRPC", true)) { - client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe) + if (Utils.GetStringSetting("ClientID").All(char.IsWhiteSpace)) { - Logger = new ConsoleLogger(logLevel, true) - }; + Utils.SaveSetting("ClientID", "765213507321856078"); + } + + try + { + client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe) + { + Logger = new ConsoleLogger(logLevel, true) + }; + } + catch (Exception ex) + { + _controlPanel.ChangeStatus = $"RPC Error: {ex.Message}"; + LogWriter.WriteToFile("Error in DiscordRpcClient\n" + ex.ToString()); + return; + } client.RegisterUriScheme(); client.OnRpcMessage += Client_OnRpcMessage; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 78d873e..726ca15 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.2.0.2")] +[assembly: AssemblyFileVersion("1.2.0.2")]