mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-07-15 17:49:14 +00:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
4753a7849b | |||
4913bb45c4 | |||
a1a66c3dd1 | |||
7d2a7d3dc0 | |||
f9fdaa969e | |||
e008886fd7 | |||
071c1071df | |||
e0b304b2a2 | |||
e67214c4b9 | |||
59fda87954 | |||
54c8969d2b | |||
0cd9bb75fc | |||
d8711ff1bc | |||
ab06d0167b | |||
ad8cd96c55 | |||
76d8a1e640 | |||
85d99f1d0c | |||
131fc8dc10 | |||
f69b5e623b | |||
902086f99a | |||
fb8c9e6c93 | |||
03aad884dd | |||
411f606bfc | |||
0c844e8ee6 | |||
c7cdd07ba0 |
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
3
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -28,5 +28,8 @@ If applicable, add screenshots to help explain your problem.
|
|||||||
- Plugin Version [e.g. 1.2]
|
- Plugin Version [e.g. 1.2]
|
||||||
- SDR# Version [e.g. revision 1770 4698f0a]
|
- SDR# Version [e.g. revision 1770 4698f0a]
|
||||||
|
|
||||||
|
**Plugin Log**
|
||||||
|
A copy of \RPCLogs\DiscordRPCLog_XX.XX.XXXX.log on https://pastebin.com or other copy-paste website.
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023639.png
vendored
Normal file
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023639.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023706.png
vendored
Normal file
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023706.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023915.png
vendored
Normal file
BIN
.github/MEDIA/Captură de ecran 2020-10-26 023915.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
BIN
.github/MEDIA/Captură de ecran 2020-10-26 024024.png
vendored
Normal file
BIN
.github/MEDIA/Captură de ecran 2020-10-26 024024.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 768 B |
BIN
.github/MEDIA/Captură de ecran 2020-10-26 025111.png
vendored
Normal file
BIN
.github/MEDIA/Captură de ecran 2020-10-26 025111.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
1
.github/MEDIA/README.md
vendored
Normal file
1
.github/MEDIA/README.md
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Files for README.md
|
4
LICENSE
4
LICENSE
@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
|
|||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
SDR-RPC | Plugin for SDRSharp Software adding Discord Rich Presence
|
SDR-RPC | Plugin for SDRSharp Software adding Discord Rich Presence
|
||||||
Copyright (C) 2020 Albu Alexandru Gabriel
|
Copyright (C) 2021 Albu Alexandru Gabriel
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
SDR-RPC Copyright (C) 2020 Albu Alexandru Gabriel
|
SDR-RPC Copyright (C) 2021 Albu Alexandru Gabriel
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
@ -8,7 +8,10 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
public static void WriteToFile(string Message)
|
public static void WriteToFile(string Message)
|
||||||
{
|
{
|
||||||
if (!SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
|
if (!SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
|
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
{
|
{
|
||||||
|
@ -14,17 +14,14 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
{
|
{
|
||||||
private const string _displayName = "Discord RPC";
|
private const string _displayName = "Discord RPC";
|
||||||
private SettingsPanel _controlPanel;
|
private SettingsPanel _controlPanel;
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
private const LogLevel logLevel = LogLevel.Trace;
|
||||||
private static LogLevel logLevel = LogLevel.Trace;
|
private const int discordPipe = -1;
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
|
||||||
private static int discordPipe = -1;
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
||||||
bool RPCalreadyLoaded = false;
|
bool RPCalreadyLoaded = false;
|
||||||
private ISharpControl _control;
|
private ISharpControl _control;
|
||||||
bool playedBefore = false;
|
bool playedBefore = false;
|
||||||
private IConfigurationPanelProvider configurationPanelProvider;
|
|
||||||
private SDRSharp.FrontEnds.SpyServer.ControllerPanel controllerPanel;
|
private SDRSharp.FrontEnds.SpyServer.ControllerPanel controllerPanel;
|
||||||
public TopWindowMessages windowMessages;
|
private TopWindowMessages windowMessages;
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
||||||
private RichPresence presence = new RichPresence()
|
private RichPresence presence = new RichPresence()
|
||||||
{
|
{
|
||||||
@ -35,39 +32,38 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
LargeImageKey = "image_large",
|
LargeImageKey = "image_large",
|
||||||
LargeImageText = "SDRSharp",
|
LargeImageText = "SDRSharp",
|
||||||
SmallImageKey = "image_small",
|
SmallImageKey = "image_small",
|
||||||
SmallImageText = $"SDR-RPC plugin v{Assembly.GetEntryAssembly().GetName().Version} by EnderIce2"
|
SmallImageText = $"SDR-RPC plugin v{Assembly.LoadFrom("SDR-RPC.dll").GetName().Version} by EnderIce2" // should show the correct version
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static DiscordRpcClient client;
|
private DiscordRpcClient client;
|
||||||
private static bool isRunning = true;
|
private bool isRunning = true;
|
||||||
public string DisplayName
|
public string DisplayName => _displayName;
|
||||||
{
|
public bool HasGui => true;
|
||||||
get { return _displayName; }
|
public UserControl Gui => _controlPanel;
|
||||||
}
|
|
||||||
public bool HasGui
|
|
||||||
{
|
|
||||||
get { return true; }
|
|
||||||
}
|
|
||||||
public UserControl Gui
|
|
||||||
{
|
|
||||||
get { return _controlPanel; }
|
|
||||||
}
|
|
||||||
public void Initialize(ISharpControl control)
|
public void Initialize(ISharpControl control)
|
||||||
{
|
{
|
||||||
|
IConfigurationPanelProvider configurationPanelProvider;
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("ShowWelcomePage", true))
|
if (Utils.GetBooleanSetting("ShowWelcomePage", true))
|
||||||
|
{
|
||||||
new WelcomeForm().ShowDialog();
|
new WelcomeForm().ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
_controlPanel = new SettingsPanel();
|
_controlPanel = new SettingsPanel();
|
||||||
windowMessages = new TopWindowMessages(); // TODO: do something when "EnableRPCInvite" is set to false
|
windowMessages = new TopWindowMessages(); // TODO: do something when "EnableRPCInvite" is set to false
|
||||||
_control = control;
|
_control = control;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||||
|
{
|
||||||
_control.RegisterFrontControl(windowMessages, PluginPosition.Top);
|
_control.RegisterFrontControl(windowMessages, PluginPosition.Top);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.ToString());
|
MessageBox.Show(ex.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||||
{
|
{
|
||||||
presence.Secrets = new Secrets()
|
presence.Secrets = new Secrets()
|
||||||
@ -81,8 +77,12 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
Max = 100
|
Max = 100
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||||
|
{
|
||||||
windowMessages.Show();
|
windowMessages.Show();
|
||||||
|
}
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("EnableRPC", true))
|
if (Utils.GetBooleanSetting("EnableRPC", true))
|
||||||
{
|
{
|
||||||
if (RPCalreadyLoaded)
|
if (RPCalreadyLoaded)
|
||||||
@ -91,15 +91,20 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Utils.GetStringSetting("ClientID").Replace(" ", "").Length != 18)
|
if (Utils.GetStringSetting("ClientID").Replace(" ", "").Length != 18)
|
||||||
|
{
|
||||||
client = new DiscordRpcClient("765213507321856078", pipe: discordPipe)
|
client = new DiscordRpcClient("765213507321856078", pipe: discordPipe)
|
||||||
{
|
{
|
||||||
Logger = new ConsoleLogger(logLevel, true)
|
Logger = new ConsoleLogger(logLevel, true)
|
||||||
};
|
};
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
|
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
|
||||||
{
|
{
|
||||||
Logger = new ConsoleLogger(logLevel, true)
|
Logger = new ConsoleLogger(logLevel, true)
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
client.RegisterUriScheme();
|
client.RegisterUriScheme();
|
||||||
client.OnRpcMessage += Client_OnRpcMessage;
|
client.OnRpcMessage += Client_OnRpcMessage;
|
||||||
client.OnPresenceUpdate += Client_OnPresenceUpdate;
|
client.OnPresenceUpdate += Client_OnPresenceUpdate;
|
||||||
@ -112,13 +117,16 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
client.OnUnsubscribe += OnUnsubscribe;
|
client.OnUnsubscribe += OnUnsubscribe;
|
||||||
client.OnJoin += OnJoin;
|
client.OnJoin += OnJoin;
|
||||||
client.OnJoinRequested += OnJoinRequested;
|
client.OnJoinRequested += OnJoinRequested;
|
||||||
//client.OnSpectate += OnSpectate;
|
|
||||||
presence.Timestamps = new Timestamps()
|
presence.Timestamps = new Timestamps()
|
||||||
{
|
{
|
||||||
Start = DateTime.UtcNow
|
Start = DateTime.UtcNow
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||||
|
{
|
||||||
client.SetSubscription(EventType.Join | EventType.JoinRequest);
|
client.SetSubscription(EventType.Join | EventType.JoinRequest);
|
||||||
|
}
|
||||||
|
|
||||||
client.SetPresence(presence);
|
client.SetPresence(presence);
|
||||||
client.Initialize();
|
client.Initialize();
|
||||||
try
|
try
|
||||||
@ -128,13 +136,15 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogWriter.WriteToFile("----> " + ex.ToString());
|
LogWriter.WriteToFile("----> " + ex);
|
||||||
MessageBox.Show($"Cannot get Spy Server Network address\n\nError:\n{ex}", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
MessageBox.Show($"Cannot get Spy Server Network address\n\nError:\n{ex}", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
}
|
}
|
||||||
_ = MainLoop();
|
_ = MainLoop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_controlPanel.ChangeStatus = "RPC is disabled";
|
_controlPanel.ChangeStatus = "RPC is disabled";
|
||||||
|
}
|
||||||
LogWriter.WriteToFile("EOM Initialize");
|
LogWriter.WriteToFile("EOM Initialize");
|
||||||
}
|
}
|
||||||
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
|
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
|
||||||
@ -209,7 +219,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000).ConfigureAwait(false);
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
LogWriter.WriteToFile($"MainLoop called {isRunning} {client.IsInitialized}");
|
LogWriter.WriteToFile($"MainLoop called {isRunning} {client.IsInitialized}");
|
||||||
while (client != null && isRunning)
|
while (client != null && isRunning)
|
||||||
@ -229,7 +239,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogWriter.WriteToFile("Waiting 500ms in loop...");
|
LogWriter.WriteToFile("Waiting 500ms in loop...");
|
||||||
await Task.Delay(500);
|
await Task.Delay(500).ConfigureAwait(false);
|
||||||
if (_control.RdsRadioText != null)
|
if (_control.RdsRadioText != null)
|
||||||
{
|
{
|
||||||
if (_control.IsPlaying)
|
if (_control.IsPlaying)
|
||||||
@ -238,7 +248,10 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
playedBefore = true;
|
playedBefore = true;
|
||||||
}
|
}
|
||||||
else if (!_control.IsPlaying && playedBefore)
|
else if (!_control.IsPlaying && playedBefore)
|
||||||
|
{
|
||||||
presence.Assets.SmallImageKey = "pause";
|
presence.Assets.SmallImageKey = "pause";
|
||||||
|
}
|
||||||
|
|
||||||
if (!playedBefore)
|
if (!playedBefore)
|
||||||
{
|
{
|
||||||
presence.Details = "Frequency: Not playing";
|
presence.Details = "Frequency: Not playing";
|
||||||
@ -257,16 +270,20 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
LogWriter.WriteToFile("Setting presence...");
|
LogWriter.WriteToFile("Setting presence...");
|
||||||
presence.Details = $"Frequency: {string.Format("{0:#,0,,0 Hz}", _control.Frequency)}";
|
presence.Details = $"Frequency: {string.Format("{0:#,0,,0 Hz}", _control.Frequency)}";
|
||||||
if (string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
|
if (string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
|
||||||
|
{
|
||||||
presence.State = $"RDS: unknown{space_for_listen_list}";
|
presence.State = $"RDS: unknown{space_for_listen_list}";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
presence.State = $"RDS: {_control.RdsProgramService} - {_control.RdsRadioText}{space_for_listen_list}";
|
presence.State = $"RDS: {_control.RdsProgramService} - {_control.RdsRadioText}{space_for_listen_list}";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogWriter.WriteToFile(ex.ToString());
|
LogWriter.WriteToFile(ex.ToString());
|
||||||
}
|
}
|
||||||
/*presence.Secrets.JoinSecret = */
|
/* presence.Secrets.JoinSecret = */
|
||||||
//_control.RegisterFrontControl(Gui, PluginPosition.Top);
|
/* _control.RegisterFrontControl(Gui, PluginPosition.Top); */
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -282,14 +299,18 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogWriter.WriteToFile("Frequency or Radio Text are null!");
|
LogWriter.WriteToFile("Frequency or Radio Text are null!");
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (client == null)
|
if (client == null)
|
||||||
|
{
|
||||||
_controlPanel.ChangeStatus = "Client was null";
|
_controlPanel.ChangeStatus = "Client was null";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
_controlPanel.ChangeStatus = "Presence stopped";
|
_controlPanel.ChangeStatus = "Presence stopped";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (ex.Message.Contains("The process cannot access the file"))
|
if (ex.Message.Contains("The process cannot access the 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("0.1.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
85
README.md
85
README.md
@ -1 +1,86 @@
|
|||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
[](https://app.codacy.com/gh/EnderIce2/SDR-RPC?utm_source=github.com&utm_medium=referral&utm_content=EnderIce2/SDR-RPC&utm_campaign=Badge_Grade_Settings)
|
||||||
|
[](https://www.codefactor.io/repository/github/enderice2/sdr-rpc)
|
||||||
|

|
||||||
# SDR-RPC
|
# SDR-RPC
|
||||||
|
|
||||||
|
SDR-RPC is an [SDRSharp](https://airspy.com/download/) plugin that adds Discord RPC feature in it
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✨Features
|
||||||
|
- 🎛Enable / Disable
|
||||||
|
- ✏Showing frequency, play state and RDS almost in realtime
|
||||||
|
- 🔌Most of the code is made asynchronous
|
||||||
|
- 📖Logging for troubleshooting problems
|
||||||
|
- 🔨Easy to install
|
||||||
|
- 🎧Invite feature (give Spy Server Address or listen using voice chat system) [coming soon]
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🎁How to install
|
||||||
|
|
||||||
|
📽Video:
|
||||||
|
|
||||||
|
[](http://www.youtube.com/watch?v=Otn-xSn_ioI "")
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🎫Example
|
||||||
|
|
||||||
|
📽Video:
|
||||||
|
|
||||||
|
[](http://www.youtube.com/watch?v=7k02dPqAjBA "")
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 💻Building by yourself
|
||||||
|
|
||||||
|
1. You need to download this stuff before compiling:
|
||||||
|
- [Visual Studio 2019](https://visualstudio.microsoft.com/vs/)
|
||||||
|
- [.NET 4.6](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net46-developer-pack-offline-installer)
|
||||||
|
- SDRSharp files (for References)
|
||||||
|
- SDRSharp.exe
|
||||||
|
- SDRSharp.Common.dll
|
||||||
|
- SDRSharp.PanView.dll
|
||||||
|
- SDRSharp.Radio.dll
|
||||||
|
|
||||||
|
2. Click "Code" and select "Open with Visual Studio" or "Download ZIP"
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3. If you downloaded as ZIP, unzip the archive and double click on "SDRSharpPlugin.DiscordRPC.sln"
|
||||||
|
4. Build it and move files to SDR# location (if the compile fails try copying Reference files into /bin/Debug or /bin/Release folder)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 👀Setting your custom images on RPC
|
||||||
|
|
||||||
|
1. Go to https://discord.com/developers/applications and create your own application
|
||||||
|
2. Name it "SDRSharp" or something similar
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3. Go to Rich Presence > Rich Presence Assets and add your own images with these names:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
4. Go back to General Information and copy Client ID
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
5. Paste the Client ID you copied earlier in plugin textbox from SDRSharp and press the ENTER key
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
6. Restart the SDRSharp and it should be changed with your custom images
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 📕TODO List
|
||||||
|
|
||||||
|
- Invite people to get Spy Server Address or connecting via voice chat system to listen and having the ability to change the frequency
|
||||||
|
- Change Settings Panel to WPF User Control
|
||||||
|
- Add better RDS decoder (if it is even possible)
|
||||||
|
@ -165,7 +165,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="DiscordAPI\LICENSE.txt" />
|
<Content Include="DiscordAPI\LICENSE.txt" />
|
||||||
<Content Include="Resgister.txt">
|
<Content Include="Register.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -26,17 +26,31 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||||
if (Utils.GetBooleanSetting("EnableRPC", true))
|
if (Utils.GetBooleanSetting("EnableRPC", true))
|
||||||
|
{
|
||||||
checkBox1.Checked = true;
|
checkBox1.Checked = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
checkBox1.Checked = false;
|
checkBox1.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("LogRPC", false))
|
if (Utils.GetBooleanSetting("LogRPC", false))
|
||||||
|
{
|
||||||
checkBox2.Checked = true;
|
checkBox2.Checked = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
checkBox2.Checked = false;
|
checkBox2.Checked = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||||
|
{
|
||||||
checkBox3.Checked = true;
|
checkBox3.Checked = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
checkBox3.Checked = false;
|
checkBox3.Checked = false;
|
||||||
|
}
|
||||||
LogWriter.WriteToFile("SettingsPanel loaded");
|
LogWriter.WriteToFile("SettingsPanel loaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +59,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
|
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
|
||||||
label1.Text = "Restart required";
|
label1.Text = "Restart required";
|
||||||
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
|
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
|
||||||
//Utils.GetBooleanSetting("EnableRPC");
|
/* Utils.GetBooleanSetting("EnableRPC"); */
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button1_Click(object sender, EventArgs e)
|
private void Button1_Click(object sender, EventArgs e)
|
||||||
@ -61,10 +75,15 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
|
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
{
|
{
|
||||||
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
|
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
|
||||||
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
|
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
|
||||||
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
@ -73,7 +92,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
Utils.SaveSetting("ClientID", textBox1.Text);
|
Utils.SaveSetting("ClientID", textBox1.Text);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
e.SuppressKeyPress = true;
|
e.SuppressKeyPress = true;
|
||||||
await Task.Delay(200);
|
await Task.Delay(200).ConfigureAwait(false);
|
||||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||||
label1.Text = "Saved.";
|
label1.Text = "Saved.";
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
LogWriter.WriteToFile(value);
|
LogWriter.WriteToFile(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool AnswerA = false;
|
private bool AnswerA;
|
||||||
private bool AnswerD = false;
|
private bool AnswerD;
|
||||||
public async Task<bool> RequestAnswer(DiscordRpcClient client, JoinRequestMessage args)
|
public async Task<bool> RequestAnswer(DiscordRpcClient client, JoinRequestMessage args)
|
||||||
{
|
{
|
||||||
LogWriter.WriteToFile("Incoming RPC request from " + args.User.Username);
|
LogWriter.WriteToFile("Incoming RPC request from " + args.User.Username);
|
||||||
@ -37,7 +37,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
{
|
{
|
||||||
LogWriter.WriteToFile("waiting...");
|
LogWriter.WriteToFile("waiting...");
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
await Task.Delay(200);
|
await Task.Delay(200).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
bool tmpansw = AnswerA;
|
bool tmpansw = AnswerA;
|
||||||
LogWriter.WriteToFile($"Client sent an answer. {tmpansw}");
|
LogWriter.WriteToFile($"Client sent an answer. {tmpansw}");
|
||||||
@ -46,18 +46,21 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
AnswerD = false;
|
AnswerD = false;
|
||||||
button1.Visible = false;
|
button1.Visible = false;
|
||||||
button2.Visible = false;
|
button2.Visible = false;
|
||||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
||||||
SetDefaultTextInLabel(tmpansw);
|
SetDefaultTextInLabel(tmpansw);
|
||||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
||||||
return tmpansw;
|
return tmpansw;
|
||||||
}
|
}
|
||||||
private async Task SetDefaultTextInLabel(bool accepted)
|
private async Task SetDefaultTextInLabel(bool accepted)
|
||||||
{
|
{
|
||||||
if (accepted)
|
if (accepted)
|
||||||
|
{
|
||||||
ChangeLabel = $"SDR# RPC | Request accepted";
|
ChangeLabel = $"SDR# RPC | Request accepted";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ChangeLabel = $"SDR# RPC | Request declined";
|
ChangeLabel = $"SDR# RPC | Request declined";
|
||||||
await Task.Delay(5000);
|
}
|
||||||
|
|
||||||
|
await Task.Delay(5000).ConfigureAwait(false);
|
||||||
ChangeLabel = $"SDR# RPC | Ready";
|
ChangeLabel = $"SDR# RPC | Ready";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user