This commit is contained in:
EnderIce2 2024-02-02 17:35:14 +02:00
parent 17a6a05739
commit 3173c291f5
2 changed files with 20 additions and 5 deletions

View File

@ -4,6 +4,7 @@ using DiscordRPC.Message;
using SDRSharp.Common; using SDRSharp.Common;
using SDRSharp.Radio; using SDRSharp.Radio;
using System; using System;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -44,10 +45,24 @@ namespace EnderIce2.SDRSharpPlugin
_control = control; _control = control;
if (Utils.GetBooleanSetting("EnableRPC", true)) 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.RegisterUriScheme();
client.OnRpcMessage += Client_OnRpcMessage; client.OnRpcMessage += Client_OnRpcMessage;

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyVersion("1.2.0.2")]
[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.2.0.2")]