PowerToys/src/core/Microsoft.PowerToys.Settings.UI.Lib/PowerRenameSettings.cs
Luthfi Mawarid 688f134051
[fxcop] Settings UI library (part 2) (#7257)
* 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
2020-10-19 13:32:05 -07:00

62 lines
1.9 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.Serialization;
using Microsoft.PowerToys.Settings.UI.Lib.Interface;
namespace Microsoft.PowerToys.Settings.UI.Lib
{
public class PowerRenameSettings : BasePTModuleSettings, ISettingsConfig
{
public const string ModuleName = "PowerRename";
[JsonPropertyName("properties")]
public PowerRenameProperties Properties { get; set; }
public PowerRenameSettings()
{
Properties = new PowerRenameProperties();
Version = "1";
Name = ModuleName;
}
public PowerRenameSettings(PowerRenameLocalProperties localProperties)
{
if (localProperties == null)
{
throw new ArgumentNullException(nameof(localProperties));
}
Properties = new PowerRenameProperties();
Properties.PersistState.Value = localProperties.PersistState;
Properties.MRUEnabled.Value = localProperties.MRUEnabled;
Properties.MaxMRUSize.Value = localProperties.MaxMRUSize;
Properties.ShowIcon.Value = localProperties.ShowIcon;
Properties.ExtendedContextMenuOnly.Value = localProperties.ExtendedContextMenuOnly;
Version = "1";
Name = ModuleName;
}
public PowerRenameSettings(string ptName)
{
Properties = new PowerRenameProperties();
Version = "1";
Name = ptName;
}
public string GetModuleName()
{
return Name;
}
// This can be utilized in the future if the power-rename-settings.json file is to be modified/deleted.
public bool UpgradeSettingsConfiguration()
{
return false;
}
}
}