/ src / settings-ui / Settings.UI.Library / CmdNotFoundSettings.cs
CmdNotFoundSettings.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;
 6  using System.Text.Json;
 7  using System.Text.Json.Serialization;
 8  
 9  using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
10  
11  namespace Microsoft.PowerToys.Settings.UI.Library
12  {
13      public class CmdNotFoundSettings : BasePTModuleSettings, ISettingsConfig
14      {
15          private static readonly JsonSerializerOptions SerializerOptions = new()
16          {
17              WriteIndented = true,
18          };
19  
20          public const string ModuleName = "CmdNotFound";
21  
22          public CmdNotFoundSettings()
23          {
24              Version = "1";
25              Name = ModuleName;
26          }
27  
28          public virtual void Save(SettingsUtils settingsUtils)
29          {
30              // Save settings to file
31              ArgumentNullException.ThrowIfNull(settingsUtils);
32  
33              settingsUtils.SaveSettings(JsonSerializer.Serialize(this, SerializerOptions), ModuleName);
34          }
35  
36          public string GetModuleName()
37              => Name;
38  
39          // This can be utilized in the future if the settings.json file is to be modified/deleted.
40          public bool UpgradeSettingsConfiguration()
41              => false;
42      }
43  }