mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
New Utility: New+ (#33136)
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
committed by
GitHub
parent
d7a07dc7c8
commit
3f44ad186d
@@ -462,6 +462,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool newPlus;
|
||||
|
||||
[JsonPropertyName("NewPlus")] // This key must match newplus::constants::non_localizable
|
||||
public bool NewPlus
|
||||
{
|
||||
get => newPlus;
|
||||
set
|
||||
{
|
||||
if (newPlus != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
newPlus = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool workspaces = true;
|
||||
|
||||
[JsonPropertyName("Workspaces")]
|
||||
|
||||
48
src/settings-ui/Settings.UI.Library/NewPlusSettings.cs
Normal file
48
src/settings-ui/Settings.UI.Library/NewPlusSettings.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.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Settings.UI.Library.Resources;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class NewPlusSettings : ISettingsConfig
|
||||
{
|
||||
public const string ModuleName = "NewPlus";
|
||||
|
||||
public void InitializeWithDefaultSettings()
|
||||
{
|
||||
// This code path should never happen
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
}
|
||||
|
||||
[JsonPropertyName("HideFileExtension")]
|
||||
public bool HideFileExtension { get; set; }
|
||||
|
||||
[JsonPropertyName("HideStartingDigits")]
|
||||
public bool HideStartingDigits { get; set; }
|
||||
|
||||
[JsonPropertyName("TemplateLocation")]
|
||||
public string TemplateLocation { get; set; }
|
||||
|
||||
public string GetModuleName()
|
||||
{
|
||||
return ModuleName;
|
||||
}
|
||||
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
||||
return Directory.GetParent(settingsPath).FullName;
|
||||
}
|
||||
|
||||
public static string GetPowerToysInstallationWinUI3AppsAssetsFolder()
|
||||
{
|
||||
// return .\PowerToys\WinUI3Apps\Assets
|
||||
return Path.Combine(GetPowerToysInstallationFolder(), "WinUI3Apps", "Assets");
|
||||
}
|
||||
|
||||
private static readonly global::PowerToys.Interop.LayoutMapManaged LayoutMap = new global::PowerToys.Interop.LayoutMapManaged();
|
||||
|
||||
public static string GetKeyName(uint key)
|
||||
@@ -148,6 +154,30 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyDirectory(string source_directory, string destination_directory, bool copy_recursively)
|
||||
{
|
||||
var current_directory_info = new DirectoryInfo(source_directory);
|
||||
|
||||
DirectoryInfo[] source_subdirectories = current_directory_info.GetDirectories();
|
||||
|
||||
Directory.CreateDirectory(destination_directory);
|
||||
|
||||
foreach (FileInfo file in current_directory_info.GetFiles())
|
||||
{
|
||||
string destination_file_path = Path.Combine(destination_directory, file.Name);
|
||||
file.CopyTo(destination_file_path, true);
|
||||
}
|
||||
|
||||
if (copy_recursively)
|
||||
{
|
||||
foreach (DirectoryInfo subdirectory in source_subdirectories)
|
||||
{
|
||||
string newDestinationDir = Path.Combine(destination_directory, subdirectory.Name);
|
||||
CopyDirectory(subdirectory.FullName, newDestinationDir, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly uint VirtualKeyWindows = global::PowerToys.Interop.Constants.VK_WIN_BOTH;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user