mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-25 18:18:16 +08:00
688f134051
* Suppress warnings for read-only collection properties (see code comments) * Call ConfigureAwait on tasks * Add CultureInfo and StringComparison policy for certain string operations * Add checks and exceptions for null arguments to public methods * Rename RaisePropertyChanged to NotifyPropertyChanged * Suppress CA1000 warning on SettingsRepository class * Implement Disposable pattern in HotkeySettingsControlHook * Modify null argument handling in KeyboardManagerViewModel::CombineShortcutLists
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using Microsoft.PowerToys.Settings.UI.Lib.Interface;
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Lib
|
|
{
|
|
public class PowerLauncherSettings : BasePTModuleSettings, ISettingsConfig
|
|
{
|
|
public const string ModuleName = "PowerToys Run";
|
|
|
|
[JsonPropertyName("properties")]
|
|
public PowerLauncherProperties Properties { get; set; }
|
|
|
|
public PowerLauncherSettings()
|
|
{
|
|
Properties = new PowerLauncherProperties();
|
|
Version = "1.0";
|
|
Name = ModuleName;
|
|
}
|
|
|
|
public virtual void Save(ISettingsUtils settingsUtils)
|
|
{
|
|
// Save settings to file
|
|
var options = new JsonSerializerOptions
|
|
{
|
|
WriteIndented = true,
|
|
};
|
|
|
|
if (settingsUtils == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(settingsUtils));
|
|
}
|
|
|
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
|
}
|
|
|
|
public string GetModuleName()
|
|
{
|
|
return Name;
|
|
}
|
|
|
|
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
|
public bool UpgradeSettingsConfiguration()
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|