PowerRenameLocalProperties.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Text.Json; 6 7 using Microsoft.PowerToys.Settings.UI.Library.Interfaces; 8 9 namespace Microsoft.PowerToys.Settings.UI.Library 10 { 11 public class PowerRenameLocalProperties : ISettingsConfig 12 { 13 public PowerRenameLocalProperties() 14 { 15 PersistState = false; 16 MRUEnabled = false; 17 MaxMRUSize = 0; 18 ShowIcon = false; 19 ExtendedContextMenuOnly = false; 20 UseBoostLib = false; 21 } 22 23 private int _maxSize; 24 25 public bool PersistState { get; set; } 26 27 public bool MRUEnabled { get; set; } 28 29 public int MaxMRUSize 30 { 31 get 32 { 33 return _maxSize; 34 } 35 36 set 37 { 38 if (value < 0) 39 { 40 _maxSize = 0; 41 } 42 else 43 { 44 _maxSize = value; 45 } 46 } 47 } 48 49 public bool ShowIcon { get; set; } 50 51 public bool ExtendedContextMenuOnly { get; set; } 52 53 public bool UseBoostLib { get; set; } 54 55 public string ToJsonString() 56 { 57 return JsonSerializer.Serialize(this, SettingsSerializationContext.Default.PowerRenameLocalProperties); 58 } 59 60 // This function is required to implement the ISettingsConfig interface and obtain the settings configurations. 61 public string GetModuleName() 62 { 63 string moduleName = PowerRenameSettings.ModuleName; 64 return moduleName; 65 } 66 67 // This can be utilized in the future if the settings.json file is to be modified/deleted. 68 public bool UpgradeSettingsConfiguration() 69 { 70 return false; 71 } 72 } 73 }