diff --git a/JL.Core/Config/StatsDBUtils.cs b/JL.Core/Config/StatsDBUtils.cs index bd7fc377..84779ce0 100644 --- a/JL.Core/Config/StatsDBUtils.cs +++ b/JL.Core/Config/StatsDBUtils.cs @@ -26,7 +26,7 @@ INSERT INTO stats (profile_id, value) _ = command.ExecuteNonQuery(); } - public static void UpdateStats(SqliteConnection connection, Stats stats, int profileId) + private static void UpdateStats(SqliteConnection connection, Stats stats, int profileId) { UpdateStats(connection, JsonSerializer.Serialize(stats, Utils.s_jsoWithEnumConverterAndIndentation), profileId); } diff --git a/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs b/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs index e843ad77..af622809 100644 --- a/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs +++ b/JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs @@ -42,7 +42,7 @@ public string BuildFormattedDefinition(DictOptions options) "noun" => "noun", "other" => "other", "v1" => "verb", - _ => "other", + _ => "other" }; } diff --git a/JL.Core/Dicts/DictUpdater.cs b/JL.Core/Dicts/DictUpdater.cs index 6aca0e4b..645d6d6a 100644 --- a/JL.Core/Dicts/DictUpdater.cs +++ b/JL.Core/Dicts/DictUpdater.cs @@ -287,11 +287,12 @@ internal static Task AutoUpdateBuiltInDicts() } Utils.Frontend.Alert(AlertLevel.Information, $"Updating {dict.Type}..."); - return dict.Type is DictType.JMdict - ? UpdateJmdict(pathExists, true) - : dict.Type is DictType.JMnedict - ? UpdateJmnedict(pathExists, true) - : UpdateKanjidic(pathExists, true); + return dict.Type switch + { + DictType.JMdict => UpdateJmdict(pathExists, true), + DictType.JMnedict => UpdateJmnedict(pathExists, true), + _ => UpdateKanjidic(pathExists, true) + }; } return Task.CompletedTask; diff --git a/JL.Core/Freqs/FreqUtils.cs b/JL.Core/Freqs/FreqUtils.cs index baa438bb..58aabb16 100644 --- a/JL.Core/Freqs/FreqUtils.cs +++ b/JL.Core/Freqs/FreqUtils.cs @@ -157,15 +157,10 @@ public static async Task LoadFrequencies() { FreqDBManager.CreateDB(freq.Name); FreqDBManager.InsertRecordsToDB(freq); - freq.Contents = FrozenDictionary>.Empty; - freq.Ready = true; - } - else - { - freq.Contents = FrozenDictionary>.Empty; - freq.Ready = true; } + freq.Contents = FrozenDictionary>.Empty; + freq.Ready = true; freqCleared = true; } @@ -255,15 +250,11 @@ public static async Task LoadFrequencies() { FreqDBManager.CreateDB(freq.Name); FreqDBManager.InsertRecordsToDB(freq); - freq.Contents = FrozenDictionary>.Empty; - freq.Ready = true; - } - else - { - freq.Contents = FrozenDictionary>.Empty; - freq.Ready = true; } + freq.Contents = FrozenDictionary>.Empty; + freq.Ready = true; + freqCleared = true; } diff --git a/JL.Windows/App.xaml.cs b/JL.Windows/App.xaml.cs index e0302c4f..4f388987 100644 --- a/JL.Windows/App.xaml.cs +++ b/JL.Windows/App.xaml.cs @@ -11,7 +11,7 @@ namespace JL.Windows; /// // ReSharper disable once MemberCanBeFileLocal -internal sealed partial class App : Application +internal sealed partial class App { public App() { diff --git a/JL.Windows/GUI/AddAudioSourceWindow.xaml.cs b/JL.Windows/GUI/AddAudioSourceWindow.xaml.cs index 9d57aa33..b9f81d38 100644 --- a/JL.Windows/GUI/AddAudioSourceWindow.xaml.cs +++ b/JL.Windows/GUI/AddAudioSourceWindow.xaml.cs @@ -12,7 +12,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddAudioSourceWindow.xaml /// -internal sealed partial class AddAudioSourceWindow : Window +internal sealed partial class AddAudioSourceWindow { private static readonly string[] s_audioSourceTypes = Enum.GetValues().Select(static audioSourceType => audioSourceType.GetDescription() ?? audioSourceType.ToString()).ToArray(); diff --git a/JL.Windows/GUI/AddDictionaryWindow.xaml.cs b/JL.Windows/GUI/AddDictionaryWindow.xaml.cs index 0899200a..a96340ae 100644 --- a/JL.Windows/GUI/AddDictionaryWindow.xaml.cs +++ b/JL.Windows/GUI/AddDictionaryWindow.xaml.cs @@ -15,7 +15,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddDictionaryWindow.xaml /// -internal sealed partial class AddDictionaryWindow : Window +internal sealed partial class AddDictionaryWindow { private readonly DictOptionsControl _dictOptionsControl; diff --git a/JL.Windows/GUI/AddFrequencyWindow.xaml.cs b/JL.Windows/GUI/AddFrequencyWindow.xaml.cs index f1b3fdf2..4f1af861 100644 --- a/JL.Windows/GUI/AddFrequencyWindow.xaml.cs +++ b/JL.Windows/GUI/AddFrequencyWindow.xaml.cs @@ -13,7 +13,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddFrequencyWindow.xaml /// -internal sealed partial class AddFrequencyWindow : Window +internal sealed partial class AddFrequencyWindow { private readonly FreqOptionsControl _freqOptionsControl; public AddFrequencyWindow() diff --git a/JL.Windows/GUI/AddNameWindow.xaml.cs b/JL.Windows/GUI/AddNameWindow.xaml.cs index 668444a2..3f562667 100644 --- a/JL.Windows/GUI/AddNameWindow.xaml.cs +++ b/JL.Windows/GUI/AddNameWindow.xaml.cs @@ -13,7 +13,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddNameWindow.xaml /// -internal sealed partial class AddNameWindow : Window +internal sealed partial class AddNameWindow { private static AddNameWindow? s_instance; public static AddNameWindow Instance => s_instance ??= new AddNameWindow(); diff --git a/JL.Windows/GUI/AddProfileWindow.xaml.cs b/JL.Windows/GUI/AddProfileWindow.xaml.cs index 5f0fee81..d0d94c7c 100644 --- a/JL.Windows/GUI/AddProfileWindow.xaml.cs +++ b/JL.Windows/GUI/AddProfileWindow.xaml.cs @@ -10,7 +10,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddProfileWindow.xaml /// -internal sealed partial class AddProfileWindow : Window +internal sealed partial class AddProfileWindow { public AddProfileWindow() { diff --git a/JL.Windows/GUI/AddWordWindow.xaml.cs b/JL.Windows/GUI/AddWordWindow.xaml.cs index a308b33e..765f8827 100644 --- a/JL.Windows/GUI/AddWordWindow.xaml.cs +++ b/JL.Windows/GUI/AddWordWindow.xaml.cs @@ -13,7 +13,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AddWordWindow.xaml /// -internal sealed partial class AddWordWindow : Window +internal sealed partial class AddWordWindow { private static AddWordWindow? s_instance; diff --git a/JL.Windows/GUI/AlertWindow.xaml.cs b/JL.Windows/GUI/AlertWindow.xaml.cs index f16bb878..1342d881 100644 --- a/JL.Windows/GUI/AlertWindow.xaml.cs +++ b/JL.Windows/GUI/AlertWindow.xaml.cs @@ -1,11 +1,10 @@ -using System.Windows; using System.Windows.Interop; using System.Windows.Media; using JL.Core.Utilities; namespace JL.Windows.GUI; -internal sealed partial class AlertWindow : Window +internal sealed partial class AlertWindow { public nint WindowHandle { get; private set; } diff --git a/JL.Windows/GUI/EditAudioSourceWindow.xaml.cs b/JL.Windows/GUI/EditAudioSourceWindow.xaml.cs index c1074bb8..819da3de 100644 --- a/JL.Windows/GUI/EditAudioSourceWindow.xaml.cs +++ b/JL.Windows/GUI/EditAudioSourceWindow.xaml.cs @@ -11,7 +11,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for EditAudioSourceWindow.xaml /// -internal sealed partial class EditAudioSourceWindow : Window +internal sealed partial class EditAudioSourceWindow { private readonly string _uri; private readonly AudioSource _audioSource; diff --git a/JL.Windows/GUI/EditDictionaryWindow.xaml.cs b/JL.Windows/GUI/EditDictionaryWindow.xaml.cs index d3f3b514..a902c15b 100644 --- a/JL.Windows/GUI/EditDictionaryWindow.xaml.cs +++ b/JL.Windows/GUI/EditDictionaryWindow.xaml.cs @@ -16,7 +16,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for EditDictionaryWindow.xaml /// -internal sealed partial class EditDictionaryWindow : Window +internal sealed partial class EditDictionaryWindow { private readonly Dict _dict; diff --git a/JL.Windows/GUI/EditFrequencyWindow.xaml.cs b/JL.Windows/GUI/EditFrequencyWindow.xaml.cs index 2a3edd92..f23692ba 100644 --- a/JL.Windows/GUI/EditFrequencyWindow.xaml.cs +++ b/JL.Windows/GUI/EditFrequencyWindow.xaml.cs @@ -15,7 +15,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for EditFrequencyWindow.xaml /// -internal sealed partial class EditFrequencyWindow : Window +internal sealed partial class EditFrequencyWindow { private readonly Freq _freq; private readonly FreqOptionsControl _freqOptionsControl; diff --git a/JL.Windows/GUI/InfoWindow.xaml.cs b/JL.Windows/GUI/InfoWindow.xaml.cs index b8f07487..b8e68248 100644 --- a/JL.Windows/GUI/InfoWindow.xaml.cs +++ b/JL.Windows/GUI/InfoWindow.xaml.cs @@ -1,4 +1,3 @@ -using System.Windows; using System.Windows.Interop; namespace JL.Windows.GUI; @@ -6,7 +5,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for AbbreviationWindow.xaml /// -internal sealed partial class InfoWindow : Window +internal sealed partial class InfoWindow { private nint _windowHandle; diff --git a/JL.Windows/GUI/MainWindow.xaml.cs b/JL.Windows/GUI/MainWindow.xaml.cs index 4ff2e200..3f0ea644 100644 --- a/JL.Windows/GUI/MainWindow.xaml.cs +++ b/JL.Windows/GUI/MainWindow.xaml.cs @@ -25,7 +25,6 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MouseEventArgs = System.Windows.Input.MouseEventArgs; using Rectangle = System.Drawing.Rectangle; -using Window = System.Windows.Window; namespace JL.Windows.GUI; @@ -33,7 +32,7 @@ namespace JL.Windows.GUI; /// Interaction logic for MainWindow.xaml /// #pragma warning disable CA1812 // Internal class that is apparently never instantiated -internal sealed partial class MainWindow : Window +internal sealed partial class MainWindow #pragma warning restore CA1812 // Internal class that is apparently never instantiated { private WinApi? _winApi; diff --git a/JL.Windows/GUI/ManageAudioSourcesWindow.xaml.cs b/JL.Windows/GUI/ManageAudioSourcesWindow.xaml.cs index 0413ba21..f815eca7 100644 --- a/JL.Windows/GUI/ManageAudioSourcesWindow.xaml.cs +++ b/JL.Windows/GUI/ManageAudioSourcesWindow.xaml.cs @@ -13,7 +13,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for ManageAudioSourcesWindow.xaml /// -internal sealed partial class ManageAudioSourcesWindow : Window +internal sealed partial class ManageAudioSourcesWindow { private static ManageAudioSourcesWindow? s_instance; diff --git a/JL.Windows/GUI/ManageDictionariesWindow.xaml.cs b/JL.Windows/GUI/ManageDictionariesWindow.xaml.cs index b3040218..59477d47 100644 --- a/JL.Windows/GUI/ManageDictionariesWindow.xaml.cs +++ b/JL.Windows/GUI/ManageDictionariesWindow.xaml.cs @@ -20,7 +20,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for ManageDictionariesWindow.xaml /// -internal sealed partial class ManageDictionariesWindow : Window +internal sealed partial class ManageDictionariesWindow { private static ManageDictionariesWindow? s_instance; diff --git a/JL.Windows/GUI/ManageFrequenciesWindow.xaml.cs b/JL.Windows/GUI/ManageFrequenciesWindow.xaml.cs index ecd2dfde..e5bf9927 100644 --- a/JL.Windows/GUI/ManageFrequenciesWindow.xaml.cs +++ b/JL.Windows/GUI/ManageFrequenciesWindow.xaml.cs @@ -15,7 +15,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for ManageFrequenciesWindow.xaml /// -internal sealed partial class ManageFrequenciesWindow : Window +internal sealed partial class ManageFrequenciesWindow { private static ManageFrequenciesWindow? s_instance; diff --git a/JL.Windows/GUI/ManageProfiles.xaml.cs b/JL.Windows/GUI/ManageProfiles.xaml.cs index 4b9582e3..5bcb6df5 100644 --- a/JL.Windows/GUI/ManageProfiles.xaml.cs +++ b/JL.Windows/GUI/ManageProfiles.xaml.cs @@ -14,7 +14,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for ManageProfilesWindow.xaml /// -internal sealed partial class ManageProfilesWindow : Window +internal sealed partial class ManageProfilesWindow { private nint _windowHandle; public ManageProfilesWindow() diff --git a/JL.Windows/GUI/PopupWindow.xaml.cs b/JL.Windows/GUI/PopupWindow.xaml.cs index d7379a76..fb488d30 100644 --- a/JL.Windows/GUI/PopupWindow.xaml.cs +++ b/JL.Windows/GUI/PopupWindow.xaml.cs @@ -19,7 +19,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for PopupWindow.xaml /// -internal sealed partial class PopupWindow : Window +internal sealed partial class PopupWindow { public PopupWindow? ChildPopupWindow { get; private set; } diff --git a/JL.Windows/GUI/PreferencesWindow.xaml.cs b/JL.Windows/GUI/PreferencesWindow.xaml.cs index 5f36ff05..30c8a291 100644 --- a/JL.Windows/GUI/PreferencesWindow.xaml.cs +++ b/JL.Windows/GUI/PreferencesWindow.xaml.cs @@ -24,7 +24,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for PreferenceWindow.xaml /// -internal sealed partial class PreferencesWindow : Window +internal sealed partial class PreferencesWindow { private static PreferencesWindow? s_instance; public static PreferencesWindow Instance => s_instance ??= new PreferencesWindow(); @@ -217,7 +217,7 @@ private async void ResetPreferencesButton_Click(object sender, RoutedEventArgs e { await MainWindow.Instance.HandleAppClosing().ConfigureAwait(false); - ConfigDBManager.DeleteAllSettingsFromProfile(["MainWindowTopPosition", "MainWindowLeftPosition"]); + ConfigDBManager.DeleteAllSettingsFromProfile("MainWindowTopPosition", "MainWindowLeftPosition"); _ = Process.Start( new ProcessStartInfo("cmd", diff --git a/JL.Windows/GUI/ReadingSelectionWindow.xaml.cs b/JL.Windows/GUI/ReadingSelectionWindow.xaml.cs index 80568ee6..761f407f 100644 --- a/JL.Windows/GUI/ReadingSelectionWindow.xaml.cs +++ b/JL.Windows/GUI/ReadingSelectionWindow.xaml.cs @@ -9,7 +9,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for ReadingSelectionWindow.xaml /// -internal sealed partial class ReadingSelectionWindow : Window +internal sealed partial class ReadingSelectionWindow { private string? _primarySpelling; private nint _windowHandle; diff --git a/JL.Windows/GUI/StatsWindow.xaml.cs b/JL.Windows/GUI/StatsWindow.xaml.cs index 3ba1a8aa..603eba2c 100644 --- a/JL.Windows/GUI/StatsWindow.xaml.cs +++ b/JL.Windows/GUI/StatsWindow.xaml.cs @@ -13,7 +13,7 @@ namespace JL.Windows.GUI; /// /// Interaction logic for StatsWindow.xaml /// -internal sealed partial class StatsWindow : Window +internal sealed partial class StatsWindow { private static StatsWindow? s_instance; private nint _windowHandle; diff --git a/JL.Windows/GUI/UserControls/DictOptionsControl.xaml.cs b/JL.Windows/GUI/UserControls/DictOptionsControl.xaml.cs index a1cd7c16..1f277014 100644 --- a/JL.Windows/GUI/UserControls/DictOptionsControl.xaml.cs +++ b/JL.Windows/GUI/UserControls/DictOptionsControl.xaml.cs @@ -7,7 +7,7 @@ namespace JL.Windows.GUI.UserControls; -internal sealed partial class DictOptionsControl : UserControl +internal sealed partial class DictOptionsControl { public DictOptionsControl() { diff --git a/JL.Windows/GUI/UserControls/FreqOptionsControl.xaml.cs b/JL.Windows/GUI/UserControls/FreqOptionsControl.xaml.cs index 79b148d0..11beb194 100644 --- a/JL.Windows/GUI/UserControls/FreqOptionsControl.xaml.cs +++ b/JL.Windows/GUI/UserControls/FreqOptionsControl.xaml.cs @@ -1,11 +1,10 @@ using System.Windows; -using System.Windows.Controls; using JL.Core.Freqs; using JL.Core.Freqs.Options; namespace JL.Windows.GUI.UserControls; -internal sealed partial class FreqOptionsControl : UserControl +internal sealed partial class FreqOptionsControl { public FreqOptionsControl() {