Skip to content

Commit 4753a78

Browse files
author
EnderIce2
committed
1 parent 4913bb4 commit 4753a78

3 files changed

Lines changed: 12 additions & 18 deletions

File tree

MainPlugin.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,9 @@ public class MainPlugin : ISharpPlugin
3737
};
3838
private DiscordRpcClient client;
3939
private bool isRunning = true;
40-
public string DisplayName
41-
{
42-
get { return _displayName; }
43-
}
44-
public bool HasGui
45-
{
46-
get { return true; }
47-
}
48-
public UserControl Gui
49-
{
50-
get { return _controlPanel; }
51-
}
40+
public string DisplayName => _displayName;
41+
public bool HasGui => true;
42+
public UserControl Gui => _controlPanel;
5243
public void Initialize(ISharpControl control)
5344
{
5445
IConfigurationPanelProvider configurationPanelProvider;
@@ -72,6 +63,7 @@ public void Initialize(ISharpControl control)
7263
{
7364
MessageBox.Show(ex.ToString());
7465
}
66+
7567
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
7668
{
7769
presence.Secrets = new Secrets()
@@ -85,6 +77,7 @@ public void Initialize(ISharpControl control)
8577
Max = 100
8678
};
8779
}
80+
8881
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
8982
{
9083
windowMessages.Show();
@@ -128,8 +121,12 @@ public void Initialize(ISharpControl control)
128121
{
129122
Start = DateTime.UtcNow
130123
};
124+
131125
if (Utils.GetBooleanSetting("EnableRPCInvite", false))
126+
{
132127
client.SetSubscription(EventType.Join | EventType.JoinRequest);
128+
}
129+
133130
client.SetPresence(presence);
134131
client.Initialize();
135132
try
@@ -148,7 +145,6 @@ public void Initialize(ISharpControl control)
148145
{
149146
_controlPanel.ChangeStatus = "RPC is disabled";
150147
}
151-
152148
LogWriter.WriteToFile("EOM Initialize");
153149
}
154150
private void Client_OnPresenceUpdate(object sender, PresenceMessage args)
@@ -243,7 +239,7 @@ async Task MainLoop()
243239
}
244240
}
245241
LogWriter.WriteToFile("Waiting 500ms in loop...");
246-
await Task.Delay(500);
242+
await Task.Delay(500).ConfigureAwait(false);
247243
if (_control.RdsRadioText != null)
248244
{
249245
if (_control.IsPlaying)
@@ -287,7 +283,7 @@ async Task MainLoop()
287283
LogWriter.WriteToFile(ex.ToString());
288284
}
289285
/* presence.Secrets.JoinSecret = */
290-
// TODO: _control.RegisterFrontControl(Gui, PluginPosition.Top);
286+
/* _control.RegisterFrontControl(Gui, PluginPosition.Top); */
291287
}
292288
try
293289
{

SettingsPanel.cs

Lines changed: 1 addition & 1 deletion
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-
// TODO: implement Utils.GetBooleanSetting("EnableRPC");
62+
/* Utils.GetBooleanSetting("EnableRPC"); */
6363
}
6464

6565
private void Button1_Click(object sender, EventArgs e)

TopWindowMessages.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ public async Task<bool> RequestAnswer(DiscordRpcClient client, JoinRequestMessag
4646
AnswerD = false;
4747
button1.Visible = false;
4848
button2.Visible = false;
49-
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
5049
SetDefaultTextInLabel(tmpansw);
51-
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
5250
return tmpansw;
5351
}
5452
private async Task SetDefaultTextInLabel(bool accepted)

0 commit comments

Comments
 (0)