From 7edbd9fda9d2402ac41555d27e88ea39e850acac Mon Sep 17 00:00:00 2001 From: ErrOwk Date: Tue, 17 Sep 2024 16:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8IniParser=E5=BA=93=E8=80=8C?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E4=BD=BF=E7=94=A8kernel32=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LogBook-WPF/LogBook-WPF.csproj | 3 +- LogBook-WPF/MainWindow.xaml.cs | 93 ++++++++++------ LogBook-WPF/Models/IniFile.cs | 55 ---------- LogBook-WPF/NewQSO.xaml.cs | 35 +++--- LogBook-WPF/Settings.xaml.cs | 43 +++++--- LogBook-WPF/UpdateQSO.xaml.cs | 195 +++++++++++++++++++++------------ 6 files changed, 228 insertions(+), 196 deletions(-) delete mode 100644 LogBook-WPF/Models/IniFile.cs diff --git a/LogBook-WPF/LogBook-WPF.csproj b/LogBook-WPF/LogBook-WPF.csproj index 80ae49d..210cfb7 100644 --- a/LogBook-WPF/LogBook-WPF.csproj +++ b/LogBook-WPF/LogBook-WPF.csproj @@ -11,10 +11,11 @@ + - + diff --git a/LogBook-WPF/MainWindow.xaml.cs b/LogBook-WPF/MainWindow.xaml.cs index 5c000e8..74d64f4 100644 --- a/LogBook-WPF/MainWindow.xaml.cs +++ b/LogBook-WPF/MainWindow.xaml.cs @@ -1,8 +1,4 @@ -using iNKORE.UI.WPF.Helpers; -using LogBook_WPF.Models; -using Microsoft.Win32; -using SQLite; -using System; +using System; using System.ComponentModel; using System.Diagnostics; using System.IO; @@ -19,11 +15,15 @@ using System.Windows.Navigation; using System.Windows.Shapes; using System.Xml.Linq; +using ErrOwk.IniParser; +using iNKORE.UI.WPF.Helpers; +using LogBook_WPF.Models; +using Microsoft.Win32; +using SQLite; using Windows.System; namespace LogBook_WPF { - /// /// 主页面 /// @@ -31,13 +31,13 @@ public partial class MainWindow : Window { internal SQLiteConnection conn; - public IniFile configFile; + public IniParser iniFile; public MainWindow() { Directory.CreateDirectory("Data"); InitializeComponent(); - configFile = new IniFile("Data\\config.ini"); + iniFile = new IniParser("Data\\config.ini"); conn = new SQLiteConnection("Data\\QSO.db3"); conn.CreateTable(); UpdateDgv(); @@ -66,11 +66,8 @@ private void UpdateDgv() qsoList.Reverse(); dgvQSOs.ItemsSource = qsoList; //更新列表 - } - - private void dgvQSOs_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (dgvQSOs.SelectedIndex != -1) @@ -79,7 +76,9 @@ private void dgvQSOs_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) qsoList = conn.Table().ToList(); //获取QSO列表 - Window updateQSO = new UpdateQSO(qsoList[qsoList.Count - dgvQSOs.SelectedIndex - 1]); + Window updateQSO = new UpdateQSO( + qsoList[qsoList.Count - dgvQSOs.SelectedIndex - 1] + ); updateQSO.ShowDialog(); //修改选中项 @@ -89,7 +88,6 @@ private void dgvQSOs_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void exportQSO_Click(object sender, RoutedEventArgs e) { - SaveFileDialog dlg = new SaveFileDialog(); dlg.Title = "保存.ADI文件"; dlg.FileName = "exportQSO.adi"; @@ -110,13 +108,15 @@ private void exportQSO_Click(object sender, RoutedEventArgs e) private void exportToQRZ_Click(object sender, RoutedEventArgs e) { string originPwd = ""; - + try { //解密密码 StreamReader sr = new StreamReader("Data\\qrzPwd"); Byte[] protectedPwd = Convert.FromBase64String(sr.ReadToEnd()); - originPwd = Encoding.UTF8.GetString(ProtectedData.Unprotect(protectedPwd, null, DataProtectionScope.CurrentUser)); + originPwd = Encoding.UTF8.GetString( + ProtectedData.Unprotect(protectedPwd, null, DataProtectionScope.CurrentUser) + ); } catch (Exception ex) { @@ -130,19 +130,22 @@ private void exportToQRZ_Click(object sender, RoutedEventArgs e) ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "qrz_auto_import_from_lotw.exe"; - if (string.IsNullOrEmpty(configFile.Read("qrzCallsign", "Upload"))) + if (string.IsNullOrEmpty(iniFile.Get("Upload", "qrzCallsign"))) { MessageBox.Show("无法获取到呼号,是否在设置中配置了呼号?"); return; - }; + } + ; if (string.IsNullOrEmpty(originPwd)) { MessageBox.Show("无法获取到密码,是否保存了密码?"); return; - }; + } + ; - startInfo.Arguments = $"{configFile.Read("qrzCallsign", "QRZ")} {originPwd} --adif exportqrz.adi"; + startInfo.Arguments = + $"{iniFile.Get("Upload", "qrzCallsign")} {originPwd} --adif exportqrz.adi"; Process.Start(startInfo); @@ -175,19 +178,23 @@ private void exportADIF(string path) foreach (QSO qso in qsoList) { - //// 添加QSO记录 sw.WriteLine("" + qso.toCallsign); sw.WriteLine(" " + qso.mode); sw.WriteLine(" " + qso.UTCTime.ToString("yyyyMMdd")); sw.WriteLine(" " + qso.UTCTime.ToString("HHmmss")); sw.WriteLine(" " + qso.freq.ToString()); - sw.WriteLine(" " + qso.band); + sw.WriteLine(" " + qso.band); if (!string.IsNullOrEmpty(qso.freq_rx.ToString())) { - sw.WriteLine(" " + qso.band_rx); - sw.WriteLine(" " + qso.freq_rx.ToString()); + sw.WriteLine(" " + qso.band_rx); + sw.WriteLine( + " " + + qso.freq_rx.ToString() + ); } if (!string.IsNullOrEmpty(qso.selfGrid)) @@ -202,12 +209,19 @@ private void exportADIF(string path) if (!string.IsNullOrEmpty(qso.selfWatt.ToString())) { - sw.WriteLine(" " + qso.selfWatt.ToString()); + sw.WriteLine( + " " + + qso.selfWatt.ToString() + ); } if (!string.IsNullOrEmpty(qso.toWatt.ToString())) { - sw.WriteLine(" " + qso.toWatt.ToString()); + sw.WriteLine( + " " + qso.toWatt.ToString() + ); } if (!string.IsNullOrEmpty(qso.prop_mode)) @@ -238,23 +252,34 @@ private void settings_Click(object sender, RoutedEventArgs e) private void exportToLoTW_Click(object sender, RoutedEventArgs e) { exportADIF("exportlotw.adi"); - if (string.IsNullOrEmpty(configFile.Read("tqslAddr", "Upload"))) + if (string.IsNullOrEmpty(iniFile.Get("Upload", "tqslAddr"))) { MessageBox.Show("无法获取TQSL文件地址,是否在设置中配置了TQSL可执行文件地址?"); return; - }; + } + ; - if (string.IsNullOrEmpty(configFile.Read("tqslStationName", "Upload"))) + if (string.IsNullOrEmpty(iniFile.Get("Upload", "tqslStationName"))) { - MessageBox.Show("无法获取到台站名称,是否在设置中配置了台站名称?(台站名称应当填入TQSL应用中的台站地址)"); + MessageBox.Show( + "无法获取到台站名称,是否在设置中配置了台站名称?(台站名称应当填入TQSL应用中的台站地址)" + ); return; - }; + } + ; //工作方式参考https://gitee.com/yuzhenwu/x-qsl-amateur-radio-adif-tool,感谢并致以诚挚的73! ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "cmd.exe"; - startInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(configFile.Read("tqslAddr", "Upload")); - startInfo.Arguments = "/C \"tqsl -q -l \"" + configFile.Read("tqslStationName", "Upload") + "\" -p \"Insecure\" -a all -u -d \""+ System.Environment.CurrentDirectory +"\\exportlotw.adi\" 2>temp.txt "; + startInfo.WorkingDirectory = System.IO.Path.GetDirectoryName( + iniFile.Get("Upload", "tqslAddr") + ); + startInfo.Arguments = + "/C \"tqsl -q -l \"" + + iniFile.Get("Upload", "tqslStationName") + + "\" -p \"Insecure\" -a all -u -d \"" + + System.Environment.CurrentDirectory + + "\\exportlotw.adi\" 2>temp.txt "; startInfo.RedirectStandardOutput = true; startInfo.UseShellExecute = false; startInfo.StandardOutputEncoding = Encoding.Default; @@ -266,8 +291,6 @@ private void exportToLoTW_Click(object sender, RoutedEventArgs e) process.WaitForExit(); MessageBox.Show("导出任务执行完成,请打开LoTW网页核对是否正确导出"); - - } } -} \ No newline at end of file +} diff --git a/LogBook-WPF/Models/IniFile.cs b/LogBook-WPF/Models/IniFile.cs deleted file mode 100644 index 8d5e1b9..0000000 --- a/LogBook-WPF/Models/IniFile.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; - - -namespace LogBook_WPF.Models -{ - /// - /// 定义ini文件类,内容来自https://stackoverflow.com/questions/217902/reading-writing-an-ini-file - /// - public class IniFile // revision 11 - { - string Path; - string EXE = Assembly.GetExecutingAssembly().GetName().Name; - - [DllImport("kernel32", CharSet = CharSet.Unicode)] - static extern long WritePrivateProfileString(string Section, string Key, string Value, string FilePath); - - [DllImport("kernel32", CharSet = CharSet.Unicode)] - static extern int GetPrivateProfileString(string Section, string Key, string Default, StringBuilder RetVal, int Size, string FilePath); - - public IniFile(string IniPath = null) - { - Path = new FileInfo(IniPath ?? EXE + ".ini").FullName; - } - - public string Read(string Key, string Section = null) - { - var RetVal = new StringBuilder(255); - GetPrivateProfileString(Section ?? EXE, Key, "", RetVal, 255, Path); - return RetVal.ToString(); - } - - public void Write(string Key, string Value, string Section = null) - { - WritePrivateProfileString(Section ?? EXE, Key, Value, Path); - } - - public void DeleteKey(string Key, string Section = null) - { - Write(Key, null, Section ?? EXE); - } - - public void DeleteSection(string Section = null) - { - Write(null, null, Section ?? EXE); - } - - public bool KeyExists(string Key, string Section = null) - { - return Read(Key, Section).Length > 0; - } - } -} \ No newline at end of file diff --git a/LogBook-WPF/NewQSO.xaml.cs b/LogBook-WPF/NewQSO.xaml.cs index 17979d3..8a9ed1e 100644 --- a/LogBook-WPF/NewQSO.xaml.cs +++ b/LogBook-WPF/NewQSO.xaml.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using ErrOwk.IniParser; using LogBook_WPF.Models; using Microsoft.Win32.SafeHandles; using SQLite; @@ -31,7 +32,7 @@ public partial class NewQSO : Window public SQLiteConnection conn; - public IniFile configFile = new IniFile("Data\\config.ini"); + public IniParser iniFile = new IniParser("Data\\config.ini"); public NewQSO() { @@ -60,13 +61,13 @@ public NewQSO() conn.CreateTable(); //配置SQLite - selfCallsign.Text = configFile.Read("selfCallsign"); - selfGrid.Text = configFile.Read("selfGrid"); - selfWX.Text = configFile.Read("selfWX"); - selfRIG.Text = configFile.Read("selfRIG"); - selfANT.Text = configFile.Read("selfANT"); - selfWatt.Text = configFile.Read("selfWatt"); - selfQTH.Text = configFile.Read("selfQTH"); + selfCallsign.Text = iniFile.Get("LogBook - WPF","selfCallsign"); + selfGrid.Text = iniFile.Get("LogBook - WPF", "selfGrid"); + selfWX.Text = iniFile.Get("LogBook - WPF", "selfWX"); + selfRIG.Text = iniFile.Get("LogBook - WPF", "selfRIG"); + selfANT.Text = iniFile.Get("LogBook - WPF", "selfANT"); + selfWatt.Text = iniFile.Get("LogBook - WPF", "selfWatt"); + selfQTH.Text = iniFile.Get("LogBook - WPF", "selfQTH"); //从ini文件中读取保存的信息 } @@ -165,13 +166,13 @@ private void qsoSave_Click(object sender, RoutedEventArgs e) conn.Insert(newQSO); //将数据转换并检验后存入数据库中 - configFile.Write("selfCallsign", selfCallsign.Text); - configFile.Write("selfGrid", selfGrid.Text); - configFile.Write("selfWX", selfWX.Text); - configFile.Write("selfRIG", selfRIG.Text); - configFile.Write("selfANT", selfANT.Text); - configFile.Write("selfWatt", selfWatt.Text); - configFile.Write("selfQTH", selfQTH.Text); + iniFile.Update("LogBook - WPF", "selfCallsign", selfCallsign.Text); + iniFile.Update("LogBook - WPF", "selfGrid", selfGrid.Text); + iniFile.Update("LogBook - WPF", "selfWX", selfWX.Text); + iniFile.Update("LogBook - WPF", "selfRIG", selfRIG.Text); + iniFile.Update("LogBook - WPF", "selfANT", selfANT.Text); + iniFile.Update("LogBook - WPF", "selfWatt", selfWatt.Text); + iniFile.Update("LogBook - WPF", "selfQTH", selfQTH.Text); //向ini文件保存信息 this.Close(); @@ -283,7 +284,7 @@ private string getTxFreq(string sat) }; string txFreq; - if (SatelliteFrequencies.TryGetValue(sat, out txFreq)) + if (SatelliteFrequencies.TryGetValue(sat, out txFreq!)) { return txFreq; } @@ -322,7 +323,7 @@ private string getRxFreq(string sat) }; string rxFreq; - if (SatelliteFrequencies.TryGetValue(sat, out rxFreq)) + if (SatelliteFrequencies.TryGetValue(sat, out rxFreq!)) { return rxFreq; } diff --git a/LogBook-WPF/Settings.xaml.cs b/LogBook-WPF/Settings.xaml.cs index bc783ab..de47fe8 100644 --- a/LogBook-WPF/Settings.xaml.cs +++ b/LogBook-WPF/Settings.xaml.cs @@ -1,6 +1,4 @@ -using LogBook_WPF.Models; -using Microsoft.Win32; -using System; +using System; using System.Collections; using System.Collections.Generic; using System.IO; @@ -16,6 +14,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using ErrOwk.IniParser; +using LogBook_WPF.Models; +using Microsoft.Win32; namespace LogBook_WPF { @@ -27,41 +28,47 @@ public partial class Settings : Window public Settings() { InitializeComponent(); - tqslAddressBox.Text = configFile.Read("tqslAddr", "Upload"); - tqslStationNameBox.Text = configFile.Read("tqslStationName", "Upload"); - qrzCallsignBox.Text = configFile.Read("qrzCallsign", "Upload"); + tqslAddressBox.Text = iniFile.Get("Upload", "tqslAddr"); + tqslStationNameBox.Text = iniFile.Get("Upload", "tqslStationName"); + qrzCallsignBox.Text = iniFile.Get("Upload", "qrzCallsign"); //自动填入已有的信息 - + string originPwd; try { StreamReader sr = new StreamReader("Data\\qrzPwd"); Byte[] protectedPwd = Convert.FromBase64String(sr.ReadToEnd()); - originPwd = Encoding.UTF8.GetString(ProtectedData.Unprotect(protectedPwd, null, DataProtectionScope.CurrentUser)); + originPwd = Encoding.UTF8.GetString( + ProtectedData.Unprotect(protectedPwd, null, DataProtectionScope.CurrentUser) + ); qrzPwdBox.Text = originPwd; //解密密码并填充 } - catch - { - } + catch { } } - IniFile configFile = new IniFile("Data\\config.ini"); + IniParser iniFile = new IniParser("Data\\config.ini"); private void btnSave_Click(object sender, RoutedEventArgs e) { - configFile.Write("tqslAddr",tqslAddressBox.Text,"Upload"); - configFile.Write("tqslStationName",tqslStationNameBox.Text,"Upload"); - configFile.Write("qrzCallsign",qrzCallsignBox.Text,"Upload"); + iniFile.Update("Upload", "tqslAddr", tqslAddressBox.Text); + iniFile.Update("Upload", "tqslStationName", tqslStationNameBox.Text); + iniFile.Update("Upload", "qrzCallsign", qrzCallsignBox.Text); //存储信息 - + string originPwd = qrzPwdBox.Text; - string protectedPwd = Convert.ToBase64String(ProtectedData.Protect(Encoding.UTF8.GetBytes(originPwd),null,DataProtectionScope.CurrentUser)); + string protectedPwd = Convert.ToBase64String( + ProtectedData.Protect( + Encoding.UTF8.GetBytes(originPwd), + null, + DataProtectionScope.CurrentUser + ) + ); //将密码通过非对称加密方式加密 StreamWriter sw = new StreamWriter("Data\\qrzPwd"); sw.Write(protectedPwd); - sw.Close(); + sw.Close(); //将加密后的密码写入文件 this.Close(); diff --git a/LogBook-WPF/UpdateQSO.xaml.cs b/LogBook-WPF/UpdateQSO.xaml.cs index b56f99d..1525d1e 100644 --- a/LogBook-WPF/UpdateQSO.xaml.cs +++ b/LogBook-WPF/UpdateQSO.xaml.cs @@ -1,6 +1,4 @@ -using LogBook_WPF.Models; -using SQLite; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -13,6 +11,8 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; +using LogBook_WPF.Models; +using SQLite; namespace LogBook_WPF { @@ -21,7 +21,6 @@ namespace LogBook_WPF /// public partial class UpdateQSO : Window { - public SQLiteConnection conn; public int Id; @@ -106,61 +105,114 @@ public UpdateQSO(QSO qso) private void qsoSave_Click(object sender, RoutedEventArgs e) { - DateTime UTCTime = Convert.ToDateTime(DateBox.Text + " " + hourBox.Text + ":" + minuteBox.Text + ":" + secondBox.Text); - if (selfCallsign.Text == "") { MessageBox.Show("请输入呼号"); return; } - else if (toCallsign.Text == "") { MessageBox.Show("请输入呼号"); return; } - else if (selfRST.Text == "") { MessageBox.Show("请输入信号报告"); return; } - else if (toRST.Text == "") { MessageBox.Show("请输入信号报告"); return; } - else if (modeBox.Text == "") { MessageBox.Show("请输入通信模式"); return; } - else if (freq.Text == "") { MessageBox.Show("请输入发射频率"); return; } - else if (bandBox.Text == "") { MessageBox.Show("请输入发射波段"); return; } - else if (string.IsNullOrEmpty(freq_rx.Text) && string.IsNullOrEmpty(bandRxBox.Text)) { MessageBox.Show("请输入接收波段"); return; } - - - try { if (freq.Text != "") Convert.ToDouble(freq.Text); } + DateTime UTCTime = Convert.ToDateTime( + DateBox.Text + " " + hourBox.Text + ":" + minuteBox.Text + ":" + secondBox.Text + ); + if (selfCallsign.Text == "") + { + MessageBox.Show("请输入呼号"); + return; + } + else if (toCallsign.Text == "") + { + MessageBox.Show("请输入呼号"); + return; + } + else if (selfRST.Text == "") + { + MessageBox.Show("请输入信号报告"); + return; + } + else if (toRST.Text == "") + { + MessageBox.Show("请输入信号报告"); + return; + } + else if (modeBox.Text == "") + { + MessageBox.Show("请输入通信模式"); + return; + } + else if (freq.Text == "") + { + MessageBox.Show("请输入发射频率"); + return; + } + else if (bandBox.Text == "") + { + MessageBox.Show("请输入发射波段"); + return; + } + else if (string.IsNullOrEmpty(freq_rx.Text) && string.IsNullOrEmpty(bandRxBox.Text)) + { + MessageBox.Show("请输入接收波段"); + return; + } + + try + { + if (freq.Text != "") + Convert.ToDouble(freq.Text); + } catch { MessageBox.Show("请正确输入频率"); return; } - try { if (freq_rx.Text != "") Convert.ToDouble(freq_rx.Text); } + try + { + if (freq_rx.Text != "") + Convert.ToDouble(freq_rx.Text); + } catch { MessageBox.Show("请正确输入频率"); return; } - try { Convert.ToInt32(selfRST.Text); } + try + { + Convert.ToInt32(selfRST.Text); + } catch { MessageBox.Show("请正确输入RST"); return; } - try { Convert.ToInt32(toRST.Text); } + try + { + Convert.ToInt32(toRST.Text); + } catch { MessageBox.Show("请正确输入RST"); return; } - try { if (selfWatt.Text != "") Convert.ToDouble(selfWatt.Text); } + try + { + if (selfWatt.Text != "") + Convert.ToDouble(selfWatt.Text); + } catch { MessageBox.Show("请正确输入功率"); return; } - try { if (toWatt.Text != "") Convert.ToDouble(toWatt.Text); } + try + { + if (toWatt.Text != "") + Convert.ToDouble(toWatt.Text); + } catch { MessageBox.Show("请正确输入功率"); return; } - - QSO newQSO = new QSO() { Id = Id, @@ -188,8 +240,10 @@ private void qsoSave_Click(object sender, RoutedEventArgs e) prop_mode = propModeBox.Text, satName = satNameBox.Text, }; - if (selfWatt.Text != "") newQSO.selfWatt = Convert.ToDouble(selfWatt.Text); - if (toWatt.Text != "") newQSO.toWatt = Convert.ToDouble(toWatt.Text); + if (selfWatt.Text != "") + newQSO.selfWatt = Convert.ToDouble(selfWatt.Text); + if (toWatt.Text != "") + newQSO.toWatt = Convert.ToDouble(toWatt.Text); if (freq_rx.Text != "") { newQSO.freq_rx = Convert.ToDouble(freq_rx.Text); @@ -291,34 +345,35 @@ private string getTxFreq(string sat) { Dictionary SatelliteFrequencies = new Dictionary { - {"SO-50", "145.85"}, - {"SO-121", "145.875"}, - {"AO-27", "145.8"}, - {"AO-91", "435.25"}, - {"UVSQ", "145.905"}, - {"PO-101", "437.5"}, - {"CAS-3H", "144.35"}, - {"ARISS", "145.99"}, - {"INSPR7", "145.97"}, - {"AO-92", "435.35"}, - {"TEVEL1", "145.97"}, - {"TEVEL2", "145.97"}, - {"TEVEL3", "145.97"}, - {"TEVEL4", "145.97"}, - {"TEVEL5", "145.97"}, - {"TEVEL6", "145.97"}, - {"TEVEL7", "145.97"}, - {"TEVEL8", "145.97"}, - {"IO-117", "435.307"}, - {"RS-44", "145.965"}, + { "SO-50", "145.85" }, + { "SO-121", "145.875" }, + { "AO-27", "145.8" }, + { "AO-91", "435.25" }, + { "UVSQ", "145.905" }, + { "PO-101", "437.5" }, + { "CAS-3H", "144.35" }, + { "ARISS", "145.99" }, + { "INSPR7", "145.97" }, + { "AO-92", "435.35" }, + { "TEVEL1", "145.97" }, + { "TEVEL2", "145.97" }, + { "TEVEL3", "145.97" }, + { "TEVEL4", "145.97" }, + { "TEVEL5", "145.97" }, + { "TEVEL6", "145.97" }, + { "TEVEL7", "145.97" }, + { "TEVEL8", "145.97" }, + { "IO-117", "435.307" }, + { "RS-44", "145.965" }, }; string txFreq; - if (SatelliteFrequencies.TryGetValue(sat, out txFreq)) + if (SatelliteFrequencies.TryGetValue(sat, out txFreq!)) { return txFreq; } - else return ""; + else + return ""; } /// @@ -330,34 +385,35 @@ private string getRxFreq(string sat) { Dictionary SatelliteFrequencies = new Dictionary { - {"SO-50", "36.795"}, - {"SO-121", "436.666"}, - {"AO-27", "436.795"}, - {"AO-91", "145.96"}, - {"UVSQ", "437.02"}, - {"PO-101", "145.9"}, - {"CAS-3H", "437.2"}, - {"ARISS", "437.8"}, - {"INSPR7", "437.41"}, - {"AO-92", "145.88"}, - {"TEVEL1", "436.4"}, - {"TEVEL2", "436.4"}, - {"TEVEL3", "436.4"}, - {"TEVEL4", "436.4"}, - {"TEVEL5", "436.4"}, - {"TEVEL6", "436.4"}, - {"TEVEL7", "436.4"}, - {"TEVEL8", "436.4"}, - {"IO-117", "435.31"}, - {"RS-44", "435.6"}, + { "SO-50", "36.795" }, + { "SO-121", "436.666" }, + { "AO-27", "436.795" }, + { "AO-91", "145.96" }, + { "UVSQ", "437.02" }, + { "PO-101", "145.9" }, + { "CAS-3H", "437.2" }, + { "ARISS", "437.8" }, + { "INSPR7", "437.41" }, + { "AO-92", "145.88" }, + { "TEVEL1", "436.4" }, + { "TEVEL2", "436.4" }, + { "TEVEL3", "436.4" }, + { "TEVEL4", "436.4" }, + { "TEVEL5", "436.4" }, + { "TEVEL6", "436.4" }, + { "TEVEL7", "436.4" }, + { "TEVEL8", "436.4" }, + { "IO-117", "435.31" }, + { "RS-44", "435.6" }, }; string rxFreq; - if (SatelliteFrequencies.TryGetValue(sat, out rxFreq)) + if (SatelliteFrequencies.TryGetValue(sat, out rxFreq!)) { return rxFreq; } - else return ""; + else + return ""; } /// @@ -397,7 +453,6 @@ private void freq_rx_LostFocus(object sender, RoutedEventArgs e) { return; } - } }