Skip to content

Commit d303158

Browse files
author
EnderIce2
committed
Changes in interface and how plugin works
1 parent 94385a3 commit d303158

7 files changed

Lines changed: 143 additions & 182 deletions

File tree

MainPlugin.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,17 @@ private async Task MainLoop()
114114
LogWriter.WriteToFile($"RdsProgramService: {_control.RdsProgramService}");
115115
LogWriter.WriteToFile("Setting presence...");
116116
presence.Details = $"Frequency: {$"{_control.Frequency:#,0,,0 Hz}"}";
117-
presence.State = string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService)
118-
? "RDS: unknown"
119-
: _control.FmStereo
120-
? $"RDS: ((( {_control.RdsProgramService} ))) - {_control.RdsRadioText}"
121-
: $"RDS: {_control.RdsProgramService} - {_control.RdsRadioText}";
117+
if (!string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
118+
{
119+
string radio_text = string.IsNullOrWhiteSpace(_control.RdsRadioText) ? "" : $" - {_control.RdsRadioText}";
120+
presence.State = _control.FmStereo
121+
? $"RDS: ((( {_control.RdsProgramService} ))){radio_text}"
122+
: $"RDS: {_control.RdsProgramService}{radio_text}";
123+
}
124+
else
125+
{
126+
presence.State = $"RDS: unknown";
127+
}
122128
}
123129
catch (Exception ex)
124130
{

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("1.0.0.2")]
36-
[assembly: AssemblyFileVersion("1.0.0.2")]
35+
[assembly: AssemblyVersion("1.1.0.0")]
36+
[assembly: AssemblyFileVersion("1.1.0.0")]

SettingsForm.Designer.cs

Lines changed: 95 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SettingsForm.cs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,43 @@ namespace EnderIce2.SDRSharpPlugin
66
{
77
public partial class SettingsForm : Form
88
{
9-
public SettingsForm() => InitializeComponent();
9+
public SettingsForm()
10+
{
11+
InitializeComponent();
12+
textBox1.Text = Utils.GetStringSetting("ClientID");
13+
checkBox1.Checked = Utils.GetBooleanSetting("LogRPC", false);
14+
}
1015

1116
private void Button2_Click(object sender, EventArgs e) => System.Diagnostics.Process.Start("https://ko-fi.com/enderice2");
1217

1318
private void Button1_Click(object sender, EventArgs e) => Close();
1419

1520
private void CheckBox1_CheckedChanged(object sender, EventArgs e) => Utils.SaveSetting("ShowWelcomePage", !checkBox1.Checked);
21+
22+
private void Button5_Click(object sender, EventArgs e)
23+
{
24+
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");
25+
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");
26+
}
27+
28+
private void CheckBox1_CheckedChanged_1(object sender, EventArgs e) => Utils.SaveSetting("LogRPC", checkBox1.Checked);
29+
30+
private void Button4_Click(object sender, EventArgs e)
31+
{
32+
textBox1.Text.Replace(" ", "").Replace("\n", "").Replace("\r", "");
33+
if (!int.TryParse(textBox1.Text, out _) || textBox1.Text.Length != 18)
34+
{
35+
MessageBox.Show("Invalid Client ID!");
36+
}
37+
Utils.SaveSetting("ClientID", textBox1.Text);
38+
label1.Text = $"Configuration Updated.\nNew ID: {Utils.GetStringSetting("ClientID")}";
39+
}
40+
41+
private void Button3_Click(object sender, EventArgs e)
42+
{
43+
Utils.SaveSetting("ClientID", "765213507321856078");
44+
textBox1.Text = "765213507321856078";
45+
}
1646
}
1747
}
1848

0 commit comments

Comments
 (0)