mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-07-15 07:59:13 +00:00
Compare commits
50 Commits
Author | SHA1 | Date | |
---|---|---|---|
d303158d1c | |||
94385a30ec | |||
6969375c2e | |||
2566a97b73 | |||
f1bd9120d8 | |||
06e389b035 | |||
d7997418c0 | |||
235e13e948 | |||
805f8c408b | |||
f4845c49e0 | |||
da9b48cf7c | |||
0c4311a936 | |||
29b9b5a6cf | |||
c478046c18 | |||
c9dadfb41c | |||
9cbd7dd67e | |||
a441168176 | |||
3b8ede239b | |||
ede61b75ed | |||
0cc81d35e2 | |||
e120cb0795 | |||
9864925bcd | |||
ad3a91d314 | |||
bf44bd1076 | |||
0b51536839 | |||
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]
|
||||
- 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**
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
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 is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
24
LogWriter.cs
24
LogWriter.cs
@ -7,24 +7,16 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public static void WriteToFile(string Message)
|
||||
{
|
||||
if (!SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
|
||||
return;
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
|
||||
if (!Directory.Exists(path))
|
||||
if (SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
string filepath = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\DiscordRPCLog_" + DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".log";
|
||||
if (!File.Exists(filepath))
|
||||
{
|
||||
using StreamWriter sw = File.CreateText(filepath);
|
||||
sw.WriteLine($"[{DateTime.Now}] {Message}");
|
||||
}
|
||||
else
|
||||
{
|
||||
using StreamWriter sw = File.AppendText(filepath);
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
using StreamWriter sw = File.AppendText(AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\DiscordRPCLog_" + DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".log");
|
||||
sw.WriteLine($"[{DateTime.Now}] {Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
253
MainPlugin.cs
253
MainPlugin.cs
@ -12,21 +12,20 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public class MainPlugin : ISharpPlugin
|
||||
{
|
||||
private const string _displayName = "Discord RPC";
|
||||
private SettingsPanel _controlPanel;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
||||
private static LogLevel logLevel = LogLevel.Trace;
|
||||
[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>")]
|
||||
bool RPCalreadyLoaded = false;
|
||||
private const LogLevel logLevel = LogLevel.Trace;
|
||||
private const int discordPipe = -1;
|
||||
|
||||
private ISharpControl _control;
|
||||
bool playedBefore = false;
|
||||
private IConfigurationPanelProvider configurationPanelProvider;
|
||||
private SDRSharp.FrontEnds.SpyServer.ControllerPanel controllerPanel;
|
||||
public TopWindowMessages windowMessages;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
|
||||
private RichPresence presence = new RichPresence()
|
||||
private bool playedBefore;
|
||||
|
||||
private DiscordRpcClient client;
|
||||
private bool isRunning = true;
|
||||
public bool HasGui => true;
|
||||
public string DisplayName => "Discord RPC";
|
||||
public UserControl Gui => _controlPanel;
|
||||
|
||||
private readonly RichPresence presence = new RichPresence()
|
||||
{
|
||||
Details = "Loading...",
|
||||
State = "Loading...",
|
||||
@ -35,71 +34,25 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
LargeImageKey = "image_large",
|
||||
LargeImageText = "SDRSharp",
|
||||
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}"
|
||||
}
|
||||
};
|
||||
private static DiscordRpcClient client;
|
||||
private static bool isRunning = true;
|
||||
public string DisplayName
|
||||
{
|
||||
get { return _displayName; }
|
||||
}
|
||||
public bool HasGui
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
public UserControl Gui
|
||||
{
|
||||
get { return _controlPanel; }
|
||||
}
|
||||
|
||||
public void Initialize(ISharpControl control)
|
||||
{
|
||||
if (Utils.GetBooleanSetting("ShowWelcomePage", true))
|
||||
new WelcomeForm().ShowDialog();
|
||||
_controlPanel = new SettingsPanel();
|
||||
windowMessages = new TopWindowMessages(); // TODO: do something when "EnableRPCInvite" is set to false
|
||||
_control = control;
|
||||
try
|
||||
{
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
_control.RegisterFrontControl(windowMessages, PluginPosition.Top);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
}
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
{
|
||||
presence.Secrets = new Secrets()
|
||||
{
|
||||
JoinSecret = "invalid_secret"
|
||||
};
|
||||
presence.Party = new Party()
|
||||
{
|
||||
ID = Secrets.CreateFriendlySecret(new Random()),
|
||||
Size = 1,
|
||||
Max = 100
|
||||
};
|
||||
}
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
windowMessages.Show();
|
||||
if (Utils.GetBooleanSetting("EnableRPC", true))
|
||||
{
|
||||
if (RPCalreadyLoaded)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "Restart required";
|
||||
return;
|
||||
}
|
||||
if (Utils.GetStringSetting("ClientID").Replace(" ", "").Length != 18)
|
||||
client = new DiscordRpcClient("765213507321856078", pipe: discordPipe)
|
||||
{
|
||||
Logger = new ConsoleLogger(logLevel, true)
|
||||
};
|
||||
else
|
||||
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
|
||||
{
|
||||
Logger = new ConsoleLogger(logLevel, true)
|
||||
};
|
||||
{
|
||||
Utils.SaveSetting("ClientID", "765213507321856078");
|
||||
}
|
||||
client = new DiscordRpcClient(Utils.GetStringSetting("ClientID"), pipe: discordPipe)
|
||||
{
|
||||
Logger = new ConsoleLogger(logLevel, true)
|
||||
};
|
||||
|
||||
client.RegisterUriScheme();
|
||||
client.OnRpcMessage += Client_OnRpcMessage;
|
||||
client.OnPresenceUpdate += Client_OnPresenceUpdate;
|
||||
@ -108,128 +61,33 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
client.OnError += OnError;
|
||||
client.OnConnectionEstablished += OnConnectionEstablished;
|
||||
client.OnConnectionFailed += OnConnectionFailed;
|
||||
client.OnSubscribe += OnSubscribe;
|
||||
client.OnUnsubscribe += OnUnsubscribe;
|
||||
client.OnJoin += OnJoin;
|
||||
client.OnJoinRequested += OnJoinRequested;
|
||||
//client.OnSpectate += OnSpectate;
|
||||
presence.Timestamps = new Timestamps()
|
||||
{
|
||||
Start = DateTime.UtcNow
|
||||
};
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
client.SetSubscription(EventType.Join | EventType.JoinRequest);
|
||||
client.SetPresence(presence);
|
||||
client.Initialize();
|
||||
try
|
||||
{
|
||||
configurationPanelProvider = (IConfigurationPanelProvider)_control.Source;
|
||||
controllerPanel = (SDRSharp.FrontEnds.SpyServer.ControllerPanel)configurationPanelProvider.Gui;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogWriter.WriteToFile("----> " + ex.ToString());
|
||||
MessageBox.Show($"Cannot get Spy Server Network address\n\nError:\n{ex}", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
_ = MainLoop();
|
||||
}
|
||||
else
|
||||
{
|
||||
_controlPanel.ChangeStatus = "RPC is disabled";
|
||||
}
|
||||
LogWriter.WriteToFile("EOM Initialize");
|
||||
}
|
||||
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
|
||||
{
|
||||
LogWriter.WriteToFile($"[RpcMessage] | Presence state: {args.Presence.State}");
|
||||
}
|
||||
private void Client_OnRpcMessage(object sender, IMessage msg)
|
||||
{
|
||||
LogWriter.WriteToFile($"[RpcMessage] | {msg.Type} | {msg}");
|
||||
}
|
||||
private void OnConnectionFailed(object sender, ConnectionFailedMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = $"RPC Connection Failed!\n{args.Type} | {args.FailedPipe}";
|
||||
}
|
||||
private void OnConnectionEstablished(object sender, ConnectionEstablishedMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "RPC Connection Established!";
|
||||
}
|
||||
private void OnError(object sender, ErrorMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = $"RPC Error:\n{args.Message}";
|
||||
windowMessages.ChangeLabel = "SDR# RPC | Internal error";
|
||||
}
|
||||
private void OnClose(object sender, CloseMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "RPC Closed";
|
||||
windowMessages.ChangeLabel = "SDR# RPC | Closed";
|
||||
Close();
|
||||
}
|
||||
private void OnReady(object sender, ReadyMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "RPC Ready";
|
||||
windowMessages.ChangeLabel = "SDR# RPC | Ready";
|
||||
}
|
||||
private void OnSubscribe(object sender, SubscribeMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = $"Subscribed: {args.Event}";
|
||||
}
|
||||
private void OnUnsubscribe(object sender, UnsubscribeMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = $"Unsubscribed: {args.Event}";
|
||||
}
|
||||
private void OnJoin(object sender, JoinMessage args)
|
||||
{
|
||||
presence.Party.Size++;
|
||||
presence.Secrets.JoinSecret = args.Secret;
|
||||
MessageBox.Show("OnJoin: " + args.Secret);
|
||||
_control.StopRadio();
|
||||
_control.RefreshSource(true);
|
||||
Utils.SaveSetting("spyserver.uri", args.Secret);
|
||||
_control.StartRadio();
|
||||
}
|
||||
private async void OnJoinRequested(object sender, JoinRequestMessage args)
|
||||
|
||||
private async Task MainLoop()
|
||||
{
|
||||
loop_start:
|
||||
try
|
||||
{
|
||||
if (await windowMessages.RequestAnswer(client, args))
|
||||
{
|
||||
MessageBox.Show("Accepted RequestAnswer");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Declined RequestAnswer");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
}
|
||||
}
|
||||
async Task MainLoop()
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
await Task.Delay(2000).ConfigureAwait(false);
|
||||
isRunning = true;
|
||||
LogWriter.WriteToFile($"MainLoop called {isRunning} {client.IsInitialized}");
|
||||
while (client != null && isRunning)
|
||||
{
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
{
|
||||
LogWriter.WriteToFile("Setting secret...");
|
||||
try
|
||||
{
|
||||
string sdr_url = "sdr://" + controllerPanel.Host + ":" + controllerPanel.Port + "/";
|
||||
LogWriter.WriteToFile(sdr_url);
|
||||
presence.Secrets.JoinSecret = sdr_url;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogWriter.WriteToFile(ex.ToString());
|
||||
}
|
||||
}
|
||||
LogWriter.WriteToFile("Waiting 500ms in loop...");
|
||||
await Task.Delay(500);
|
||||
LogWriter.WriteToFile("Waiting 5000ms in loop...");
|
||||
await Task.Delay(5000).ConfigureAwait(false); // 5 second delay
|
||||
if (_control.RdsRadioText != null)
|
||||
{
|
||||
if (_control.IsPlaying)
|
||||
@ -238,7 +96,10 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
playedBefore = true;
|
||||
}
|
||||
else if (!_control.IsPlaying && playedBefore)
|
||||
{
|
||||
presence.Assets.SmallImageKey = "pause";
|
||||
}
|
||||
|
||||
if (!playedBefore)
|
||||
{
|
||||
presence.Details = "Frequency: Not playing";
|
||||
@ -248,25 +109,27 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
try
|
||||
{
|
||||
string space_for_listen_list = " | ";
|
||||
if (!Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
space_for_listen_list = "";
|
||||
LogWriter.WriteToFile($"Frequency: {_control.Frequency}");
|
||||
LogWriter.WriteToFile($"RdsRadioText: {_control.RdsRadioText}");
|
||||
LogWriter.WriteToFile($"RdsProgramService: {_control.RdsProgramService}");
|
||||
LogWriter.WriteToFile("Setting presence...");
|
||||
presence.Details = $"Frequency: {string.Format("{0:#,0,,0 Hz}", _control.Frequency)}";
|
||||
if (string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
|
||||
presence.State = $"RDS: unknown{space_for_listen_list}";
|
||||
presence.Details = $"Frequency: {$"{_control.Frequency:#,0,,0 Hz}"}";
|
||||
if (!string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
|
||||
{
|
||||
string radio_text = string.IsNullOrWhiteSpace(_control.RdsRadioText) ? "" : $" - {_control.RdsRadioText}";
|
||||
presence.State = _control.FmStereo
|
||||
? $"RDS: ((( {_control.RdsProgramService} ))){radio_text}"
|
||||
: $"RDS: {_control.RdsProgramService}{radio_text}";
|
||||
}
|
||||
else
|
||||
presence.State = $"RDS: {_control.RdsProgramService} - {_control.RdsRadioText}{space_for_listen_list}";
|
||||
{
|
||||
presence.State = $"RDS: unknown";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogWriter.WriteToFile(ex.ToString());
|
||||
}
|
||||
/*presence.Secrets.JoinSecret = */
|
||||
//_control.RegisterFrontControl(Gui, PluginPosition.Top);
|
||||
}
|
||||
try
|
||||
{
|
||||
@ -282,30 +145,52 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
else
|
||||
{
|
||||
LogWriter.WriteToFile("Frequency or Radio Text are null!");
|
||||
await Task.Delay(1000);
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
if (client == null)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "Client was null";
|
||||
}
|
||||
else
|
||||
{
|
||||
_controlPanel.ChangeStatus = "Presence stopped";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Message.Contains("The process cannot access the file"))
|
||||
{
|
||||
_ = MainLoop();
|
||||
return;
|
||||
goto loop_start;
|
||||
}
|
||||
_controlPanel.ChangeStatus = $"RPC Update Error\n{ex.Message}";
|
||||
LogWriter.WriteToFile(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
LogWriter.WriteToFile("Close called");
|
||||
isRunning = false;
|
||||
client.Dispose();
|
||||
}
|
||||
|
||||
private void Client_OnPresenceUpdate(object sender, PresenceMessage args) => LogWriter.WriteToFile($"[RpcMessage] | Presence state: {args.Presence.State}");
|
||||
|
||||
private void Client_OnRpcMessage(object sender, IMessage msg) => LogWriter.WriteToFile($"[RpcMessage] | {msg.Type} | {msg}");
|
||||
|
||||
private void OnConnectionFailed(object sender, ConnectionFailedMessage args) => _controlPanel.ChangeStatus = $"RPC Connection Failed!\n{args.Type} | {args.FailedPipe}";
|
||||
|
||||
private void OnConnectionEstablished(object sender, ConnectionEstablishedMessage args) => _controlPanel.ChangeStatus = "RPC Connection Established!";
|
||||
|
||||
private void OnError(object sender, ErrorMessage args) => _controlPanel.ChangeStatus = $"RPC Error:\n{args.Message}";
|
||||
|
||||
private void OnClose(object sender, CloseMessage args)
|
||||
{
|
||||
_controlPanel.ChangeStatus = "RPC Closed";
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnReady(object sender, ReadyMessage args) => _controlPanel.ChangeStatus = "RPC Ready";
|
||||
}
|
||||
}
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 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("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
|
73
Properties/Resources.Designer.cs
generated
Normal file
73
Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DiscordRPC.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DiscordRPC.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap gear {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("gear", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,44 +117,8 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="richTextBox1.Text" xml:space="preserve">
|
||||
<value>-----------------------------------------------------------------------------------
|
||||
URL for discord-rpc-csharp: https://github.com/Lachee/discord-rpc-csharp
|
||||
License for discord-rpc-csharp:
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Lachee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-----------------------------------------------------------------------------------
|
||||
URL for Newtonsoft.Json: https://github.com/JamesNK/Newtonsoft.Json
|
||||
License for Newtonsoft.Json:
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DE</value>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="gear" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\gear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
83
README.md
83
README.md
@ -1 +1,84 @@
|
||||

|
||||

|
||||

|
||||
[](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)
|
||||
[](https://twitter.com/intent/follow?screen_name=enderice22)
|
||||
# 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 Plugin SDK](https://airspy.com/?ddownload=5944)
|
||||
- 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 match SDR# theme
|
||||
|
BIN
Resources/gear.png
Normal file
BIN
Resources/gear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -43,12 +43,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="SDRSharp, Version=1.0.0.1765, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Downloads\sdrsharp-x86\SDRSharp.exe</HintPath>
|
||||
<HintPath>packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SDRSharp.Common, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
@ -65,6 +60,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@ -133,44 +129,46 @@
|
||||
<Compile Include="LogWriter.cs" />
|
||||
<Compile Include="MainPlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanel.Designer.cs">
|
||||
<DependentUpon>SettingsPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TopWindowMessages.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TopWindowMessages.Designer.cs">
|
||||
<DependentUpon>TopWindowMessages.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WelcomeForm.cs">
|
||||
<Compile Include="SettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="WelcomeForm.Designer.cs">
|
||||
<DependentUpon>WelcomeForm.cs</DependentUpon>
|
||||
<Compile Include="SettingsForm.Designer.cs">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SettingsPanel.resx">
|
||||
<DependentUpon>SettingsPanel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TopWindowMessages.resx">
|
||||
<DependentUpon>TopWindowMessages.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="WelcomeForm.resx">
|
||||
<DependentUpon>WelcomeForm.cs</DependentUpon>
|
||||
<EmbeddedResource Include="SettingsForm.resx">
|
||||
<DependentUpon>SettingsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="DiscordAPI\LICENSE.txt" />
|
||||
<Content Include="Resgister.txt">
|
||||
<Content Include="Register.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Resources\gear.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".editorconfig" />
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
188
SettingsForm.Designer.cs
generated
Normal file
188
SettingsForm.Designer.cs
generated
Normal file
@ -0,0 +1,188 @@
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
partial class SettingsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button1.Location = new System.Drawing.Point(200, 126);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "&OK";
|
||||
this.button1.UseVisualStyleBackColor = false;
|
||||
this.button1.Click += new System.EventHandler(this.Button1_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F);
|
||||
this.label1.Location = new System.Drawing.Point(6, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(241, 24);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "DiscordRPC Plugin Settings";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button2.Location = new System.Drawing.Point(12, 126);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(93, 23);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "Support Me";
|
||||
this.button2.UseVisualStyleBackColor = false;
|
||||
this.button2.Click += new System.EventHandler(this.Button2_Click);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(12, 105);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(205, 17);
|
||||
this.checkBox1.TabIndex = 6;
|
||||
this.checkBox1.Text = "Enable Logging (for debugging)";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged_1);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.textBox1.Location = new System.Drawing.Point(12, 49);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(263, 21);
|
||||
this.textBox1.TabIndex = 7;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(13, 33);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(63, 13);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Client ID:";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button3.Location = new System.Drawing.Point(141, 76);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(64, 23);
|
||||
this.button3.TabIndex = 9;
|
||||
this.button3.Text = "Reset";
|
||||
this.button3.UseVisualStyleBackColor = false;
|
||||
this.button3.Click += new System.EventHandler(this.Button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button4.Location = new System.Drawing.Point(211, 76);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(64, 23);
|
||||
this.button4.TabIndex = 10;
|
||||
this.button4.Text = "Apply";
|
||||
this.button4.UseVisualStyleBackColor = false;
|
||||
this.button4.Click += new System.EventHandler(this.Button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button5.Location = new System.Drawing.Point(111, 126);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(83, 23);
|
||||
this.button5.TabIndex = 11;
|
||||
this.button5.Text = "Licenses";
|
||||
this.button5.UseVisualStyleBackColor = false;
|
||||
this.button5.Click += new System.EventHandler(this.Button5_Click);
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(28)))), ((int)(((byte)(28)))));
|
||||
this.ClientSize = new System.Drawing.Size(287, 161);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SettingsForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "SDRSharp Discord RPC Settings";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
}
|
||||
}
|
63
SettingsForm.cs
Normal file
63
SettingsForm.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using SDRSharp.Radio;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||
checkBox1.Checked = Utils.GetBooleanSetting("LogRPC", false);
|
||||
}
|
||||
|
||||
private void Button2_Click(object sender, EventArgs e) => System.Diagnostics.Process.Start("https://ko-fi.com/enderice2");
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e) => Utils.SaveSetting("ShowWelcomePage", !checkBox1.Checked);
|
||||
|
||||
private void Button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("MIT License\n\nCopyright (c) 2018 Lachee\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "discord-rpc-csharp");
|
||||
MessageBox.Show("The MIT License (MIT)\n\nCopyright(c) 2007 James Newton-King\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "Newtonsoft.Json");
|
||||
}
|
||||
|
||||
private void CheckBox1_CheckedChanged_1(object sender, EventArgs e) => Utils.SaveSetting("LogRPC", checkBox1.Checked);
|
||||
|
||||
private void Button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text.Replace(" ", "").Replace("\n", "").Replace("\r", "");
|
||||
if (!int.TryParse(textBox1.Text, out _) || textBox1.Text.Length != 18)
|
||||
{
|
||||
MessageBox.Show("Invalid Client ID!");
|
||||
}
|
||||
Utils.SaveSetting("ClientID", textBox1.Text);
|
||||
label1.Text = $"Configuration Updated.\nNew ID: {Utils.GetStringSetting("ClientID")}";
|
||||
}
|
||||
|
||||
private void Button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("ClientID", "765213507321856078");
|
||||
textBox1.Text = "765213507321856078";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//try
|
||||
//{
|
||||
// System.Diagnostics.Process.Start("https://github.com/EnderIce2/SDR-RPC"); // open the url (on some systems can show "The system cannot find the file specified.")
|
||||
//}
|
||||
//catch (System.ComponentModel.Win32Exception) // The system cannot find the file specified.
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// System.Diagnostics.Process.Start("iexplore", "https://github.com/EnderIce2/SDR-RPC"); // open the url with internet explorer
|
||||
// }
|
||||
// catch (System.ComponentModel.Win32Exception) // The system cannot find the file specified.
|
||||
// {
|
||||
// System.Diagnostics.Process.Start("notepad", "https://github.com/EnderIce2/SDR-RPC"); // if internet explorer is not installed (idk how we can get to that point but whatever), open the link in notepad
|
||||
// }
|
||||
//}
|
96
SettingsPanel.Designer.cs
generated
96
SettingsPanel.Designer.cs
generated
@ -30,11 +30,7 @@
|
||||
{
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.checkBox3 = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkBox1
|
||||
@ -43,9 +39,11 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.checkBox1.Checked = true;
|
||||
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.checkBox1.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.checkBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.checkBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(146, 21);
|
||||
this.checkBox1.Size = new System.Drawing.Size(153, 21);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.Text = "Enable Discord RPC";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
@ -56,100 +54,54 @@
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoEllipsis = true;
|
||||
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.label1.Location = new System.Drawing.Point(0, 67);
|
||||
this.label1.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.label1.Location = new System.Drawing.Point(0, 28);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(196, 70);
|
||||
this.label1.Size = new System.Drawing.Size(200, 132);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Loading status...";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.textBox1.Location = new System.Drawing.Point(56, 143);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(134, 13);
|
||||
this.textBox1.TabIndex = 2;
|
||||
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBox1_KeyDown);
|
||||
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBox1_KeyPress);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(0, 143);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(50, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Client ID:";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(147, 3);
|
||||
this.button1.BackgroundImage = global::DiscordRPC.Properties.Resources.gear;
|
||||
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.button1.FlatAppearance.BorderSize = 0;
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button1.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.button1.Location = new System.Drawing.Point(175, 0);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(46, 23);
|
||||
this.button1.Size = new System.Drawing.Size(25, 25);
|
||||
this.button1.TabIndex = 4;
|
||||
this.button1.Text = "Help";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.Button1_Click);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.checkBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F);
|
||||
this.checkBox2.Location = new System.Drawing.Point(3, 25);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(158, 21);
|
||||
this.checkBox2.TabIndex = 5;
|
||||
this.checkBox2.Text = "Log RPC (for debugging)";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.CheckedChanged += new System.EventHandler(this.CheckBox2_CheckedChanged);
|
||||
//
|
||||
// checkBox3
|
||||
//
|
||||
this.checkBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.checkBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F);
|
||||
this.checkBox3.Location = new System.Drawing.Point(3, 43);
|
||||
this.checkBox3.Name = "checkBox3";
|
||||
this.checkBox3.Size = new System.Drawing.Size(193, 21);
|
||||
this.checkBox3.TabIndex = 6;
|
||||
this.checkBox3.Text = "Enable Invite Feature (not tested)";
|
||||
this.checkBox3.UseVisualStyleBackColor = true;
|
||||
this.checkBox3.CheckedChanged += new System.EventHandler(this.CheckBox3_CheckedChanged);
|
||||
//
|
||||
// SettingsPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.checkBox3);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.checkBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.MinimumSize = new System.Drawing.Size(200, 160);
|
||||
this.Name = "SettingsPanel";
|
||||
this.Size = new System.Drawing.Size(196, 163);
|
||||
this.Size = new System.Drawing.Size(200, 160);
|
||||
this.Load += new System.EventHandler(this.SettingsPanel_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
private System.Windows.Forms.CheckBox checkBox3;
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,7 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
private string _ChangeStatus;
|
||||
public string ChangeStatus
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ChangeStatus;
|
||||
}
|
||||
get => _ChangeStatus;
|
||||
set
|
||||
{
|
||||
_ChangeStatus = value;
|
||||
@ -24,66 +21,27 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
public SettingsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||
if (Utils.GetBooleanSetting("EnableRPC", true))
|
||||
checkBox1.Checked = true;
|
||||
else
|
||||
checkBox1.Checked = false;
|
||||
if (Utils.GetBooleanSetting("LogRPC", false))
|
||||
checkBox2.Checked = true;
|
||||
else
|
||||
checkBox2.Checked = false;
|
||||
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
|
||||
checkBox3.Checked = true;
|
||||
else
|
||||
checkBox3.Checked = false;
|
||||
LogWriter.WriteToFile("SettingsPanel loaded");
|
||||
checkBox1.Checked = Utils.GetBooleanSetting("EnableRPC", true);
|
||||
LogWriter.WriteToFile("User Control Loaded");
|
||||
}
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e) => new SettingsForm().Show();
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
|
||||
label1.Text = "Restart required";
|
||||
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
|
||||
//Utils.GetBooleanSetting("EnableRPC");
|
||||
}
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e)
|
||||
private void SettingsPanel_Load(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://github.com/EnderIce2/SDR-RPC");
|
||||
}
|
||||
|
||||
private void CheckBox2_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("LogRPC", checkBox2.Checked);
|
||||
}
|
||||
|
||||
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
|
||||
e.Handled = true;
|
||||
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter && textBox1.Text.Replace(" ", "").Length == 18)
|
||||
{
|
||||
Utils.SaveSetting("ClientID", textBox1.Text);
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
await Task.Delay(200);
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||
label1.Text = "Saved.";
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckBox3_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("EnableRPCInvite", checkBox3.Checked);
|
||||
label1.Text = "Restart required";
|
||||
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox3.Checked}");
|
||||
// can't use bcz System.Drawing.Color is from dotnet core 5
|
||||
//MainPlugin._control.ThemeForeColor;
|
||||
//BackColor = MainPlugin._control.ThemePanelColor;
|
||||
//MainPlugin._control.ThemeBackColor;
|
||||
BackColor = System.Drawing.Color.FromArgb(15, 15, 15);
|
||||
ForeColor = System.Drawing.Color.FromArgb(244, 244, 244);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
108
TopWindowMessages.Designer.cs
generated
108
TopWindowMessages.Designer.cs
generated
@ -1,108 +0,0 @@
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
partial class TopWindowMessages
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
||||
this.button1.FlatAppearance.BorderSize = 0;
|
||||
this.button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Maroon;
|
||||
this.button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F);
|
||||
this.button1.Location = new System.Drawing.Point(629, 4);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Decline";
|
||||
this.button1.UseVisualStyleBackColor = false;
|
||||
this.button1.Visible = false;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
||||
this.button2.FlatAppearance.BorderSize = 0;
|
||||
this.button2.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Green;
|
||||
this.button2.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
|
||||
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F);
|
||||
this.button2.Location = new System.Drawing.Point(548, 4);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 1;
|
||||
this.button2.Text = "Accept";
|
||||
this.button2.UseVisualStyleBackColor = false;
|
||||
this.button2.Visible = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoEllipsis = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 4);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(304, 23);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Loading";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// TopWindowMessages
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.25F);
|
||||
this.MaximumSize = new System.Drawing.Size(9999999, 30);
|
||||
this.MinimumSize = new System.Drawing.Size(0, 30);
|
||||
this.Name = "TopWindowMessages";
|
||||
this.Size = new System.Drawing.Size(707, 30);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
using DiscordRPC;
|
||||
using DiscordRPC.Message;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public partial class TopWindowMessages : UserControl
|
||||
{
|
||||
public TopWindowMessages()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private string _ChangeLabel;
|
||||
public string ChangeLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _ChangeLabel;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ChangeLabel = value;
|
||||
label1.Text = value;
|
||||
LogWriter.WriteToFile(value);
|
||||
}
|
||||
}
|
||||
private bool AnswerA = false;
|
||||
private bool AnswerD = false;
|
||||
public async Task<bool> RequestAnswer(DiscordRpcClient client, JoinRequestMessage args)
|
||||
{
|
||||
LogWriter.WriteToFile("Incoming RPC request from " + args.User.Username);
|
||||
button1.Visible = true;
|
||||
button2.Visible = true;
|
||||
ChangeLabel = $"SDR# RPC | {args.User.Username} has requested to get Spy Server Network address.";
|
||||
while (!AnswerA || !AnswerD) // TODO: Rework
|
||||
{
|
||||
LogWriter.WriteToFile("waiting...");
|
||||
Application.DoEvents();
|
||||
await Task.Delay(200);
|
||||
}
|
||||
bool tmpansw = AnswerA;
|
||||
LogWriter.WriteToFile($"Client sent an answer. {tmpansw}");
|
||||
client.Respond(args, tmpansw);
|
||||
AnswerA = false;
|
||||
AnswerD = false;
|
||||
button1.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);
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
return tmpansw;
|
||||
}
|
||||
private async Task SetDefaultTextInLabel(bool accepted)
|
||||
{
|
||||
if (accepted)
|
||||
ChangeLabel = $"SDR# RPC | Request accepted";
|
||||
else
|
||||
ChangeLabel = $"SDR# RPC | Request declined";
|
||||
await Task.Delay(5000);
|
||||
ChangeLabel = $"SDR# RPC | Ready";
|
||||
}
|
||||
}
|
||||
}
|
135
WelcomeForm.Designer.cs
generated
135
WelcomeForm.Designer.cs
generated
@ -1,135 +0,0 @@
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
partial class WelcomeForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WelcomeForm));
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.richTextBox1.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 58);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.Size = new System.Drawing.Size(776, 327);
|
||||
this.richTextBox1.TabIndex = 0;
|
||||
this.richTextBox1.Text = resources.GetString("richTextBox1.Text");
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(713, 415);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "&OK";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.Button1_Click);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(93, 419);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(160, 17);
|
||||
this.checkBox1.TabIndex = 2;
|
||||
this.checkBox1.Text = "Don\'t show me this next time";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F);
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(170, 24);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "DiscordRPC Plugin";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 42);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(52, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Licenses:";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(12, 415);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "Support Me";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.Button2_Click);
|
||||
//
|
||||
// WelcomeForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(816, 489);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(816, 489);
|
||||
this.Name = "WelcomeForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Thank you for installing DiscordRPC by EnderIce2";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button2;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
using SDRSharp.Radio;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public partial class WelcomeForm : Form
|
||||
{
|
||||
public WelcomeForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://ko-fi.com/enderice2");
|
||||
}
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("ShowWelcomePage", !checkBox1.Checked);
|
||||
}
|
||||
}
|
||||
}
|
11
app.config
Normal file
11
app.config
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Drawing.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net46" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net46" />
|
||||
</packages>
|
Reference in New Issue
Block a user