Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Oct 5, 2024
1 parent 83e5741 commit 9689ff3
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 49 deletions.
2 changes: 1 addition & 1 deletion JL.Core/Config/StatsDBUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion JL.Core/Dicts/CustomWordDict/CustomWordRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public string BuildFormattedDefinition(DictOptions options)
"noun" => "noun",
"other" => "other",
"v1" => "verb",
_ => "other",
_ => "other"
};
}

Expand Down
11 changes: 6 additions & 5 deletions JL.Core/Dicts/DictUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 5 additions & 14 deletions JL.Core/Freqs/FreqUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,10 @@ public static async Task LoadFrequencies()
{
FreqDBManager.CreateDB(freq.Name);
FreqDBManager.InsertRecordsToDB(freq);
freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;
}
else
{
freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;
}

freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;
freqCleared = true;
}

Expand Down Expand Up @@ -255,15 +250,11 @@ public static async Task LoadFrequencies()
{
FreqDBManager.CreateDB(freq.Name);
FreqDBManager.InsertRecordsToDB(freq);
freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;
}
else
{
freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;
}

freq.Contents = FrozenDictionary<string, IList<FrequencyRecord>>.Empty;
freq.Ready = true;

freqCleared = true;
}

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace JL.Windows;
/// </summary>

// ReSharper disable once MemberCanBeFileLocal
internal sealed partial class App : Application
internal sealed partial class App
{
public App()
{
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddAudioSourceWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddAudioSourceWindow.xaml
/// </summary>
internal sealed partial class AddAudioSourceWindow : Window
internal sealed partial class AddAudioSourceWindow
{
private static readonly string[] s_audioSourceTypes = Enum.GetValues<AudioSourceType>().Select(static audioSourceType => audioSourceType.GetDescription() ?? audioSourceType.ToString()).ToArray();

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddDictionaryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddDictionaryWindow.xaml
/// </summary>
internal sealed partial class AddDictionaryWindow : Window
internal sealed partial class AddDictionaryWindow
{
private readonly DictOptionsControl _dictOptionsControl;

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddFrequencyWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddFrequencyWindow.xaml
/// </summary>
internal sealed partial class AddFrequencyWindow : Window
internal sealed partial class AddFrequencyWindow
{
private readonly FreqOptionsControl _freqOptionsControl;
public AddFrequencyWindow()
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddNameWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddNameWindow.xaml
/// </summary>
internal sealed partial class AddNameWindow : Window
internal sealed partial class AddNameWindow
{
private static AddNameWindow? s_instance;
public static AddNameWindow Instance => s_instance ??= new AddNameWindow();
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddProfileWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddProfileWindow.xaml
/// </summary>
internal sealed partial class AddProfileWindow : Window
internal sealed partial class AddProfileWindow
{
public AddProfileWindow()
{
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/AddWordWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for AddWordWindow.xaml
/// </summary>
internal sealed partial class AddWordWindow : Window
internal sealed partial class AddWordWindow
{
private static AddWordWindow? s_instance;

Expand Down
3 changes: 1 addition & 2 deletions JL.Windows/GUI/AlertWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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; }

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/EditAudioSourceWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for EditAudioSourceWindow.xaml
/// </summary>
internal sealed partial class EditAudioSourceWindow : Window
internal sealed partial class EditAudioSourceWindow
{
private readonly string _uri;
private readonly AudioSource _audioSource;
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/EditDictionaryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for EditDictionaryWindow.xaml
/// </summary>
internal sealed partial class EditDictionaryWindow : Window
internal sealed partial class EditDictionaryWindow
{
private readonly Dict _dict;

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/EditFrequencyWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for EditFrequencyWindow.xaml
/// </summary>
internal sealed partial class EditFrequencyWindow : Window
internal sealed partial class EditFrequencyWindow
{
private readonly Freq _freq;
private readonly FreqOptionsControl _freqOptionsControl;
Expand Down
3 changes: 1 addition & 2 deletions JL.Windows/GUI/InfoWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System.Windows;
using System.Windows.Interop;

namespace JL.Windows.GUI;

/// <summary>
/// Interaction logic for AbbreviationWindow.xaml
/// </summary>
internal sealed partial class InfoWindow : Window
internal sealed partial class InfoWindow
{
private nint _windowHandle;

Expand Down
3 changes: 1 addition & 2 deletions JL.Windows/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
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;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
#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;
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/ManageAudioSourcesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for ManageAudioSourcesWindow.xaml
/// </summary>
internal sealed partial class ManageAudioSourcesWindow : Window
internal sealed partial class ManageAudioSourcesWindow
{
private static ManageAudioSourcesWindow? s_instance;

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/ManageDictionariesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for ManageDictionariesWindow.xaml
/// </summary>
internal sealed partial class ManageDictionariesWindow : Window
internal sealed partial class ManageDictionariesWindow
{
private static ManageDictionariesWindow? s_instance;

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/ManageFrequenciesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for ManageFrequenciesWindow.xaml
/// </summary>
internal sealed partial class ManageFrequenciesWindow : Window
internal sealed partial class ManageFrequenciesWindow
{
private static ManageFrequenciesWindow? s_instance;

Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/ManageProfiles.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for ManageProfilesWindow.xaml
/// </summary>
internal sealed partial class ManageProfilesWindow : Window
internal sealed partial class ManageProfilesWindow
{
private nint _windowHandle;
public ManageProfilesWindow()
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/PopupWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for PopupWindow.xaml
/// </summary>
internal sealed partial class PopupWindow : Window
internal sealed partial class PopupWindow
{
public PopupWindow? ChildPopupWindow { get; private set; }

Expand Down
4 changes: 2 additions & 2 deletions JL.Windows/GUI/PreferencesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for PreferenceWindow.xaml
/// </summary>
internal sealed partial class PreferencesWindow : Window
internal sealed partial class PreferencesWindow
{
private static PreferencesWindow? s_instance;
public static PreferencesWindow Instance => s_instance ??= new PreferencesWindow();
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/ReadingSelectionWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for ReadingSelectionWindow.xaml
/// </summary>
internal sealed partial class ReadingSelectionWindow : Window
internal sealed partial class ReadingSelectionWindow
{
private string? _primarySpelling;
private nint _windowHandle;
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/StatsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace JL.Windows.GUI;
/// <summary>
/// Interaction logic for StatsWindow.xaml
/// </summary>
internal sealed partial class StatsWindow : Window
internal sealed partial class StatsWindow
{
private static StatsWindow? s_instance;
private nint _windowHandle;
Expand Down
2 changes: 1 addition & 1 deletion JL.Windows/GUI/UserControls/DictOptionsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace JL.Windows.GUI.UserControls;

internal sealed partial class DictOptionsControl : UserControl
internal sealed partial class DictOptionsControl
{
public DictOptionsControl()
{
Expand Down
3 changes: 1 addition & 2 deletions JL.Windows/GUI/UserControls/FreqOptionsControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -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()
{
Expand Down

0 comments on commit 9689ff3

Please sign in to comment.