mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
.NET 8 Upgrade Silenced Errors Fix (#30469)
* [Dev][Build] .NET 8 Upgrade Silenced errors first fix. * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1859 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1854. * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1860 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1861 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1862 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1863 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1864 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA1865 * [Dev][Build] .NET 8 Upgrade Silenced errors. CA2208 * [Dev][Build] .NET 8 Upgrade Silenced errors. CS9191 * [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check * [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check * [Dev][Build] .NET 8 Upgrade Silenced errors. - CompositeFormat variables used more than once in the same file were assigned to a single variable. - GetProcessesByName logic fix. - String comparion fix. - ArgumentOutOfRangeException message change. * [Dev][Build] .NET 8 Upgrade Silenced errors. - Null check added. - static readonly CompositeFormat added for all fields.
This commit is contained in:
@@ -15,7 +15,7 @@ namespace PowerAccent.Core.Services;
|
||||
public class SettingsService
|
||||
{
|
||||
private const string PowerAccentModuleName = "QuickAccent";
|
||||
private readonly ISettingsUtils _settingsUtils;
|
||||
private readonly SettingsUtils _settingsUtils;
|
||||
private readonly IFileSystemWatcher _watcher;
|
||||
private readonly object _loadingSettingsLock = new object();
|
||||
private KeyboardListener _keyboardListener;
|
||||
@@ -28,6 +28,11 @@ public class SettingsService
|
||||
_watcher = Helper.GetFileWatcher(PowerAccentModuleName, "settings.json", () => { ReadSettings(); });
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
private void ReadSettings()
|
||||
{
|
||||
// TODO this IO call should by Async, update GetFileWatcher helper to support async
|
||||
@@ -40,10 +45,7 @@ public class SettingsService
|
||||
{
|
||||
Logger.LogInfo("QuickAccent settings.json was missing, creating a new one");
|
||||
var defaultSettings = new PowerAccentSettings();
|
||||
var options = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
};
|
||||
var options = _serializerOptions;
|
||||
|
||||
_settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), PowerAccentModuleName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user