Skip to content

Commit 3173c29

Browse files
committed
Fix #13
1 parent 17a6a05 commit 3173c29

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

MainPlugin.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using SDRSharp.Common;
55
using SDRSharp.Radio;
66
using System;
7+
using System.Linq;
78
using System.Reflection;
89
using System.Threading.Tasks;
910
using System.Windows.Forms;
@@ -44,10 +45,24 @@ public void Initialize(ISharpControl control)
4445
_control = control;
4546
if (Utils.GetBooleanSetting("EnableRPC", true))
4647
{
47-
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
48+
if (Utils.GetStringSetting("ClientID").All(char.IsWhiteSpace))
4849
{
49-
Logger = new ConsoleLogger(logLevel, true)
50-
};
50+
Utils.SaveSetting("ClientID", "765213507321856078");
51+
}
52+
53+
try
54+
{
55+
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
56+
{
57+
Logger = new ConsoleLogger(logLevel, true)
58+
};
59+
}
60+
catch (Exception ex)
61+
{
62+
_controlPanel.ChangeStatus = $"RPC Error: {ex.Message}";
63+
LogWriter.WriteToFile("Error in DiscordRpcClient\n" + ex.ToString());
64+
return;
65+
}
5166

5267
client.RegisterUriScheme();
5368
client.OnRpcMessage += Client_OnRpcMessage;

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
35+
[assembly: AssemblyVersion("1.2.0.2")]
36+
[assembly: AssemblyFileVersion("1.2.0.2")]

0 commit comments

Comments
 (0)