mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
Merge remote-tracking branch 'origin/main' into stefan/env_var_new
This commit is contained in:
6
.github/workflows/spelling2.yml
vendored
6
.github/workflows/spelling2.yml
vendored
@@ -68,7 +68,7 @@ jobs:
|
||||
steps:
|
||||
- name: check-spelling
|
||||
id: spelling
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
uses: check-spelling/check-spelling@v0.0.22
|
||||
with:
|
||||
config: .github/actions/spell-check
|
||||
suppress_push_for_open_pull_request: 1
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
|
||||
steps:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
uses: check-spelling/check-spelling@v0.0.22
|
||||
with:
|
||||
config: .github/actions/spell-check
|
||||
checkout: true
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
|
||||
steps:
|
||||
- name: comment
|
||||
uses: check-spelling/check-spelling@v0.0.21
|
||||
uses: check-spelling/check-spelling@v0.0.22
|
||||
with:
|
||||
config: .github/actions/spell-check
|
||||
checkout: true
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
|
||||
<VcpkgEnabled>false</VcpkgEnabled>
|
||||
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(MSBuildThisFileFullPath)\..\packages\;$(ExternalIncludePath)</ExternalIncludePath>
|
||||
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
|
||||
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
|
||||
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
@@ -53,9 +56,12 @@
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<!-- CLR + CFG are not compatible >:{ -->
|
||||
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
|
||||
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
||||
@@ -15,7 +15,7 @@ Available commands:
|
||||
* Hibernate
|
||||
* Open / Empty Recycle Bin
|
||||
* UEFI Firmware Settings (Only available on systems, that boot in UEFI mode.)
|
||||
* IP / MAC / Address => Show informations about network connections.
|
||||
* IP / MAC / Address => Show information about network connections.
|
||||
|
||||
## Optional plugin settings
|
||||
|
||||
@@ -46,7 +46,7 @@ Available commands:
|
||||
|
||||
### [`NetworkConnectionProperties.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs)
|
||||
- The [`NetworkConnectionProperties`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/NetworkConnectionProperties.cs) class contains methods to get the properties of a network interface/connection.
|
||||
- An instance of this class collects/provides all required informations about one connection/adapter.
|
||||
- An instance of this class collects/provides all required information about one connection/adapter.
|
||||
|
||||
### [`SystemPluginContext.cs`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs)
|
||||
- An instance of the class [`SystemPluginContext`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Components/SystemPluginContext.cs) contains/defines the context data of a system plugin result. We select the context menu based on the defined properties.
|
||||
|
||||
@@ -238,6 +238,7 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
|
||||
keyboardLayoutMap[VK_NONCONVERT] = L"IME Non-Convert";
|
||||
keyboardLayoutMap[VK_ACCEPT] = L"IME Kana";
|
||||
keyboardLayoutMap[VK_MODECHANGE] = L"IME Mode Change";
|
||||
keyboardLayoutMap[VK_DECIMAL] = L". (Numpad)";
|
||||
keyboardLayoutMap[CommonSharedConstants::VK_DISABLED] = L"Disable";
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
|
||||
</data>
|
||||
<data name="Hosts.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Seperate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
|
||||
<value>Separate multiple hosts by space (e.g. server server.local). Maximum 9 hosts per entry.</value>
|
||||
<comment>Do not localize "server" and "server.local"</comment>
|
||||
</data>
|
||||
<data name="HostsFilter.Header" xml:space="preserve">
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace
|
||||
result.hwnd = active_window;
|
||||
// In reality, Windows Snap works if even one of those styles is set
|
||||
// for a window, it is just limited. If there is no WS_MAXIMIZEBOX using
|
||||
// WinKey + Up just won't maximize the window. Similary, without
|
||||
// WinKey + Up just won't maximize the window. Similarly, without
|
||||
// WS_MINIMIZEBOX the window will not get minimized. A "Save As..." dialog
|
||||
// is a example of such window - it can be snapped to both sides and to
|
||||
// all screen corners, but will not get maximized nor minimized.
|
||||
|
||||
@@ -13,10 +13,10 @@ using System.Diagnostics.CodeAnalysis;
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "We follow the C# Core Coding Style which avoids using `this` unless absolutely necessary.")]
|
||||
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1200:UsingDirectivesMustBePlacedWithinNamespace", Justification = "We follow the C# Core Coding Style which puts using statements outside the namespace.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and have hight impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and have hight impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and have hight impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and have hight impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:ElementsMustAppearInTheCorrectOrder", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1203:ConstantsMustAppearBeforeFields", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:StaticElementsMustAppearBeforeInstanceElements", Justification = "It is not a priority and has a high impact in code changes.")]
|
||||
|
||||
[assembly: SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:FieldNamesMustNotBeginWithUnderscore", Justification = "We follow the C# Core Coding Style which uses underscores as prefixes rather than using `this.`.")]
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace ImageResizer.Extensions
|
||||
/// Prints all metadata to debug console
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Intented for debug only!!!
|
||||
/// Intended for debug only!!!
|
||||
/// </remarks>
|
||||
public static void PrintsAllMetadataToDebugOutput(this BitmapMetadata metadata)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ namespace ImageResizer.Extensions
|
||||
/// Iterates recursively through all metadata
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Intented for debug only!!!
|
||||
/// Intended for debug only!!!
|
||||
/// </remarks>
|
||||
public static List<(string MetadataPath, object Value)> GetListOfMetadataForDebug(this BitmapMetadata metadata)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Microsoft.Plugin.WindowWalker.Components
|
||||
return true;
|
||||
},
|
||||
|
||||
// For debugging you can set the second parameter to true to see more informations.
|
||||
// For debugging you can set the second parameter to true to see more information.
|
||||
ToolTipData = GetToolTip(x.Result, false),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Microsoft.Plugin.WindowWalker.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Folder windows doesn't run in separate processes. (Klick to open Explorer properties.).
|
||||
/// Looks up a localized string similar to Folder windows doesn't run in separate processes. (Click to open Explorer properties.).
|
||||
/// </summary>
|
||||
public static string wox_plugin_windowwalker_ExplorerInfoSubTitle {
|
||||
get {
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Registry.Helper
|
||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||
/// </summary>
|
||||
/// <param name="result">The result for the context menu entires</param>
|
||||
/// <param name="result">The result for the context menu entries</param>
|
||||
/// <param name="assemblyName">The name of the this assembly</param>
|
||||
/// <returns>A list with context menu entries</returns>
|
||||
internal static List<ContextMenuResult> GetContextMenu(Result result, string assemblyName)
|
||||
|
||||
@@ -15,7 +15,7 @@ using Microsoft.PowerToys.Run.Plugin.System.Properties;
|
||||
namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents the informations for a network connection/interface
|
||||
/// This class represents the information for a network connection/interface
|
||||
/// </summary>
|
||||
internal sealed class NetworkConnectionProperties
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Microsoft.PowerToys.Run.Plugin.System
|
||||
// {
|
||||
// results.Add(new Result()
|
||||
// {
|
||||
// Title = "Getting network informations. Please wait ...",
|
||||
// Title = "Getting network information. Please wait ...",
|
||||
// IcoPath = $"Images\\networkAdapter.{IconTheme}.png",
|
||||
// Score = StringMatcher.FuzzySearch("address", "ip address").Score,
|
||||
// });
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
|
||||
|
||||
if (isKeywordSearch || !TimeDateSettings.Instance.OnlyDateTimeNowGlobal)
|
||||
{
|
||||
// We use long instead of int for unix time stamp because int ist to small after 03:14:07 UTC 2038-01-19
|
||||
// We use long instead of int for unix time stamp because int is too small after 03:14:07 UTC 2038-01-19
|
||||
long unixTimestamp = (long)dateTimeNowUtc.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
int weekOfYear = calendar.GetWeekOfYear(dateTimeNow, DateTimeFormatInfo.CurrentInfo.CalendarWeekRule, DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek);
|
||||
string era = DateTimeFormatInfo.CurrentInfo.GetEraName(calendar.GetEra(dateTimeNow));
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components
|
||||
else if (Regex.IsMatch(input, @"^u\d+") && input.Length <= 12 && long.TryParse(input.TrimStart('u'), out long secondsInt))
|
||||
{
|
||||
// unix time stamp
|
||||
// we use long instead of int because int ist to small after 03:14:07 UTC 2038-01-19
|
||||
// we use long instead of int because int is too small after 03:14:07 UTC 2038-01-19
|
||||
timestamp = new DateTime(1970, 1, 1).AddSeconds(secondsInt).ToLocalTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
/// Return a list with all context menu entries for the given <see cref="Result"/>
|
||||
/// <para>Symbols taken from <see href="https://learn.microsoft.com/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
|
||||
/// </summary>
|
||||
/// <param name="result">The result for the context menu entires</param>
|
||||
/// <param name="result">The result for the context menu entries</param>
|
||||
/// <param name="assemblyName">The name of the this assembly</param>
|
||||
/// <returns>A list with context menu entries</returns>
|
||||
internal static List<ContextMenuResult> GetContextMenu(in Result result, in string assemblyName)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
|
||||
/// <summary>
|
||||
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
|
||||
/// </summary>
|
||||
/// <param name="entry">The <see cref="WindowsSetting"/> that contain informations for the tool-tip.</param>
|
||||
/// <param name="entry">The <see cref="WindowsSetting"/> that contains information for the tool-tip.</param>
|
||||
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
|
||||
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
|
||||
{
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the variables for the specified target. Errors that occurs will be catched and logged.
|
||||
/// Returns the variables for the specified target. Errors that occurs will be caught and logged.
|
||||
/// </summary>
|
||||
/// <param name="target">The target variable source of the type <see cref="EnvironmentVariableTarget"/> </param>
|
||||
/// <returns>A dictionary with the variable or an empty dictionary on errors.</returns>
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace PowerLauncher.Plugin
|
||||
|
||||
private static void ParsePluginConfigs(IEnumerable<string> directories)
|
||||
{
|
||||
// todo use linq when diable plugin is implemented since parallel.foreach + list is not thread saft
|
||||
// todo use linq when disable plugin is implemented since parallel.foreach + list is not thread saft
|
||||
foreach (var directory in directories)
|
||||
{
|
||||
if (File.Exists(Path.Combine(directory, "NeedDelete.txt")))
|
||||
|
||||
@@ -1065,7 +1065,6 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
if (contextMenuItems.AcceleratorKey == acceleratorKey && contextMenuItems.AcceleratorModifiers == acceleratorModifiers)
|
||||
{
|
||||
MainWindowVisibility = Visibility.Collapsed;
|
||||
contextMenuItems.Command.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to work with Virtual Desktops.
|
||||
/// This helper uses only public available and documented COM-Interfaces or informations from registry.
|
||||
/// This helper uses only public available and documented COM-Interfaces or information from registry.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// To use this helper you have to create an instance of it and access the method via the helper instance.
|
||||
|
||||
@@ -1077,7 +1077,7 @@ namespace Wox.Plugin.Common.Win32
|
||||
/// <summary>
|
||||
/// The window itself contains child windows that should take part in dialog box, navigation. If this
|
||||
/// style is specified, the dialog manager recurses into children of this window when performing
|
||||
/// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic.
|
||||
/// navigation operations such as handling the TAB key, an arrow key, or a keyboard mnemonic.
|
||||
/// </summary>
|
||||
WS_EX_CONTROLPARENT = 0x10000,
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Peek.Common.Helpers
|
||||
/// </summary>
|
||||
/// <param name="path">The file/folder path</param>
|
||||
/// <param name="flags">The property store flags</param>
|
||||
/// <returns>an IPropertyStroe interface</returns>
|
||||
/// <returns>an IPropertyStore interface</returns>
|
||||
private static DisposablePropertyStore GetPropertyStoreFromPath(string path, GETPROPERTYSTOREFLAGS flags = GETPROPERTYSTOREFLAGS.GPS_EXTRINSICPROPERTIES | GETPROPERTYSTOREFLAGS.GPS_BESTEFFORT)
|
||||
{
|
||||
IShellItem2? shellItem2 = null;
|
||||
|
||||
@@ -260,7 +260,9 @@ namespace PowerAccent.Core
|
||||
{
|
||||
LetterKey.VK_A => new[] { "á" },
|
||||
LetterKey.VK_E => new[] { "é", "€" },
|
||||
LetterKey.VK_H => new[] { "ḥ" },
|
||||
LetterKey.VK_I => new[] { "í" },
|
||||
LetterKey.VK_L => new[] { "ḷ" },
|
||||
LetterKey.VK_N => new[] { "ñ" },
|
||||
LetterKey.VK_O => new[] { "ó" },
|
||||
LetterKey.VK_U => new[] { "ú", "ü" },
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
}
|
||||
catch (NullReferenceException e)
|
||||
{
|
||||
Logger.LogError("NullReferenceException catched. Skipping exception.", e);
|
||||
Logger.LogError("NullReferenceException caught. Skipping exception.", e);
|
||||
}
|
||||
}
|
||||
catch (WebView2RuntimeNotFoundException e)
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("activationaction")]
|
||||
public ColorPickerActivationAction ActivationAction { get; set; }
|
||||
|
||||
// Property ColorHistory is not used, the color history is saved separatedly in the colorHistory.json file
|
||||
// Property ColorHistory is not used, the color history is saved separately in the colorHistory.json file
|
||||
[JsonPropertyName("colorhistory")]
|
||||
public List<string> ColorHistory { get; set; }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library.Enumerations
|
||||
{
|
||||
// NOTE: don't change the order (numbers) of the enumeration entires
|
||||
// NOTE: don't change the order (numbers) of the enumeration entries
|
||||
|
||||
/// <summary>
|
||||
/// The type of the color representation
|
||||
|
||||
@@ -292,9 +292,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
|
||||
// get data needed for process
|
||||
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||
var backupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||
var backupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||
|
||||
if (backupSettingsFiles.Count == 0)
|
||||
{
|
||||
@@ -306,13 +306,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
foreach (var currentFile in backupSettingsFiles)
|
||||
{
|
||||
var relativePath = currentFile.Value.Substring(latestSettingsFolder.Length + 1);
|
||||
var retoreFullPath = Path.Combine(appBasePath, relativePath);
|
||||
var settingsToRestoreJson = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
|
||||
var restoreFullPath = Path.Combine(appBasePath, relativePath);
|
||||
var settingsToRestoreJson = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
|
||||
|
||||
if (currentSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
||||
{
|
||||
// we have a setting file to restore to
|
||||
var currentSettingsFileJson = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
|
||||
var currentSettingsFileJson = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
|
||||
|
||||
if (JsonNormalizer.Normalize(settingsToRestoreJson) != JsonNormalizer.Normalize(currentSettingsFileJson))
|
||||
{
|
||||
@@ -339,7 +339,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
if (anyFilesUpdated)
|
||||
{
|
||||
// something was changed do we need to return true to indicate a restart is needed.
|
||||
var restartAfterRestore = (bool?)backupRetoreSettings!["RestartAfterRestore"];
|
||||
var restartAfterRestore = (bool?)backupRestoreSettings!["RestartAfterRestore"];
|
||||
if (!restartAfterRestore.HasValue || restartAfterRestore.Value)
|
||||
{
|
||||
return (true, $"RESTART APP", "Success");
|
||||
@@ -639,11 +639,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
|
||||
// get data needed for process
|
||||
var backupRetoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||
var currentSettingsFiles = GetSettingsFiles(backupRetoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||
var backupRestoreSettings = JsonNode.Parse(GetBackupRestoreSettingsJson());
|
||||
var currentSettingsFiles = GetSettingsFiles(backupRestoreSettings, appBasePath).ToList().ToDictionary(x => x.Substring(appBasePath.Length));
|
||||
var fullBackupDir = Path.Combine(Path.GetTempPath(), $"settings_{DateTime.UtcNow.ToFileTimeUtc().ToString(CultureInfo.InvariantCulture)}");
|
||||
var latestSettingsFolder = GetLatestSettingsFolder();
|
||||
var lastBackupSettingsFiles = GetSettingsFiles(backupRetoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||
var lastBackupSettingsFiles = GetSettingsFiles(backupRestoreSettings, latestSettingsFolder).ToList().ToDictionary(x => x.Substring(latestSettingsFolder.Length));
|
||||
|
||||
lastBackupExists = lastBackupSettingsFiles.Count > 0;
|
||||
|
||||
@@ -661,13 +661,13 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
tempFile = currentFile;
|
||||
|
||||
// need to check and back this up;
|
||||
var currentSettingsFileToBackup = GetExportVersion(backupRetoreSettings, currentFile.Key, currentFile.Value);
|
||||
var currentSettingsFileToBackup = GetExportVersion(backupRestoreSettings, currentFile.Key, currentFile.Value);
|
||||
|
||||
var doBackup = false;
|
||||
if (lastBackupSettingsFiles.TryGetValue(currentFile.Key, out string value))
|
||||
{
|
||||
// there is a previous backup for this, get an export version of it.
|
||||
var lastSettingsFileDoc = GetExportVersion(backupRetoreSettings, currentFile.Key, value);
|
||||
var lastSettingsFileDoc = GetExportVersion(backupRestoreSettings, currentFile.Key, value);
|
||||
|
||||
// check to see if the new export version would be same as last export version.
|
||||
if (JsonNormalizer.Normalize(currentSettingsFileToBackup) != JsonNormalizer.Normalize(lastSettingsFileDoc))
|
||||
@@ -804,9 +804,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
/// Method <c>GetExportVersion</c> gets the version of the settings file that we want to backup.
|
||||
/// It will be formatted and all problematic settings removed from it.
|
||||
/// </summary>
|
||||
public static string GetExportVersion(JsonNode backupRetoreSettings, string settingFileKey, string settingsFileName)
|
||||
public static string GetExportVersion(JsonNode backupRestoreSettings, string settingFileKey, string settingsFileName)
|
||||
{
|
||||
var ignoredSettings = GetIgnoredSettings(backupRetoreSettings, settingFileKey);
|
||||
var ignoredSettings = GetIgnoredSettings(backupRestoreSettings, settingFileKey);
|
||||
var settingsFile = JsonDocument.Parse(File.ReadAllText(settingsFileName));
|
||||
|
||||
var outputBuffer = new ArrayBufferWriter<byte>();
|
||||
@@ -828,7 +828,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
if (settingFileKey.Equals("\\PowerToys Run\\settings.json", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// PowerToys Run hack fix-up
|
||||
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRetoreSettings);
|
||||
var ptRunIgnoredSettings = GetPTRunIgnoredSettings(backupRestoreSettings);
|
||||
var ptrSettings = JsonNode.Parse(Encoding.UTF8.GetString(outputBuffer.WrittenSpan));
|
||||
|
||||
foreach (JsonObject pluginToChange in ptRunIgnoredSettings)
|
||||
@@ -856,16 +856,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
/// <summary>
|
||||
/// Method <c>GetPTRunIgnoredSettings</c> gets the 'Run-Plugin-level' settings we should ignore because they are problematic to backup/restore.
|
||||
/// </summary>
|
||||
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRetoreSettings)
|
||||
private static JsonArray GetPTRunIgnoredSettings(JsonNode backupRestoreSettings)
|
||||
{
|
||||
if (backupRetoreSettings == null)
|
||||
if (backupRestoreSettings == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(backupRetoreSettings));
|
||||
throw new ArgumentNullException(nameof(backupRestoreSettings));
|
||||
}
|
||||
|
||||
if (backupRetoreSettings["IgnoredPTRunSettings"] != null)
|
||||
if (backupRestoreSettings["IgnoredPTRunSettings"] != null)
|
||||
{
|
||||
return (JsonArray)backupRetoreSettings["IgnoredPTRunSettings"];
|
||||
return (JsonArray)backupRestoreSettings["IgnoredPTRunSettings"];
|
||||
}
|
||||
|
||||
return new JsonArray();
|
||||
@@ -874,11 +874,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
/// <summary>
|
||||
/// Method <c>GetIgnoredSettings</c> gets the 'top-level' settings we should ignore because they are problematic to backup/restore.
|
||||
/// </summary>
|
||||
private static string[] GetIgnoredSettings(JsonNode backupRetoreSettings, string settingFileKey)
|
||||
private static string[] GetIgnoredSettings(JsonNode backupRestoreSettings, string settingFileKey)
|
||||
{
|
||||
if (backupRetoreSettings == null)
|
||||
if (backupRestoreSettings == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(backupRetoreSettings));
|
||||
throw new ArgumentNullException(nameof(backupRestoreSettings));
|
||||
}
|
||||
|
||||
if (settingFileKey.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -886,11 +886,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
settingFileKey = settingFileKey.Substring(1);
|
||||
}
|
||||
|
||||
if (backupRetoreSettings["IgnoredSettings"] != null)
|
||||
if (backupRestoreSettings["IgnoredSettings"] != null)
|
||||
{
|
||||
if (backupRetoreSettings["IgnoredSettings"][settingFileKey] != null)
|
||||
if (backupRestoreSettings["IgnoredSettings"][settingFileKey] != null)
|
||||
{
|
||||
var settingsArray = (JsonArray)backupRetoreSettings["IgnoredSettings"][settingFileKey];
|
||||
var settingsArray = (JsonArray)backupRestoreSettings["IgnoredSettings"][settingFileKey];
|
||||
|
||||
Console.WriteLine("settingsArray " + settingsArray.GetType().FullName);
|
||||
|
||||
|
||||
@@ -3677,7 +3677,7 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<value>Security key</value>
|
||||
</data>
|
||||
<data name="Hosts_Encoding.Description" xml:space="preserve">
|
||||
<value>Chose the encoding of the hosts file</value>
|
||||
<value>Choose the encoding of the hosts file</value>
|
||||
<comment>"Hosts" refers to the system hosts file, do not loc</comment>
|
||||
</data>
|
||||
<data name="Hosts_Encoding.Header" xml:space="preserve">
|
||||
|
||||
@@ -703,7 +703,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method <c>SelectSettingBackupDir</c> opens folder browser to select a backup and retore location.
|
||||
/// Method <c>SelectSettingBackupDir</c> opens folder browser to select a backup and restore location.
|
||||
/// </summary>
|
||||
private async void SelectSettingBackupDir()
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
// TextBox setting
|
||||
public bool ShowTextBox => _additionalOption.PluginOptionType == PluginAdditionalOption.AdditionalOptionType.Textbox;
|
||||
|
||||
public int TextBoxMaxLength => (_additionalOption.TextBoxMaxLength == null) ? 0 : _additionalOption.TextBoxMaxLength.Value; // 0 ist the default and means no limit.
|
||||
public int TextBoxMaxLength => (_additionalOption.TextBoxMaxLength == null) ? 0 : _additionalOption.TextBoxMaxLength.Value; // 0 is the default and means no limit.
|
||||
|
||||
public string TextValue
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user