mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[NewUtility]Advanced Paste (#23)
Advanced Paste V1 implementation --------- Co-authored-by: Stefan Markovic <stefan@janeasystems.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Jordi Adoumie <98557455+joadoumie@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
committed by
Jaime Bernardo
parent
c601a3e3e2
commit
483f7aa464
48
src/settings-ui/Settings.UI.Library/AdvancedPasteSettings.cs
Normal file
48
src/settings-ui/Settings.UI.Library/AdvancedPasteSettings.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
// 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.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class AdvancedPasteSettings : BasePTModuleSettings, ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "AdvancedPaste";
|
||||
|
||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
[JsonPropertyName("properties")]
|
||||
public AdvancedPasteProperties Properties { get; set; }
|
||||
|
||||
public AdvancedPasteSettings()
|
||||
{
|
||||
Properties = new AdvancedPasteProperties();
|
||||
Version = "1";
|
||||
Name = ModuleName;
|
||||
}
|
||||
|
||||
public virtual void Save(ISettingsUtils settingsUtils)
|
||||
{
|
||||
// Save settings to file
|
||||
var options = _serializerOptions;
|
||||
|
||||
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||
|
||||
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
||||
}
|
||||
|
||||
public string GetModuleName()
|
||||
=> Name;
|
||||
|
||||
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
=> false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user