mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-05-27 20:04:27 +00:00
This commit is contained in:
parent
59fda87954
commit
7d2a7d3dc0
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,8 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
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()
|
||||||
{
|
{
|
||||||
@ -37,7 +36,7 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static DiscordRpcClient client;
|
private static DiscordRpcClient client;
|
||||||
private static bool isRunning = true;
|
private bool isRunning = true;
|
||||||
public string DisplayName
|
public string DisplayName
|
||||||
{
|
{
|
||||||
get { return _displayName; }
|
get { return _displayName; }
|
||||||
@ -52,6 +51,8 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
}
|
}
|
||||||
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();
|
||||||
@ -63,7 +64,9 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
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)
|
||||||
{
|
{
|
||||||
@ -139,7 +142,10 @@ namespace EnderIce2.SDRSharpPlugin
|
|||||||
_ = 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)
|
||||||
@ -214,7 +220,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)
|
||||||
|
@ -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")]
|
||||||
|
@ -59,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");
|
// TODO: implement Utils.GetBooleanSetting("EnableRPC");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button1_Click(object sender, EventArgs e)
|
private void Button1_Click(object sender, EventArgs e)
|
||||||
@ -75,9 +75,14 @@ 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)
|
||||||
@ -87,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.";
|
||||||
}
|
}
|
||||||
|
@ -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}");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user