2023-02-24 13:30:30 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
|
2023-10-11 15:58:19 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Text.Json;
|
2023-02-24 13:30:30 +00:00
|
|
|
|
using System.Text.Json.Serialization;
|
2024-10-17 05:14:57 -04:00
|
|
|
|
|
2023-02-24 13:30:30 +00:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Library
|
|
|
|
|
|
{
|
|
|
|
|
|
public class MouseJumpSettings : BasePTModuleSettings, ISettingsConfig
|
|
|
|
|
|
{
|
|
|
|
|
|
public const string ModuleName = "MouseJump";
|
|
|
|
|
|
|
2023-12-28 13:37:13 +03:00
|
|
|
|
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
|
|
|
|
|
{
|
|
|
|
|
|
WriteIndented = true,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2023-02-24 13:30:30 +00:00
|
|
|
|
[JsonPropertyName("properties")]
|
|
|
|
|
|
public MouseJumpProperties Properties { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public MouseJumpSettings()
|
|
|
|
|
|
{
|
|
|
|
|
|
Name = ModuleName;
|
|
|
|
|
|
Properties = new MouseJumpProperties();
|
|
|
|
|
|
Version = "1.0";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-11 15:58:19 +01:00
|
|
|
|
public void Save(ISettingsUtils settingsUtils)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Save settings to file
|
2023-12-28 13:37:13 +03:00
|
|
|
|
var options = _serializerOptions;
|
2023-10-11 15:58:19 +01:00
|
|
|
|
|
2023-11-22 12:46:59 -05:00
|
|
|
|
ArgumentNullException.ThrowIfNull(settingsUtils);
|
2023-10-11 15:58:19 +01:00
|
|
|
|
|
|
|
|
|
|
settingsUtils.SaveSettings(JsonSerializer.Serialize(this, options), ModuleName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-24 13:30:30 +00:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|