Skip to content

Commit 7d2a7d3

Browse files
author
EnderIce2
committed
1 parent 59fda87 commit 7d2a7d3

5 files changed

Lines changed: 23 additions & 9 deletions

File tree

LogWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ public static class LogWriter
88
public static void WriteToFile(string Message)
99
{
1010
if (!SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
11+
{
1112
return;
13+
}
14+
1215
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
1316
if (!Directory.Exists(path))
1417
{

MainPlugin.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ public class MainPlugin : ISharpPlugin
2020
bool RPCalreadyLoaded = false;
2121
private ISharpControl _control;
2222
bool playedBefore = false;
23-
private IConfigurationPanelProvider configurationPanelProvider;
2423
private SDRSharp.FrontEnds.SpyServer.ControllerPanel controllerPanel;
25-
public TopWindowMessages windowMessages;
24+
private TopWindowMessages windowMessages;
2625
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>")]
2726
private RichPresence presence = new RichPresence()
2827
{
@@ -37,7 +36,7 @@ public class MainPlugin : ISharpPlugin
3736
}
3837
};
3938
private static DiscordRpcClient client;
40-
private static bool isRunning = true;
39+
private bool isRunning = true;
4140
public string DisplayName
4241
{
4342
get { return _displayName; }
@@ -52,6 +51,8 @@ public UserControl Gui
5251
}
5352
public void Initialize(ISharpControl control)
5453
{
54+
IConfigurationPanelProvider configurationPanelProvider;
55+
5556
if (Utils.GetBooleanSetting("ShowWelcomePage", true))
5657
{
5758
new WelcomeForm().ShowDialog();
@@ -63,7 +64,9 @@ public void Initialize(ISharpControl control)
6364
try
6465
{
6566
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
67+
{
6668
_control.RegisterFrontControl(windowMessages, PluginPosition.Top);
69+
}
6770
}
6871
catch (Exception ex)
6972
{
@@ -139,7 +142,10 @@ public void Initialize(ISharpControl control)
139142
_ = MainLoop();
140143
}
141144
else
145+
{
142146
_controlPanel.ChangeStatus = "RPC is disabled";
147+
}
148+
143149
LogWriter.WriteToFile("EOM Initialize");
144150
}
145151
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
@@ -214,7 +220,7 @@ async Task MainLoop()
214220
{
215221
try
216222
{
217-
await Task.Delay(2000);
223+
await Task.Delay(2000).ConfigureAwait(false);
218224
isRunning = true;
219225
LogWriter.WriteToFile($"MainLoop called {isRunning} {client.IsInitialized}");
220226
while (client != null && isRunning)

Properties/AssemblyInfo.cs

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

SettingsPanel.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private void CheckBox1_CheckedChanged(object sender, EventArgs e)
5959
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
6060
label1.Text = "Restart required";
6161
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
62-
//Utils.GetBooleanSetting("EnableRPC");
62+
// TODO: implement Utils.GetBooleanSetting("EnableRPC");
6363
}
6464

6565
private void Button1_Click(object sender, EventArgs e)
@@ -75,9 +75,14 @@ private void CheckBox2_CheckedChanged(object sender, EventArgs e)
7575
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
7676
{
7777
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
78+
{
7879
e.Handled = true;
80+
}
81+
7982
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
83+
{
8084
e.Handled = true;
85+
}
8186
}
8287

8388
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
@@ -87,7 +92,7 @@ private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
8792
Utils.SaveSetting("ClientID", textBox1.Text);
8893
e.Handled = true;
8994
e.SuppressKeyPress = true;
90-
await Task.Delay(200);
95+
await Task.Delay(200).ConfigureAwait(false);
9196
textBox1.Text = Utils.GetStringSetting("ClientID");
9297
label1.Text = "Saved.";
9398
}

TopWindowMessages.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public async Task<bool> RequestAnswer(DiscordRpcClient client, JoinRequestMessag
3737
{
3838
LogWriter.WriteToFile("waiting...");
3939
Application.DoEvents();
40-
await Task.Delay(200);
40+
await Task.Delay(200).ConfigureAwait(false);
4141
}
4242
bool tmpansw = AnswerA;
4343
LogWriter.WriteToFile($"Client sent an answer. {tmpansw}");

0 commit comments

Comments
 (0)