From a2a063e6a29fafa5295eb086e8973781e82c633f Mon Sep 17 00:00:00 2001 From: Varun Arora Date: Fri, 30 Oct 2020 14:19:09 -0400 Subject: [PATCH 01/20] Fix typos in Readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 85164f8101..ffecab2a6e 100644 --- a/README.md +++ b/README.md @@ -105,11 +105,11 @@ Download PowerToys from [WinGet](https://github.com/microsoft/winget-cli/release WinGet install powertoys ``` -### Experiential PowerToys utility with Video conference muting +### Experimental PowerToys utility with Video conference muting Install the [pre-release experimental version of PowerToys][github-prerelease-link] to try out this version. It includes all improvements from 0.23 in addition to the Video conference utility. Click on `Assets` to show the files available in the release and then download the .exe installer. -**Note:** We'll have 0.26 Experiemental out in the first week of November 2020. +**Note:** We'll have 0.26 Experimental out in the first week of November 2020. ### Other install methods From bd34127cd4ddfc5a168fbd8e1a69f9292cb2732c Mon Sep 17 00:00:00 2001 From: Alekhya Date: Fri, 30 Oct 2020 12:53:57 -0700 Subject: [PATCH 02/20] Add unit tests for incorrect settings json files (#7644) * added some test config files * Added tests for each powertoy to ensure that they don't crash even when there is a corrupt json * Revert "Added tests for each powertoy to ensure that they don't crash even when there is a corrupt json" This reverts commit fe3ed409020b8f5d6529b05699ec60a1f5d7ea57. * Revert "added some test config files" This reverts commit d08928423aa49d0cb42c72d51e8a9abf7c9d069e. * add a settings utils to test that a default item is returned when the json file is corrupt --- .../Microsoft/PowerToys/settings.json | Bin 0 -> 1043 bytes .../ModelsTests/SettingsUtilsTests.cs | 39 +++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/CorruptJson/Microsoft/PowerToys/settings.json diff --git a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/CorruptJson/Microsoft/PowerToys/settings.json b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/TestFiles/CorruptJson/Microsoft/PowerToys/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..7e9dae7531ffcb90f866f58e76927bc578aee736 GIT binary patch literal 1043 UcmZQz7zLvtFd71*Apj2n00a{N0RR91 literal 0 HcmV?d00001 diff --git a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs index 1289f7015d..6d7d354ff7 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs @@ -7,7 +7,9 @@ using System.IO; using System.Linq; using System.Text.Json; using Microsoft.PowerToys.Settings.UI.Library; +using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UI.Library.Utilities; +using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; using Microsoft.PowerToys.Settings.UnitTest; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -19,7 +21,6 @@ namespace CommonLibTest public class SettingsUtilsTests { - [TestMethod] public void SaveSettingsSaveSettingsToFileWhenFilePathExists() { @@ -79,6 +80,21 @@ namespace CommonLibTest Assert.IsTrue(pathFound); } + [TestMethod] + public void SettingsUtilsMustReturnDefaultItemWhenFileIsCorrupt() + { + // Arrange + var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider("CorruptJson", string.Empty, "settings.json"); + var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object); + + // Act + TestClass settings = mockSettingsUtils.GetSettings(string.Empty); + + // Assert + Assert.AreEqual(settings.TestInt, 100); + Assert.AreEqual(settings.TestString, "test"); + } + public static string RandomString() { Random random = new Random(); @@ -88,5 +104,26 @@ namespace CommonLibTest return new string(Enumerable.Repeat(chars, length) .Select(s => s[random.Next(s.Length)]).ToArray()); } + + partial class TestClass : ISettingsConfig + { + public int TestInt { get; set; } = 100; + public string TestString { get; set; } = "test"; + + public string GetModuleName() + { + throw new NotImplementedException(); + } + + public string ToJsonString() + { + return JsonSerializer.Serialize(this); + } + + public bool UpgradeSettingsConfiguration() + { + throw new NotImplementedException(); + } + } } } From dddafc8944d63f6ba8df14db30161572e390e0da Mon Sep 17 00:00:00 2001 From: csigs Date: Fri, 30 Oct 2020 23:06:23 +0000 Subject: [PATCH 03/20] LEGO: check in for master to temporary branch. --- .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../bootstrapper/Resources.resx.lcl | 6 +++ .../loc/cs/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/de/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/es/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/fr/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/hu/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/ja/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/nl/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/pt-BR/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/ru/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/tr/src/runner/Resources.resx.lcl | 15 +++++++ .../loc/zh-Hans/src/runner/Resources.resx.lcl | 15 +++++++ .../Strings/en-us/Resources.resw.lcl | 41 ++---------------- .../Strings/en-us/Resources.resw.lcl | 42 +++---------------- .../Strings/en-us/Resources.resw.lcl | 40 +++--------------- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Properties/Resources.resx.lcl | 7 +++- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../Wox.Plugin/Properties/Resources.resx.lcl | 18 ++++---- .../cs/src/action_runner/Resources.resx.lcl | 6 +++ .../de/src/action_runner/Resources.resx.lcl | 6 +++ .../es/src/action_runner/Resources.resx.lcl | 6 +++ .../fr/src/action_runner/Resources.resx.lcl | 6 +++ .../hu/src/action_runner/Resources.resx.lcl | 6 +++ .../ja/src/action_runner/Resources.resx.lcl | 6 +++ .../nl/src/action_runner/Resources.resx.lcl | 6 +++ .../src/action_runner/Resources.resx.lcl | 6 +++ .../ru/src/action_runner/Resources.resx.lcl | 6 +++ .../sv/src/action_runner/Resources.resx.lcl | 6 +++ .../tr/src/action_runner/Resources.resx.lcl | 6 +++ .../src/action_runner/Resources.resx.lcl | 6 +++ 56 files changed, 458 insertions(+), 221 deletions(-) diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/cs/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/cs/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 806af68f3a..6bcc4709de 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/cs/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/cs/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/de/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/de/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 125d416730..0ceb815e69 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/de/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/de/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/es/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/es/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 74588a0bf4..5f8875c61d 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/es/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/es/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/fr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/fr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index fb70b6e461..68c63c6898 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/fr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/fr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/hu/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/hu/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 47eb8d05a1..170a038827 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/hu/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/hu/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/ja/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/ja/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index e72715f337..0ea663700a 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/ja/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/ja/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/nl/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/nl/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 5a2c84c762..732cf16cab 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/nl/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/nl/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/pt-BR/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/pt-BR/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 1ca19d3324..e34f883dce 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/pt-BR/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/pt-BR/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/ru/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/ru/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index 03c917be3f..841505881b 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/ru/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/ru/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/sv/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/sv/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index a66e6cb92e..506e8580a1 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/sv/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/sv/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/tr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/tr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index c10bb57c10..c80fbc0db4 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/tr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/tr/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/installer/PowerToysBootstrapper/bootstrapper/loc/zh-Hans/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl b/installer/PowerToysBootstrapper/bootstrapper/loc/zh-Hans/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl index ee330663f3..a1d18ae8d6 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/loc/zh-Hans/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl +++ b/installer/PowerToysBootstrapper/bootstrapper/loc/zh-Hans/installer/PowerToysBootstrapper/bootstrapper/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/action_runner/loc/cs/src/runner/Resources.resx.lcl b/src/action_runner/loc/cs/src/runner/Resources.resx.lcl index 4dec18f832..f6d43d2ad5 100644 --- a/src/action_runner/loc/cs/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/cs/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/de/src/runner/Resources.resx.lcl b/src/action_runner/loc/de/src/runner/Resources.resx.lcl index 5b8e0e52b3..7424804ed1 100644 --- a/src/action_runner/loc/de/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/de/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/es/src/runner/Resources.resx.lcl b/src/action_runner/loc/es/src/runner/Resources.resx.lcl index 8150491f92..3ced2ecaff 100644 --- a/src/action_runner/loc/es/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/es/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/fr/src/runner/Resources.resx.lcl b/src/action_runner/loc/fr/src/runner/Resources.resx.lcl index 6a6ad56295..2674cc5036 100644 --- a/src/action_runner/loc/fr/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/fr/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/hu/src/runner/Resources.resx.lcl b/src/action_runner/loc/hu/src/runner/Resources.resx.lcl index 2d1197d4a7..18f1420373 100644 --- a/src/action_runner/loc/hu/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/hu/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/ja/src/runner/Resources.resx.lcl b/src/action_runner/loc/ja/src/runner/Resources.resx.lcl index 95e71485cd..f8c5716a14 100644 --- a/src/action_runner/loc/ja/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/ja/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/nl/src/runner/Resources.resx.lcl b/src/action_runner/loc/nl/src/runner/Resources.resx.lcl index 062cf9bdaa..80862face2 100644 --- a/src/action_runner/loc/nl/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/nl/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/pt-BR/src/runner/Resources.resx.lcl b/src/action_runner/loc/pt-BR/src/runner/Resources.resx.lcl index 32f7bcdbee..ec55d333e5 100644 --- a/src/action_runner/loc/pt-BR/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/pt-BR/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/ru/src/runner/Resources.resx.lcl b/src/action_runner/loc/ru/src/runner/Resources.resx.lcl index 45350da9a6..9c5febc6f5 100644 --- a/src/action_runner/loc/ru/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/ru/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/tr/src/runner/Resources.resx.lcl b/src/action_runner/loc/tr/src/runner/Resources.resx.lcl index dcb2988a86..4dc1589b9d 100644 --- a/src/action_runner/loc/tr/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/tr/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/action_runner/loc/zh-Hans/src/runner/Resources.resx.lcl b/src/action_runner/loc/zh-Hans/src/runner/Resources.resx.lcl index a905f2d967..6443430967 100644 --- a/src/action_runner/loc/zh-Hans/src/runner/Resources.resx.lcl +++ b/src/action_runner/loc/zh-Hans/src/runner/Resources.resx.lcl @@ -13,30 +13,45 @@ + + + + + + + + + + + + + + + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/loc/ja/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl b/src/core/Microsoft.PowerToys.Settings.UI/loc/ja/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl index 09179c1389..03966f7659 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/loc/ja/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl +++ b/src/core/Microsoft.PowerToys.Settings.UI/loc/ja/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl @@ -148,6 +148,9 @@ + + + @@ -1483,33 +1486,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1600,15 +1576,6 @@ - - - - - - - - - @@ -1783,7 +1750,7 @@ - + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/loc/sv/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl b/src/core/Microsoft.PowerToys.Settings.UI/loc/sv/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl index 4dc5864958..9eeb7fc5db 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/loc/sv/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl +++ b/src/core/Microsoft.PowerToys.Settings.UI/loc/sv/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl @@ -148,6 +148,9 @@ + + + @@ -1483,33 +1486,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1600,12 +1576,6 @@ - - - - - - @@ -1736,7 +1706,7 @@ - + @@ -1780,8 +1750,8 @@ - - + + diff --git a/src/core/Microsoft.PowerToys.Settings.UI/loc/tr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl b/src/core/Microsoft.PowerToys.Settings.UI/loc/tr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl index 11942a2183..c8ff36ebf0 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/loc/tr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl +++ b/src/core/Microsoft.PowerToys.Settings.UI/loc/tr/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw.lcl @@ -148,6 +148,9 @@ + + + @@ -1483,33 +1486,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1600,12 +1576,6 @@ - - - - - - @@ -1780,8 +1750,8 @@ - - + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/cs/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/cs/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index f28540fc21..6a3796d24e 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/cs/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/cs/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/de/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/de/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index 9a75765a99..874b851f44 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/de/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/de/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/es/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/es/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index 7c36f5d32d..8da044f71f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/es/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/es/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ja/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ja/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index ff1909f985..62081c6ecb 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ja/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ja/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/pl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/pl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index dd53424263..4a1fcd4631 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/pl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/pl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ru/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ru/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index f491a5aa2b..bf1ce31dd8 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ru/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/ru/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/zh-Hant/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/zh-Hant/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index 277fad0bcc..f6c8d2cb11 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/zh-Hant/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/zh-Hant/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + diff --git a/src/modules/launcher/Wox.Plugin/loc/cs/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/cs/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 20aa817c87..894b58408f 100644 --- a/src/modules/launcher/Wox.Plugin/loc/cs/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/cs/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/de/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/de/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index f2c7a84fc1..e8433ea738 100644 --- a/src/modules/launcher/Wox.Plugin/loc/de/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/de/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/es/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/es/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 9e743b6bd6..d52642fde1 100644 --- a/src/modules/launcher/Wox.Plugin/loc/es/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/es/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/fr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/fr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index e67764b6e2..6f087f90e3 100644 --- a/src/modules/launcher/Wox.Plugin/loc/fr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/fr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/hu/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/hu/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index ca61fd5acc..338d7a142d 100644 --- a/src/modules/launcher/Wox.Plugin/loc/hu/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/hu/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/ja/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/ja/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 9c053516cc..b458bb4d8f 100644 --- a/src/modules/launcher/Wox.Plugin/loc/ja/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/ja/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/nl/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/nl/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index acad4295fc..e8644aaba3 100644 --- a/src/modules/launcher/Wox.Plugin/loc/nl/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/nl/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/pt-BR/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/pt-BR/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index e455f4b6fb..6508d57795 100644 --- a/src/modules/launcher/Wox.Plugin/loc/pt-BR/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/pt-BR/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/ru/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/ru/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 492d44b6b1..1a6c046d1b 100644 --- a/src/modules/launcher/Wox.Plugin/loc/ru/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/ru/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/tr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/tr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 6c57456e62..2ccdcfdb1c 100644 --- a/src/modules/launcher/Wox.Plugin/loc/tr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/tr/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/modules/launcher/Wox.Plugin/loc/zh-Hans/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl b/src/modules/launcher/Wox.Plugin/loc/zh-Hans/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl index 5d0e91b07e..49c1ef83da 100644 --- a/src/modules/launcher/Wox.Plugin/loc/zh-Hans/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Wox.Plugin/loc/zh-Hans/src/modules/launcher/Wox.Plugin/Properties/Resources.resx.lcl @@ -13,29 +13,29 @@ + + + - - - + + + - - - + + + - - - diff --git a/src/runner/loc/cs/src/action_runner/Resources.resx.lcl b/src/runner/loc/cs/src/action_runner/Resources.resx.lcl index 8beb29a7c1..89e892c2e6 100644 --- a/src/runner/loc/cs/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/cs/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/de/src/action_runner/Resources.resx.lcl b/src/runner/loc/de/src/action_runner/Resources.resx.lcl index d99f085585..5826030b5c 100644 --- a/src/runner/loc/de/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/de/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/es/src/action_runner/Resources.resx.lcl b/src/runner/loc/es/src/action_runner/Resources.resx.lcl index d78d024efc..2f978f7757 100644 --- a/src/runner/loc/es/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/es/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/fr/src/action_runner/Resources.resx.lcl b/src/runner/loc/fr/src/action_runner/Resources.resx.lcl index 639270293d..e2d38405a8 100644 --- a/src/runner/loc/fr/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/fr/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/hu/src/action_runner/Resources.resx.lcl b/src/runner/loc/hu/src/action_runner/Resources.resx.lcl index 0c36c36a11..d87852e4fd 100644 --- a/src/runner/loc/hu/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/hu/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/ja/src/action_runner/Resources.resx.lcl b/src/runner/loc/ja/src/action_runner/Resources.resx.lcl index b60fa45e9d..bee976fffd 100644 --- a/src/runner/loc/ja/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/ja/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/nl/src/action_runner/Resources.resx.lcl b/src/runner/loc/nl/src/action_runner/Resources.resx.lcl index aeef6a2496..f6532ba6d9 100644 --- a/src/runner/loc/nl/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/nl/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/pt-BR/src/action_runner/Resources.resx.lcl b/src/runner/loc/pt-BR/src/action_runner/Resources.resx.lcl index 79e1b8e479..4c5dbe8c3c 100644 --- a/src/runner/loc/pt-BR/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/pt-BR/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/ru/src/action_runner/Resources.resx.lcl b/src/runner/loc/ru/src/action_runner/Resources.resx.lcl index 807b9d35ed..4d9d4a3b2b 100644 --- a/src/runner/loc/ru/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/ru/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/sv/src/action_runner/Resources.resx.lcl b/src/runner/loc/sv/src/action_runner/Resources.resx.lcl index ed0367d71f..c7408b5485 100644 --- a/src/runner/loc/sv/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/sv/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/tr/src/action_runner/Resources.resx.lcl b/src/runner/loc/tr/src/action_runner/Resources.resx.lcl index 12956b6344..6f0ecc85e8 100644 --- a/src/runner/loc/tr/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/tr/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + diff --git a/src/runner/loc/zh-Hans/src/action_runner/Resources.resx.lcl b/src/runner/loc/zh-Hans/src/action_runner/Resources.resx.lcl index a093755685..dcae1a05a7 100644 --- a/src/runner/loc/zh-Hans/src/action_runner/Resources.resx.lcl +++ b/src/runner/loc/zh-Hans/src/action_runner/Resources.resx.lcl @@ -13,12 +13,18 @@ + + + + + + From 2c5b9b4d5252bfd1dca474166373d9636778cbb6 Mon Sep 17 00:00:00 2001 From: Avneet Kaur <72103212+avneet-kr@users.noreply.github.com> Date: Fri, 30 Oct 2020 16:43:09 -0700 Subject: [PATCH 04/20] Audit culture bugs (#7707) * Added comments and fixed CultureInfo / StringComparison where appropriate * Addressed comments * Fixed comment --- .../Utilities/Logger.cs | 1 + .../BackCompatTestProperties.cs | 6 ++++-- .../Mocks/IIOProviderMocks.cs | 4 +++- .../ViewModelTests/ImageResizer.cs | 1 + .../Helpers/ColorRepresentationHelper.cs | 3 +++ .../colorPicker/ColorPickerUI/Helpers/Logger.cs | 3 ++- .../editor/FancyZonesEditor/App.xaml.cs | 2 ++ .../tests/Properties/SettingsTests.cs | 1 + .../tests/Views/TimeRemainingConverterTests.cs | 1 + .../imageresizer/ui/Models/ResizeOperation.cs | 1 + .../imageresizer/ui/Properties/Settings.cs | 2 ++ .../ExtendedCalculatorParserTests.cs | 4 ++++ .../CalculateEngine.cs | 1 + .../Plugins/Microsoft.Plugin.Calculator/Main.cs | 1 + .../Microsoft.Plugin.Calculator/ResultHelper.cs | 2 ++ .../DriveOrSharedFolderTests.cs | 4 +++- .../InternalQueryFolderTests.cs | 8 +++++--- .../Sources/Path/DriveInformation.cs | 2 ++ .../Sources/Path/FolderHelper.cs | 5 ++++- .../Sources/QueryInternalDirectory.cs | 4 +++- .../Sources/Result/FileItemResult.cs | 2 ++ .../Sources/Result/FolderItemResult.cs | 2 ++ .../Sources/Result/TruncatedItemResult.cs | 2 ++ .../Sources/ShellAction.cs | 3 ++- .../Microsoft.Plugin.Folder/UserFolderResult.cs | 2 ++ .../ContextMenuLoader.cs | 1 + .../Plugins/Microsoft.Plugin.Indexer/Main.cs | 2 ++ .../SearchHelper/WindowsSearchAPI.cs | 8 +++++--- .../Programs/Win32Tests.cs | 1 + .../DoubleDashProgramArgumentParser.cs | 1 + .../Microsoft.Plugin.Program/Programs/UWP.cs | 2 ++ .../Programs/UWPApplication.cs | 10 ++++++++++ .../Programs/Win32Program.cs | 17 +++++++++++++++++ .../Storage/EventHandler.cs | 1 + .../Storage/Win32ProgramRepository.cs | 13 ++++++++++--- .../Plugins/Microsoft.Plugin.Shell/Main.cs | 5 +++++ .../Plugins/Microsoft.Plugin.Uri/Main.cs | 2 ++ .../UriHelper/ExtendedUriParser.cs | 7 ++++--- .../Components/FuzzyMatching.cs | 1 + .../Components/NativeMethods.cs | 1 + .../Components/SearchController.cs | 1 + .../Components/Window.cs | 2 ++ .../Helper/DataWebRequestFactory.cs | 3 ++- .../launcher/PowerLauncher/ReportWindow.xaml.cs | 4 +++- .../launcher/PowerLauncher/SettingsWatcher.cs | 1 + .../PowerLauncher/ViewModel/MainViewModel.cs | 11 ++++++++++- .../Exception/ExceptionFormatter.cs | 2 ++ .../Wox.Infrastructure/Image/ImageLoader.cs | 1 + .../Wox.Infrastructure/Storage/JsonStorage`1.cs | 4 ++-- .../Wox.Infrastructure/StringMatcher.cs | 1 + .../Wox.Test/Plugins/WindowsIndexerTest.cs | 7 +++++++ .../Utilities/SvgPreviewHandlerHelper.cs | 5 ++++- .../SvgThumbnailProvider.cs | 4 +++- .../common/controls/WebBrowserExt.cs | 3 ++- 54 files changed, 160 insertions(+), 28 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI.Library/Utilities/Logger.cs b/src/core/Microsoft.PowerToys.Settings.UI.Library/Utilities/Logger.cs index 7d98018af7..6c11c0059f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.Library/Utilities/Logger.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.Library/Utilities/Logger.cs @@ -20,6 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities Directory.CreateDirectory(ApplicationLogPath); } + // Using InvariantCulture since this is used for a log file name var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt"); Trace.Listeners.Add(new TextWriterTraceListener(logFilePath)); diff --git a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs index 28ed4f04bc..4d5e268292 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs @@ -45,7 +45,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility public static MockGetModuleIOProvider(string version, string module, string fileName) { - + // Using StringComparison.Ordinal / CultureInfo.InvariantCulture since this is used internally var stubSettingsPath = string.Format(CultureInfo.InvariantCulture, BackCompatTestProperties.RootPathStubFiles, version, module, fileName); Expression> filterExpression = (string s) => s.Contains(module, StringComparison.Ordinal); var mockIOProvider = IIOProviderMocks.GetMockIOReadWithStubFile(stubSettingsPath, filterExpression); @@ -59,6 +59,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility throw new ArgumentNullException(nameof(provider)); } + // Using Ordinal since this is used internally Expression> filterExpression = (string s) => s.Contains(module, StringComparison.Ordinal); IIOProviderMocks.VerifyIOReadWithStubFile(provider, filterExpression, expectedCallCount); @@ -66,6 +67,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility public static Mock GetGeneralSettingsIOProvider(string version) { + // Using StringComparison.Ordinal / CultureInfo.InvariantCulture since this is used internally for a path var stubGeneralSettingsPath = string.Format(CultureInfo.InvariantCulture, BackCompatTestProperties.RootPathStubFiles, version, string.Empty, "settings.json"); Expression> filterExpression = (string s) => s.Contains("Microsoft\\PowerToys\\settings.json", StringComparison.Ordinal); var mockGeneralIOProvider = IIOProviderMocks.GetMockIOReadWithStubFile(stubGeneralSettingsPath, filterExpression); @@ -78,7 +80,7 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility { throw new ArgumentNullException(nameof(provider)); } - + // Using Ordinal since this is used internally for a path Expression> filterExpression = (string s) => s.Contains("Microsoft\\PowerToys\\settings.json", StringComparison.Ordinal); IIOProviderMocks.VerifyIOReadWithStubFile(provider, filterExpression, expectedCallCount); } diff --git a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs index 9a0b7433ec..ed1fafcb8f 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs @@ -26,11 +26,13 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.Mocks savePath = path; saveContent = content; }); + // Using Ordinal since this is used internally for a path mockIOProvider.Setup(x => x.ReadAllText(It.Is(x => x.Equals(savePath, StringComparison.Ordinal)))) .Returns(() => saveContent); - + // Using Ordinal since this is used internally for a path mockIOProvider.Setup(x => x.FileExists(It.Is(x => x.Equals(savePath, StringComparison.Ordinal)))) .Returns(true); + // Using Ordinal since this is used internally for a path mockIOProvider.Setup(x => x.FileExists(It.Is(x => !x.Equals(savePath, StringComparison.Ordinal)))) .Returns(false); diff --git a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs index 5ebf32f6e0..74b0c5c88c 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs +++ b/src/core/Microsoft.PowerToys.Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs @@ -167,6 +167,7 @@ namespace ViewModelTests var settingUtils = ISettingsUtilsMocks.GetStubSettingsUtils(); var expectedSettingsString = new ImageResizerSettings() { Properties = new ImageResizerProperties() { ImageresizerKeepDateModified = new BoolProperty() { Value = true } } }.ToJsonString(); + // Using Ordinal since this is used internally settingUtils.Setup(x => x.SaveSettings( It.Is(content => content.Equals(expectedSettingsString, StringComparison.Ordinal)), It.Is(module => module.Equals(ImageResizerSettings.ModuleName, StringComparison.Ordinal)), diff --git a/src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs b/src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs index 9472322986..f3aed7884d 100644 --- a/src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs +++ b/src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs @@ -66,6 +66,7 @@ namespace ColorPicker.Helpers saturation = Math.Round(saturation * 100); lightness = Math.Round(lightness * 100); + // Using InvariantCulture since this is used for color representation return $"hsl({hue.ToString(CultureInfo.InvariantCulture)}" + $", {saturation.ToString(CultureInfo.InvariantCulture)}%" + $", {lightness.ToString(CultureInfo.InvariantCulture)}%)"; @@ -84,6 +85,7 @@ namespace ColorPicker.Helpers saturation = Math.Round(saturation * 100); value = Math.Round(value * 100); + // Using InvariantCulture since this is used for color representation return $"hsv({hue.ToString(CultureInfo.InvariantCulture)}" + $", {saturation.ToString(CultureInfo.InvariantCulture)}%" + $", {value.ToString(CultureInfo.InvariantCulture)}%)"; @@ -103,6 +105,7 @@ namespace ColorPicker.Helpers yellow = Math.Round(yellow * 100); blackKey = Math.Round(blackKey * 100); + // Using InvariantCulture since this is used for color representation return $"cmyk({cyan.ToString(CultureInfo.InvariantCulture)}%" + $", {magenta.ToString(CultureInfo.InvariantCulture)}%" + $", {yellow.ToString(CultureInfo.InvariantCulture)}%" diff --git a/src/modules/colorPicker/ColorPickerUI/Helpers/Logger.cs b/src/modules/colorPicker/ColorPickerUI/Helpers/Logger.cs index 7058a8ff51..e34b12ef85 100644 --- a/src/modules/colorPicker/ColorPickerUI/Helpers/Logger.cs +++ b/src/modules/colorPicker/ColorPickerUI/Helpers/Logger.cs @@ -20,7 +20,8 @@ namespace ColorPicker.Helpers Directory.CreateDirectory(ApplicationLogPath); } - var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.CurrentCulture) + ".txt"); + // Using InvariantCulture since this is used for a log file name + var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt"); Trace.Listeners.Add(new TextWriterTraceListener(logFilePath)); diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs index 7b6d389c4c..a6a6cc30b3 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs @@ -157,6 +157,8 @@ namespace FancyZonesEditor sb.AppendLine("## " + CrashReportEnvironmentTag); sb.AppendLine(CrashReportCommandLineTag + Environment.CommandLine); + + // Using InvariantCulture since this is used for a timestamp internally sb.AppendLine(CrashReportTimestampTag + DateTime.Now.ToString(CultureInfo.InvariantCulture)); sb.AppendLine(CrashReportOSVersionTag + Environment.OSVersion.VersionString); sb.AppendLine(CrashReportIntPtrLengthTag + IntPtr.Size); diff --git a/src/modules/imageresizer/tests/Properties/SettingsTests.cs b/src/modules/imageresizer/tests/Properties/SettingsTests.cs index 4856ce0146..67f9be0f4e 100644 --- a/src/modules/imageresizer/tests/Properties/SettingsTests.cs +++ b/src/modules/imageresizer/tests/Properties/SettingsTests.cs @@ -170,6 +170,7 @@ namespace ImageResizer.Properties var result = ((IDataErrorInfo)settings)["JpegQualityLevel"]; + // Using InvariantCulture since this is used internally Assert.Equal( string.Format(CultureInfo.InvariantCulture, Resources.ValueMustBeBetween, 1, 100), result); diff --git a/src/modules/imageresizer/tests/Views/TimeRemainingConverterTests.cs b/src/modules/imageresizer/tests/Views/TimeRemainingConverterTests.cs index 8596892632..189f1ff050 100644 --- a/src/modules/imageresizer/tests/Views/TimeRemainingConverterTests.cs +++ b/src/modules/imageresizer/tests/Views/TimeRemainingConverterTests.cs @@ -28,6 +28,7 @@ namespace ImageResizer.Views var timeRemaining = new TimeSpan(hours, minutes, seconds); var converter = new TimeRemainingConverter(); + // Using InvariantCulture since these are internal var result = converter.Convert( timeRemaining, targetType: null, diff --git a/src/modules/imageresizer/ui/Models/ResizeOperation.cs b/src/modules/imageresizer/ui/Models/ResizeOperation.cs index ca7fc5605c..19ce76f925 100644 --- a/src/modules/imageresizer/ui/Models/ResizeOperation.cs +++ b/src/modules/imageresizer/ui/Models/ResizeOperation.cs @@ -189,6 +189,7 @@ namespace ImageResizer.Models extension = supportedExtensions.FirstOrDefault(); } + // Using CurrentCulture since this is user facing var fileName = string.Format( CultureInfo.CurrentCulture, _settings.FileNameFormat, diff --git a/src/modules/imageresizer/ui/Properties/Settings.cs b/src/modules/imageresizer/ui/Properties/Settings.cs index e2d73a7fe5..fdd1fff0cb 100644 --- a/src/modules/imageresizer/ui/Properties/Settings.cs +++ b/src/modules/imageresizer/ui/Properties/Settings.cs @@ -63,6 +63,7 @@ namespace ImageResizer.Properties public IEnumerable AllSizes { get; set; } + // Using OrdinalIgnoreCase since this is internal and used for comparison with symbols public string FileNameFormat => _fileNameFormat ?? (_fileNameFormat = FileName @@ -111,6 +112,7 @@ namespace ImageResizer.Properties if (JpegQualityLevel < 1 || JpegQualityLevel > 100) { + // Using CurrentCulture since this is user facing return string.Format(CultureInfo.CurrentCulture, Resources.ValueMustBeBetween, 1, 100); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs index c44e991199..30036aa3cf 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs @@ -68,6 +68,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests var engine = new CalculateEngine(); // Act + // Using InvariantCulture since this is internal var result = engine.Interpret(input, CultureInfo.InvariantCulture); // Assert @@ -84,6 +85,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests var engine = new CalculateEngine(); // Act + // Using InvariantCulture since this is internal var result = engine.Interpret(input, CultureInfo.InvariantCulture); // Assert @@ -140,6 +142,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests var engine = new CalculateEngine(); // Act + // Using InvariantCulture since this is internal var result = engine.Interpret(input, CultureInfo.InvariantCulture); // Assert @@ -158,6 +161,7 @@ namespace Microsoft.Plugin.Calculator.UnitTests var engine = new CalculateEngine(); // Act + // Using InvariantCulture since this is internal var result = engine.Interpret(input, CultureInfo.InvariantCulture); // Assert diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs index 51941f29ef..a67f8a72ac 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs @@ -15,6 +15,7 @@ namespace Microsoft.Plugin.Calculator public CalculateResult Interpret(string input) { + // Using CurrentCulture this is user facing return Interpret(input, CultureInfo.CurrentCulture); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs index 3ebbf80540..54f3f49598 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/Main.cs @@ -35,6 +35,7 @@ namespace Microsoft.Plugin.Calculator try { + // Using CurrentUICulture since this is user facing var result = CalculateEngine.Interpret(query.Search, CultureInfo.CurrentUICulture); // This could happen for some incorrect queries, like pi(2) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/ResultHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/ResultHelper.cs index 52b4539e00..6f5ec1489b 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/ResultHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/ResultHelper.cs @@ -27,6 +27,7 @@ namespace Microsoft.Plugin.Calculator return new Result { + // Using CurrentCulture since this is user facing Title = roundedResult?.ToString(CultureInfo.CurrentCulture), IcoPath = iconPath, Score = 300, @@ -45,6 +46,7 @@ namespace Microsoft.Plugin.Calculator { try { + // Using CurrentUICulture since this is user facing Clipboard.SetText(roundedResult?.ToString(CultureInfo.CurrentUICulture.NumberFormat)); ret = true; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/DriveOrSharedFolderTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/DriveOrSharedFolderTests.cs index a7c8cf0028..78ebef1b43 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/DriveOrSharedFolderTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/DriveOrSharedFolderTests.cs @@ -69,8 +69,10 @@ namespace Microsoft.Plugin.Folder.UnitTests { // Setup var folderHelperMock = new Mock(); + + // Using Ordinal since this is used with paths folderHelperMock.Setup(r => r.IsDriveOrSharedFolder(It.IsAny())) - .Returns(s => s.StartsWith("C:", StringComparison.CurrentCultureIgnoreCase)); + .Returns(s => s.StartsWith("C:", StringComparison.Ordinal)); var itemResultMock = new Mock(); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs index 7be5999d69..915246aa0d 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder.UnitTests/InternalQueryFolderTests.cs @@ -73,15 +73,17 @@ namespace Microsoft.Plugin.Folder.UnitTests switch (isRecursive) { case false: - folderSearchFunc = s => s.Equals(search, StringComparison.CurrentCultureIgnoreCase); + // Using Ordinal since this is internal + folderSearchFunc = s => s.Equals(search, StringComparison.Ordinal); var regexSearch = TrimDirectoryEnd(search); fileSearchFunc = s => Regex.IsMatch(s, $"^{Regex.Escape(regexSearch)}[^\\\\]*$"); break; case true: - folderSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase); - fileSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase); + // Using Ordinal since this is internal + folderSearchFunc = s => s.StartsWith(search, StringComparison.Ordinal); + fileSearchFunc = s => s.StartsWith(search, StringComparison.Ordinal); break; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/DriveInformation.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/DriveInformation.cs index 5c0f534f11..12c7c14ab3 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/DriveInformation.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/DriveInformation.cs @@ -17,6 +17,8 @@ namespace Microsoft.Plugin.Folder.Sources private static IEnumerable InitialDriverList() { var directorySeparatorChar = System.IO.Path.DirectorySeparatorChar; + + // Using InvariantCulture since this is internal return DriveInfo.GetDrives() .Select(driver => driver.Name.ToLower(CultureInfo.InvariantCulture).TrimEnd(directorySeparatorChar)); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs index 02bb17505c..41cff7a8ce 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Path/FolderHelper.cs @@ -27,6 +27,7 @@ namespace Microsoft.Plugin.Folder.Sources throw new ArgumentNullException(paramName: nameof(query)); } + // Using OrdinalIgnoreCase since this is internal return _folderLinks.FolderLinks() .Where(x => x.Nickname.StartsWith(query, StringComparison.OrdinalIgnoreCase)); } @@ -38,7 +39,8 @@ namespace Microsoft.Plugin.Folder.Sources throw new ArgumentNullException(nameof(search)); } - if (search.StartsWith(@"\\", StringComparison.InvariantCulture)) + // Using Ordinal this is internal and we're comparing symbols + if (search.StartsWith(@"\\", StringComparison.Ordinal)) { // share folder return true; } @@ -48,6 +50,7 @@ namespace Microsoft.Plugin.Folder.Sources if (driverNames.Any()) { + // Using InvariantCultureIgnoreCase since this is searching for drive names if (driverNames.Any(dn => search.StartsWith(dn, StringComparison.InvariantCultureIgnoreCase))) { // normal drive letter diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs index 2849c68802..2ee70959d4 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/QueryInternalDirectory.cs @@ -60,6 +60,7 @@ namespace Microsoft.Plugin.Folder.Sources } // Remove everything after the last \ and add * + // Using InvariantCulture since this is internal incompleteName = search.Substring(index + 1) .ToLower(CultureInfo.InvariantCulture) + "*"; search = search.Substring(0, index + 1); @@ -71,7 +72,8 @@ namespace Microsoft.Plugin.Folder.Sources else { // folder exist, add \ at the end of doesn't exist - if (!search.EndsWith(@"\", StringComparison.InvariantCulture)) + // Using Ordinal since this is internal and is used for a symbol + if (!search.EndsWith(@"\", StringComparison.Ordinal)) { search += @"\"; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs index 785ce63cca..78c8c5f621 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FileItemResult.cs @@ -24,6 +24,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData) { Title = Title, + + // Using CurrentCulture since this is user facing SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath), IcoPath = FilePath, Action = c => ShellAction.Execute(FilePath, contextApi), diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs index 45ee48ee50..ea094bde33 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/FolderItemResult.cs @@ -37,6 +37,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result { Title = Title, IcoPath = Path, + + // Using CurrentCulture since this is user facing SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle), QueryTextDisplay = Path, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path }, diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs index bbb68cc122..4eff8f40f9 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/Result/TruncatedItemResult.cs @@ -23,6 +23,8 @@ namespace Microsoft.Plugin.Folder.Sources.Result { Title = Properties.Resources.Microsoft_plugin_folder_truncation_warning_title, QueryTextDisplay = Search, + + // Using CurrentCulture since this is user facing SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Microsoft_plugin_folder_truncation_warning_subtitle, PostTruncationCount, PreTruncationCount), IcoPath = WarningIconPath, }; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs index 5e452c2668..d257772254 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/Sources/ShellAction.cs @@ -39,7 +39,8 @@ namespace Microsoft.Plugin.Folder.Sources var sanitizedPath = Regex.Replace(search, @"[\/\\]+", "\\"); // A network path must start with \\ - if (!sanitizedPath.StartsWith("\\", StringComparison.InvariantCulture)) + // Using Ordinal since this is internal and used with a symbol + if (!sanitizedPath.StartsWith("\\", StringComparison.Ordinal)) { return sanitizedPath; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs index 5c63f5a53e..8c8af19af3 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/UserFolderResult.cs @@ -28,6 +28,8 @@ namespace Microsoft.Plugin.Folder { Title = Title, IcoPath = Path, + + // Using CurrentCulture since this is user facing SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_folder_result_subtitle, Subtitle), QueryTextDisplay = Path, ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path }, diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs index 820fc2fc91..f056dc2172 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/ContextMenuLoader.cs @@ -150,6 +150,7 @@ namespace Microsoft.Plugin.Indexer string fileExtension = Path.GetExtension(path); foreach (string extension in appExtensions) { + // Using OrdinalIgnoreCase since this is internal if (extension.Equals(fileExtension, StringComparison.OrdinalIgnoreCase)) { return true; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs index 4b85bb2bb6..34f14dacbc 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs @@ -110,6 +110,8 @@ namespace Microsoft.Plugin.Indexer foreach (var searchResult in searchResultsList) { var path = searchResult.Path; + + // Using CurrentCulture since this is user facing var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0} : {1}", Properties.Resources.Microsoft_plugin_indexer_name, searchResult.Title); var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0} : {1}", Properties.Resources.Microsoft_plugin_indexer_path, path); string workingDir = null; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs index 84b0bdbf1f..a2a4401ac6 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/SearchHelper/WindowsSearchAPI.cs @@ -59,6 +59,7 @@ namespace Microsoft.Plugin.Indexer.SearchHelper } // # is URI syntax for the fragment component, need to be encoded so LocalPath returns complete path + // Using OrdinalIgnoreCase since this is internal and used with symbols var string_path = ((string)oleDBResult.FieldData[0]).Replace("#", "%23", StringComparison.OrdinalIgnoreCase); var uri_path = new Uri(string_path); @@ -89,10 +90,11 @@ namespace Microsoft.Plugin.Indexer.SearchHelper // convert file pattern if it is not '*'. Don't create restriction for '*' as it includes all files. if (pattern != "*") { - pattern = pattern.Replace("*", "%", StringComparison.InvariantCulture); - pattern = pattern.Replace("?", "_", StringComparison.InvariantCulture); + // Using Ordinal since these are internal and used with symbols + pattern = pattern.Replace("*", "%", StringComparison.Ordinal); + pattern = pattern.Replace("?", "_", StringComparison.Ordinal); - if (pattern.Contains("%", StringComparison.InvariantCulture) || pattern.Contains("_", StringComparison.InvariantCulture)) + if (pattern.Contains("%", StringComparison.Ordinal) || pattern.Contains("_", StringComparison.Ordinal)) { queryHelper.QueryWhereRestrictions += " AND System.FileName LIKE '" + pattern + "' "; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/Win32Tests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/Win32Tests.cs index 8aa564119f..1d36a71651 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/Win32Tests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program.UnitTests/Programs/Win32Tests.cs @@ -567,6 +567,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs var result = _cmderRunCommand.Result("cmder", string.Empty, mock.Object); // Assert + // Using Ordinal since this is used internally Assert.IsTrue(result.Title.Equals(_cmderRunCommand.Name, StringComparison.Ordinal)); Assert.IsFalse(result.Title.Equals(_cmderRunCommand.Description, StringComparison.Ordinal)); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/ProgramArgumentParser/DoubleDashProgramArgumentParser.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/ProgramArgumentParser/DoubleDashProgramArgumentParser.cs index d9c3cab952..acefa1ecc9 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/ProgramArgumentParser/DoubleDashProgramArgumentParser.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/ProgramArgumentParser/DoubleDashProgramArgumentParser.cs @@ -23,6 +23,7 @@ namespace Microsoft.Plugin.Program { for (var i = 1; i < query.Terms.Count; i++) { + // Using Ordinal since this is internal and used with a symbol if (!string.Equals(query.Terms[i], DoubleDash, StringComparison.Ordinal)) { continue; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs index 397ecb6a62..ddc8cf7b47 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWP.cs @@ -204,6 +204,7 @@ namespace Microsoft.Plugin.Program.Programs { if (obj is UWP uwp) { + // Using CurrentCultureIgnoreCase since this is used with FamilyName return FamilyName.Equals(uwp.FamilyName, StringComparison.CurrentCultureIgnoreCase); } else @@ -214,6 +215,7 @@ namespace Microsoft.Plugin.Program.Programs public override int GetHashCode() { + // Using CurrentCultureIgnoreCase since this is used with FamilyName return FamilyName.GetHashCode(StringComparison.CurrentCultureIgnoreCase); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs index 9ac90bfc64..b914950102 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs @@ -111,6 +111,7 @@ namespace Microsoft.Plugin.Program.Programs result.Title = DisplayName; result.SetTitleHighlightData(StringMatcher.FuzzySearch(query, Name).MatchData); + // Using CurrentCulture since this is user facing var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_name, result.Title); var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_path, Package.Location); result.ToolTipData = new ToolTipData(toolTipTitle, toolTipText); @@ -263,6 +264,8 @@ namespace Microsoft.Plugin.Program.Programs if (File.Exists(manifest)) { var file = File.ReadAllText(manifest); + + // Using OrdinalIgnoreCase since this is used internally if (file.Contains("TrustLevel=\"mediumIL\"", StringComparison.OrdinalIgnoreCase)) { return true; @@ -276,12 +279,16 @@ namespace Microsoft.Plugin.Program.Programs internal string ResourceFromPri(string packageFullName, string resourceReference) { const string prefix = "ms-resource:"; + + // Using OrdinalIgnoreCase since this is used internally if (!string.IsNullOrWhiteSpace(resourceReference) && resourceReference.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) { // magic comes from @talynone // https://github.com/talynone/Wox.Plugin.WindowsUniversalAppLauncher/blob/master/StoreAppLauncher/Helpers/NativeApiHelper.cs#L139-L153 string key = resourceReference.Substring(prefix.Length); string parsed; + + // Using Ordinal/OrdinalIgnorcase since these are used internally if (key.StartsWith("//", StringComparison.Ordinal)) { parsed = prefix + key; @@ -540,6 +547,8 @@ namespace Microsoft.Plugin.Program.Programs // windows 8 https://msdn.microsoft.com/en-us/library/windows/apps/br211475.aspx string path; bool isLogoUriSet; + + // Using Ordinal since this is used internally with uri if (uri.Contains("\\", StringComparison.Ordinal)) { path = Path.Combine(Package.Location, uri); @@ -598,6 +607,7 @@ namespace Microsoft.Plugin.Program.Programs string currentBackgroundColor; if (BackgroundColor == "transparent") { + // Using InvariantCulture since this is internal currentBackgroundColor = SystemParameters.WindowGlassBrush.ToString(CultureInfo.InvariantCulture); } else diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs index 6c5c49fb55..cd64bbbe45 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/Win32Program.cs @@ -98,6 +98,7 @@ namespace Microsoft.Plugin.Program.Programs // To Filter PWAs when the user searches for the main application // All Chromium based applications contain the --app-id argument // Reference : https://codereview.chromium.org/399045/show + // Using Ordinal IgnoreCase since this is used internally bool isWebApplication = FullPath.Contains(ProxyWebApp, StringComparison.OrdinalIgnoreCase) && Arguments.Contains(AppIdArgument, StringComparison.OrdinalIgnoreCase); return isWebApplication; } @@ -121,6 +122,7 @@ namespace Microsoft.Plugin.Program.Programs // check if any space separated query is a part of the app name or path name foreach (var subquery in subqueries) { + // Using OrdinalIgnoreCase since these are used internally if (FullPath.Contains(subquery, StringComparison.OrdinalIgnoreCase)) { pathContainsQuery = true; @@ -172,6 +174,7 @@ namespace Microsoft.Plugin.Program.Programs { if (query != null && AppType == ApplicationType.RunCommand) { + // Using OrdinalIgnoreCase since this is used internally if (!query.Equals(Name, StringComparison.OrdinalIgnoreCase) && !query.Equals(ExecutableName, StringComparison.OrdinalIgnoreCase)) { return false; @@ -235,6 +238,7 @@ namespace Microsoft.Plugin.Program.Programs result.Title = Name; result.SetTitleHighlightData(StringMatcher.FuzzySearch(query, Name).MatchData); + // Using CurrentCulture since this is user facing var toolTipTitle = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_name, result.Title); var toolTipText = string.Format(CultureInfo.CurrentCulture, "{0}: {1}", Properties.Resources.powertoys_run_plugin_program_file_path, FullPath); result.ToolTipData = new ToolTipData(toolTipTitle, toolTipText); @@ -342,6 +346,8 @@ namespace Microsoft.Plugin.Program.Programs Name = Path.GetFileNameWithoutExtension(path), ExecutableName = Path.GetFileName(path), IcoPath = path, + + // Using CurrentCulture since this is user facing FullPath = path.ToLower(CultureInfo.CurrentCulture), UniqueIdentifier = path, ParentDirectory = Directory.GetParent(path).FullName, @@ -384,6 +390,7 @@ namespace Microsoft.Plugin.Program.Programs foreach (string line in lines) { + // Using OrdinalIgnoreCase since this is used internally if (line.StartsWith(urlPrefix, StringComparison.OrdinalIgnoreCase)) { urlPath = line.Substring(urlPrefix.Length); @@ -407,6 +414,7 @@ namespace Microsoft.Plugin.Program.Programs } } + // Using OrdinalIgnoreCase since this is used internally if (line.StartsWith(iconFilePrefix, StringComparison.OrdinalIgnoreCase)) { iconPath = line.Substring(iconFilePrefix.Length); @@ -465,6 +473,8 @@ namespace Microsoft.Plugin.Program.Programs if (File.Exists(target) || Directory.Exists(target)) { program.LnkResolvedPath = program.FullPath; + + // Using CurrentCulture since this is user facing program.FullPath = Path.GetFullPath(target).ToLower(CultureInfo.CurrentCulture); program.AppType = GetAppTypeFromPath(target); @@ -543,6 +553,7 @@ namespace Microsoft.Plugin.Program.Programs string extension = Extension(path); ApplicationType appType = ApplicationType.GenericFile; + // Using OrdinalIgnoreCase since these are used internally with paths if (ExecutableApplicationExtensions.Contains(extension)) { appType = ApplicationType.Win32Application; @@ -677,6 +688,7 @@ namespace Microsoft.Plugin.Program.Programs private static string Extension(string path) { + // Using CurrentCulture since this is user facing var extension = Path.GetExtension(path)?.ToLower(CultureInfo.CurrentCulture); if (!string.IsNullOrEmpty(extension)) @@ -734,6 +746,7 @@ namespace Microsoft.Plugin.Program.Programs .Distinct() .ToArray(); + // Using OrdinalIgnoreCase since this is used internally with paths var programs1 = allPaths.AsParallel().Where(p => Extension(p).Equals(ShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(LnkProgram); var programs2 = allPaths.AsParallel().Where(p => Extension(p).Equals(ApplicationReferenceExtension, StringComparison.OrdinalIgnoreCase)).Select(CreateWin32Program); var programs3 = allPaths.AsParallel().Where(p => Extension(p).Equals(InternetShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(InternetShortcutProgram); @@ -768,6 +781,7 @@ namespace Microsoft.Plugin.Program.Programs .Distinct() .ToArray(); + // Using OrdinalIgnoreCase since this is used internally with paths var programs1 = paths.AsParallel().Where(p => Extension(p).Equals(ShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(LnkProgram); var programs2 = paths.AsParallel().Where(p => Extension(p).Equals(ApplicationReferenceExtension, StringComparison.OrdinalIgnoreCase)).Select(CreateWin32Program); var programs3 = paths.AsParallel().Where(p => Extension(p).Equals(InternetShortcutExtension, StringComparison.OrdinalIgnoreCase)).Select(InternetShortcutProgram); @@ -908,6 +922,7 @@ namespace Microsoft.Plugin.Program.Programs && !string.IsNullOrEmpty(app1.ExecutableName) && !string.IsNullOrEmpty(app2.ExecutableName) && !string.IsNullOrEmpty(app1.FullPath) && !string.IsNullOrEmpty(app2.FullPath)) { + // Using OrdinalIgnoreCase since this is used internally return app1.Name.Equals(app2.Name, StringComparison.OrdinalIgnoreCase) && app1.ExecutableName.Equals(app2.ExecutableName, StringComparison.OrdinalIgnoreCase) && app1.FullPath.Equals(app2.FullPath, StringComparison.OrdinalIgnoreCase); @@ -924,6 +939,8 @@ namespace Microsoft.Plugin.Program.Programs int fullPathPrime = 31; int result = 1; + + // Using Ordinal since this is used internally result = (result * namePrime) + obj.Name.ToUpperInvariant().GetHashCode(StringComparison.Ordinal); result = (result * executablePrime) + obj.ExecutableName.ToUpperInvariant().GetHashCode(StringComparison.Ordinal); result = (result * fullPathPrime) + obj.FullPath.ToUpperInvariant().GetHashCode(StringComparison.Ordinal); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs index aee59ba3e7..3be898e7b4 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/EventHandler.cs @@ -24,6 +24,7 @@ namespace Microsoft.Plugin.Program.Storage // To obtain the last event associated with a particular app. while (eventHandlingQueue.TryPeek(out string currentAppPath)) { + // Using OrdinalIgnoreCase since this is used internally with paths if (string.IsNullOrEmpty(previousAppPath) || previousAppPath.Equals(currentAppPath, StringComparison.OrdinalIgnoreCase)) { // To dequeue a path only if it is the first one in the queue or if the path was the same as thre previous one (to avoid trying to create apps on duplicate events) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs index 77ec40e3f2..559f766da9 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Storage/Win32ProgramRepository.cs @@ -145,6 +145,7 @@ namespace Microsoft.Plugin.Program.Storage try { // To mitigate the issue of not having a FullPath for a shortcut app, we iterate through the items and find the app with the same hashcode. + // Using OrdinalIgnoreCase since this is used internally if (extension.Equals(LnkExtension, StringComparison.OrdinalIgnoreCase)) { app = GetAppWithSameLnkResolvedPath(path); @@ -174,6 +175,7 @@ namespace Microsoft.Plugin.Program.Storage { foreach (Win32Program app in Items) { + // Using CurrentCultureIgnoreCase since application names could be dependent on currentculture See: https://github.com/microsoft/PowerToys/pull/5847/files#r468245190 if (name.Equals(app.Name, StringComparison.CurrentCultureIgnoreCase) && executableName.Equals(app.ExecutableName, StringComparison.CurrentCultureIgnoreCase)) { return app; @@ -189,7 +191,8 @@ namespace Microsoft.Plugin.Program.Storage { foreach (Programs.Win32Program app in Items) { - if (lnkResolvedPath.ToLower(CultureInfo.CurrentCulture).Equals(app.LnkResolvedPath, StringComparison.CurrentCultureIgnoreCase)) + // Using Invariant / OrdinalIgnoreCase since we're comparing paths + if (lnkResolvedPath.ToUpperInvariant().Equals(app.LnkResolvedPath, StringComparison.OrdinalIgnoreCase)) { return app; } @@ -201,7 +204,9 @@ namespace Microsoft.Plugin.Program.Storage private void OnAppCreated(object sender, FileSystemEventArgs e) { string path = e.FullPath; - if (!Path.GetExtension(path).Equals(UrlExtension, StringComparison.CurrentCultureIgnoreCase) && !Path.GetExtension(path).Equals(LnkExtension, StringComparison.CurrentCultureIgnoreCase)) + + // Using OrdinalIgnoreCase since we're comparing extensions + if (!Path.GetExtension(path).Equals(UrlExtension, StringComparison.OrdinalIgnoreCase) && !Path.GetExtension(path).Equals(LnkExtension, StringComparison.OrdinalIgnoreCase)) { Programs.Win32Program app = Programs.Win32Program.GetAppFromPath(path); if (app != null) @@ -214,7 +219,9 @@ namespace Microsoft.Plugin.Program.Storage private void OnAppChanged(object sender, FileSystemEventArgs e) { string path = e.FullPath; - if (Path.GetExtension(path).Equals(UrlExtension, StringComparison.CurrentCultureIgnoreCase) || Path.GetExtension(path).Equals(LnkExtension, StringComparison.CurrentCultureIgnoreCase)) + + // Using OrdinalIgnoreCase since we're comparing extensions + if (Path.GetExtension(path).Equals(UrlExtension, StringComparison.OrdinalIgnoreCase) || Path.GetExtension(path).Equals(LnkExtension, StringComparison.OrdinalIgnoreCase)) { // When a url or lnk app is installed, multiple created and changed events are triggered. // To prevent the code from acting on the first such event (which may still be during app installation), the events are added a common queue and dequeued by a background task at regular intervals - https://github.com/microsoft/PowerToys/issues/6429. diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs index 844d53c473..99306341c6 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/Main.cs @@ -84,6 +84,7 @@ namespace Microsoft.Plugin.Shell { if (m.Key == cmd) { + // Using CurrentCulture since this is user facing result.SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value); return null; } @@ -91,6 +92,8 @@ namespace Microsoft.Plugin.Shell var ret = new Result { Title = m.Key, + + // Using CurrentCulture since this is user facing SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value), IcoPath = IconPath, Action = c => @@ -128,6 +131,8 @@ namespace Microsoft.Plugin.Shell .Select(m => new Result { Title = m.Key, + + // Using CurrentCulture since this is user facing SubTitle = Properties.Resources.wox_plugin_cmd_plugin_name + ": " + string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_cmd_cmd_has_been_executed_times, m.Value), IcoPath = IconPath, Action = c => diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs index 35262b2011..9434a55985 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/Main.cs @@ -119,6 +119,7 @@ namespace Microsoft.Plugin.Uri ?? _registeryWrapper.GetRegistryValue("HKEY_CLASSES_ROOT\\" + progId + "\\DefaultIcon", null); // "Handles 'Indirect Strings' (UWP programs)" + // Using Ordinal since this is internal and used with a symbol if (programLocation.StartsWith("@", StringComparison.Ordinal)) { var directProgramLocationStringBuilder = new StringBuilder(128); @@ -137,6 +138,7 @@ namespace Microsoft.Plugin.Uri } else { + // Using Ordinal since this is internal and used with a symbol var indexOfComma = programLocation.IndexOf(',', StringComparison.Ordinal); BrowserIconPath = indexOfComma > 0 ? programLocation.Substring(0, indexOfComma) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs index 0d6e202e82..bb3b263336 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri/UriHelper/ExtendedUriParser.cs @@ -18,9 +18,10 @@ namespace Microsoft.Plugin.Uri.UriHelper } // Handle common cases UriBuilder does not handle - if (input.EndsWith(":", StringComparison.Ordinal) - || input.EndsWith(".", StringComparison.Ordinal) - || input.EndsWith(":/", StringComparison.Ordinal)) + // Using CurrentCulture since this is a user typed string + if (input.EndsWith(":", StringComparison.CurrentCulture) + || input.EndsWith(".", StringComparison.CurrentCulture) + || input.EndsWith(":/", StringComparison.CurrentCulture)) { result = default; return false; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs index 98b495ba88..d43fb479a2 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/FuzzyMatching.cs @@ -37,6 +37,7 @@ namespace Microsoft.Plugin.WindowWalker.Components throw new ArgumentNullException(nameof(text)); } + // Using CurrentCulture since this is user facing searchText = searchText.ToLower(CultureInfo.CurrentCulture); text = text.ToLower(CultureInfo.CurrentCulture); diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/NativeMethods.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/NativeMethods.cs index cd8be63ff3..b0a6e4355b 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/NativeMethods.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/NativeMethods.cs @@ -563,6 +563,7 @@ namespace Microsoft.Plugin.WindowWalker.Components public override string ToString() { + // Using CurrentCulture since this is user facing return string.Format(System.Globalization.CultureInfo.CurrentCulture, "{{Left={0},Top={1},Right={2},Bottom={3}}}", Left, Top, Right, Bottom); } } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs index 089fdbba95..16c6cc237c 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/SearchController.cs @@ -54,6 +54,7 @@ namespace Microsoft.Plugin.WindowWalker.Components set { + // Using CurrentCulture since this is user facing searchText = value.ToLower(CultureInfo.CurrentCulture).Trim(); } } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs index 39cdf29e03..7e28b738fc 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs @@ -252,6 +252,7 @@ namespace Microsoft.Plugin.WindowWalker.Components // 1) There is a weird flashing behavior when trying // to use ShowWindow for switching tabs in IE // 2) SetForegroundWindow fails on minimized windows + // Using Ordinal since this is internal if (ProcessName.ToUpperInvariant().Equals("IEXPLORE.EXE", StringComparison.Ordinal) || !Minimized) { NativeMethods.SetForegroundWindow(Hwnd); @@ -270,6 +271,7 @@ namespace Microsoft.Plugin.WindowWalker.Components /// The title of the window public override string ToString() { + // Using CurrentCulture since this is user facing return Title + " (" + ProcessName.ToUpper(CultureInfo.CurrentCulture) + ")"; } diff --git a/src/modules/launcher/PowerLauncher/Helper/DataWebRequestFactory.cs b/src/modules/launcher/PowerLauncher/Helper/DataWebRequestFactory.cs index a9c3e92e9e..a627803742 100644 --- a/src/modules/launcher/PowerLauncher/Helper/DataWebRequestFactory.cs +++ b/src/modules/launcher/PowerLauncher/Helper/DataWebRequestFactory.cs @@ -34,7 +34,8 @@ namespace PowerLauncher.Helper { string uriString = uri.AbsoluteUri; - int commaIndex = uriString.IndexOf(',', StringComparison.InvariantCultureIgnoreCase); + // Using Ordinal since this is internal and used with a symbol + int commaIndex = uriString.IndexOf(',', StringComparison.Ordinal); var headers = uriString.Substring(0, commaIndex).Split(';'); _contentType = headers[0]; string dataString = uriString.Substring(commaIndex + 1); diff --git a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs index 2bf082b252..c65076e047 100644 --- a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs @@ -44,7 +44,9 @@ namespace PowerLauncher StringBuilder content = new StringBuilder(); content.AppendLine(ErrorReporting.RuntimeInfo()); - content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); + + // Using CurrentCulture since this is displayed to user in the report window + content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.CurrentCulture)}"); content.AppendLine("Exception:"); content.AppendLine(exception.ToString()); var paragraph = new Paragraph(); diff --git a/src/modules/launcher/PowerLauncher/SettingsWatcher.cs b/src/modules/launcher/PowerLauncher/SettingsWatcher.cs index d3e223dfcd..af41aea249 100644 --- a/src/modules/launcher/PowerLauncher/SettingsWatcher.cs +++ b/src/modules/launcher/PowerLauncher/SettingsWatcher.cs @@ -92,6 +92,7 @@ namespace PowerLauncher _settings.IgnoreHotkeysOnFullscreen = overloadSettings.Properties.IgnoreHotkeysInFullscreen; } + // Using OrdinalIgnoreCase since this is internal var indexer = PluginManager.AllPlugins.Find(p => p.Metadata.Name.Equals("Windows Indexer", StringComparison.OrdinalIgnoreCase)); if (indexer != null) { diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index 94745f6e9e..c845b9d716 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -132,6 +132,7 @@ namespace PowerLauncher.ViewModel if (index != null) { + // Using InvariantCulture since this is internal results.SelectedIndex = int.Parse(index.ToString(), CultureInfo.InvariantCulture); } @@ -438,8 +439,9 @@ namespace PowerLauncher.ViewModel private void QueryHistory() { + // Using CurrentCulture since query is received from user and used in downstream comparisons using CurrentCulture #pragma warning disable CA1308 // Normalize strings to uppercase - var query = QueryText.ToLower(CultureInfo.InvariantCulture).Trim(); + var query = QueryText.ToLower(CultureInfo.CurrentCulture).Trim(); #pragma warning restore CA1308 // Normalize strings to uppercase History.Clear(); @@ -528,6 +530,7 @@ namespace PowerLauncher.ViewModel lock (_addResultsLock) { + // Using CurrentCultureIgnoreCase since this is user facing if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase)) { Results.Clear(); @@ -565,6 +568,7 @@ namespace PowerLauncher.ViewModel { lock (_addResultsLock) { + // Using CurrentCultureIgnoreCase since this is user facing if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase)) { currentCancellationToken.ThrowIfCancellationRequested(); @@ -630,6 +634,7 @@ namespace PowerLauncher.ViewModel { Application.Current.Dispatcher.BeginInvoke(new Action(() => { + // Using CurrentCultureIgnoreCase since this is user facing if (queryText.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase)) { Results.Results.NotifyChanges(); @@ -818,6 +823,7 @@ namespace PowerLauncher.ViewModel } } + // Using CurrentCultureIgnoreCase since this is user facing if (originQuery.Equals(_currentQuery, StringComparison.CurrentCultureIgnoreCase)) { ct.ThrowIfCancellationRequested(); @@ -879,6 +885,7 @@ namespace PowerLauncher.ViewModel } else { + // Using Ordinal this is internal return string.IsNullOrEmpty(queryText) || autoCompleteText.IndexOf(queryText, StringComparison.Ordinal) != 0; } } @@ -889,6 +896,7 @@ namespace PowerLauncher.ViewModel { if (index == 0) { + // Using OrdinalIgnoreCase because we want the characters to be exact in autocomplete text and the query if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0) { // Use the same case as the input query for the matched portion of the string @@ -906,6 +914,7 @@ namespace PowerLauncher.ViewModel { if (index == 0 && !string.IsNullOrEmpty(query)) { + // Using OrdinalIgnoreCase since this is internal if (input.IndexOf(query, StringComparison.OrdinalIgnoreCase) == 0) { return query + input.Substring(query.Length); diff --git a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs index 29c819045a..85302cd4b6 100644 --- a/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs +++ b/src/modules/launcher/Wox.Infrastructure/Exception/ExceptionFormatter.cs @@ -70,6 +70,8 @@ namespace Wox.Infrastructure.Exception sb.AppendLine("## Environment"); sb.AppendLine($"* Command Line: {Environment.CommandLine}"); + + // Using InvariantCulture since this is internal sb.AppendLine($"* Timestamp: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); sb.AppendLine($"* Wox version: {Constant.Version}"); sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}"); diff --git a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs index 018cafc805..e1b2f22dd7 100644 --- a/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs +++ b/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs @@ -131,6 +131,7 @@ namespace Wox.Infrastructure.Image return new ImageResult(ImageCache[path], ImageType.Cache); } + // Using OrdinalIgnoreCase since this is internal and used with paths if (path.StartsWith("data:", StringComparison.OrdinalIgnoreCase)) { var imageSource = new BitmapImage(new Uri(path)); diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs index 6a1bdc0f34..a6c122db34 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage`1.cs @@ -106,8 +106,8 @@ namespace Wox.Infrastructure.Storage private void BackupOriginFile() { - // Using CurrentCulture since this is user facing - var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.CurrentCulture); + // Using InvariantCulture since this is internal + var timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fffffff", CultureInfo.InvariantCulture); var directory = Path.GetDirectoryName(FilePath).NonNull(); var originName = Path.GetFileNameWithoutExtension(FilePath); var backupName = $"{originName}-{timestamp}{FileSuffix}"; diff --git a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs index 0e39c31779..3519950725 100644 --- a/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs +++ b/src/modules/launcher/Wox.Infrastructure/StringMatcher.cs @@ -249,6 +249,7 @@ namespace Wox.Infrastructure } } + // Using CurrentCultureIgnoreCase since this relates to queries input by user if (string.Equals(query, stringToCompare, StringComparison.CurrentCultureIgnoreCase)) { var bonusForExactMatch = 10; diff --git a/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs b/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs index 8d9a2b5155..b9ca054e78 100644 --- a/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs +++ b/src/modules/launcher/Wox.Test/Plugins/WindowsIndexerTest.cs @@ -380,6 +380,8 @@ namespace Wox.Test.Plugins // Assert string expectedSqlQuery = "SELECT TOP 30 \"System.ItemUrl\", \"System.FileName\", \"System.FileAttributes\" FROM \"SystemIndex\" WHERE (CONTAINS(System.FileName,'\"abcd.*\"',1033)) AND scope='file:' ORDER BY System.DateModified DESC"; + + // Using InvariantCultureIgnoreCase since this relates to sql code in string form Assert.IsFalse(simplifiedSqlQuery.Equals(sqlQuery, StringComparison.InvariantCultureIgnoreCase)); Assert.IsTrue(simplifiedSqlQuery.Equals(expectedSqlQuery, StringComparison.InvariantCultureIgnoreCase)); } @@ -394,6 +396,7 @@ namespace Wox.Test.Plugins var simplifiedSqlQuery = WindowsSearchAPI.SimplifyQuery(sqlQuery); // Assert + // Using InvariantCultureIgnoreCase since this relates to sql code in string form Assert.IsTrue(simplifiedSqlQuery.Equals(sqlQuery, StringComparison.InvariantCultureIgnoreCase)); } @@ -408,6 +411,8 @@ namespace Wox.Test.Plugins // Assert string expectedSqlQuery = "SELECT TOP 30 \"System.ItemUrl\", \"System.FileName\", \"System.FileAttributes\", \"System.FileExtension\" FROM \"SystemIndex\" WHERE (CONTAINS(System.FileName,'\"ab.*\"',1033)) AND (CONTAINS(System.FileName,'\".cd*\"',1033)) AND scope='file:' ORDER BY System.DateModified DESC"; + + // Using InvariantCultureIgnoreCase since this relates to sql code in string form Assert.IsFalse(simplifiedSqlQuery.Equals(sqlQuery, StringComparison.InvariantCultureIgnoreCase)); Assert.IsTrue(simplifiedSqlQuery.Equals(expectedSqlQuery, StringComparison.InvariantCultureIgnoreCase)); } @@ -423,6 +428,8 @@ namespace Wox.Test.Plugins // Assert string expectedSqlQuery = "SELECT TOP 30 \"System.ItemUrl\", \"System.FileName\", \"System.FileAttributes\" FROM \"SystemIndex\" WHERE (CONTAINS(System.FileName,'\"'ab.cd'*\"',1033)) AND scope='file:' ORDER BY System.DateModified DESC"; + + // Using InvariantCultureIgnoreCase since this relates to sql code in string form Assert.IsFalse(simplifiedSqlQuery.Equals(sqlQuery, StringComparison.InvariantCultureIgnoreCase)); Assert.IsTrue(simplifiedSqlQuery.Equals(expectedSqlQuery, StringComparison.InvariantCultureIgnoreCase)); } diff --git a/src/modules/previewpane/SvgPreviewHandler/Utilities/SvgPreviewHandlerHelper.cs b/src/modules/previewpane/SvgPreviewHandler/Utilities/SvgPreviewHandlerHelper.cs index 4ac672ebb7..c5af5df681 100644 --- a/src/modules/previewpane/SvgPreviewHandler/Utilities/SvgPreviewHandlerHelper.cs +++ b/src/modules/previewpane/SvgPreviewHandler/Utilities/SvgPreviewHandlerHelper.cs @@ -47,7 +47,10 @@ namespace Microsoft.PowerToys.PreviewHandler.Svg.Utilities var elements = doc.Descendants().ToList(); foreach (XElement element in elements) { - var elementName = element?.Name?.LocalName?.ToLower(CultureInfo.CurrentCulture); + // Using Invariant since we are doing an exact match for HTML tags and we want it to behave the same in every culture +#pragma warning disable CA1308 // Normalize strings to uppercase + var elementName = element?.Name?.LocalName?.ToLowerInvariant(); +#pragma warning restore CA1308 // Normalize strings to uppercase if (elementName != null && blockedElementsName.ContainsKey(elementName)) { foundBlockedElement = true; diff --git a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.cs b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.cs index 52f52aa00c..f59275321c 100644 --- a/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.cs +++ b/src/modules/previewpane/SvgThumbnailProvider/SvgThumbnailProvider.cs @@ -166,7 +166,9 @@ namespace Microsoft.PowerToys.ThumbnailHandler.Svg {0} "; - return string.Format(CultureInfo.CurrentCulture, html, svg); + + // Using InvariantCulture since this should be displayed as it is + return string.Format(CultureInfo.InvariantCulture, html, svg); } /// diff --git a/src/modules/previewpane/common/controls/WebBrowserExt.cs b/src/modules/previewpane/common/controls/WebBrowserExt.cs index 5dcd44772a..05a3a3bff4 100644 --- a/src/modules/previewpane/common/controls/WebBrowserExt.cs +++ b/src/modules/previewpane/common/controls/WebBrowserExt.cs @@ -54,6 +54,7 @@ namespace PreviewHandlerCommon if (name != null && name.Equals(DISPIDAMBIENTDLCONTROL, StringComparison.CurrentCulture)) { + // Using InvariantCulture since this is used for web browser configurations result = Convert.ToInt32( WebBrowserDownloadControlFlags.DLIMAGES | WebBrowserDownloadControlFlags.PRAGMA_NO_CACHE | @@ -66,7 +67,7 @@ namespace PreviewHandlerCommon WebBrowserDownloadControlFlags.NO_DLACTIVEXCTLS | WebBrowserDownloadControlFlags.NO_RUNACTIVEXCTLS | WebBrowserDownloadControlFlags.NO_BEHAVIORS | - WebBrowserDownloadControlFlags.SILENT, CultureInfo.CurrentCulture); + WebBrowserDownloadControlFlags.SILENT, CultureInfo.InvariantCulture); } else { From 462d64ab7ab9fcab4d4c8b396ddee73137952971 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Fri, 30 Oct 2020 16:52:00 -0700 Subject: [PATCH 05/20] Changed title and started adding in additional comments. --- .../Strings/en-us/Resources.resw | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 3440beb373..ef8e8d65e4 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -373,10 +373,12 @@ Give feedback - Module overview + Learn more + This label is there to point people to additional overview for how to use the product Attribution + giving credit to the projects this utility was based on About PowerToys @@ -392,12 +394,15 @@ Report a bug + Report an issue inside powertoys Request a feature + Tell our team what we should build Restart as administrator + running PowerToys as a higher level user, account is typically referred to as an admin / adminsitrator Run at startup @@ -407,9 +412,11 @@ Shell integration + This refers to directly integrating in with Windows Enable PowerRename + do not loc the Product name Settings theme From ce0f0322af22eb3aaa87528a20a0e9d40c079d15 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Fri, 30 Oct 2020 16:54:27 -0700 Subject: [PATCH 06/20] adding in comment for do not loc product names --- .../Strings/en-us/Resources.resw | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index ef8e8d65e4..9f8879ca2e 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -163,7 +163,10 @@ Enable Keyboard Manager - Keyboard Manager enable toggle header + + Keyboard Manager enable toggle header + do not loc the Product name. Do you want this feature on / off + Select the profile to display the active key remap and shortcuts @@ -214,6 +217,7 @@ Enable Color Picker + do not loc the Product name. Do you want this feature on / off Change cursor when picking a color @@ -229,6 +233,7 @@ Enable PowerToys Run + do not loc the Product name. Do you want this feature on / off Search & results @@ -311,6 +316,7 @@ Enable FancyZones + do not loc the Product name. Do you want this feature on / off Excluded apps @@ -416,7 +422,7 @@ Enable PowerRename - do not loc the Product name + do not loc the Product name. Do you want this feature on / off Settings theme @@ -435,12 +441,15 @@ Enable Markdown (.md) preview + Do not loc "Markdown". Do you want this feature on / off Enable SVG (.svg) preview + Do you want this feature on / off Enable SVG (.svg) thumbnails + Do you want this feature on / off These settings allow you to manage your Windows File Explorer custom preview handlers. @@ -471,6 +480,7 @@ Enable Shortcut Guide + do not loc the Product name. Do you want this feature on / off Opacity of background @@ -483,6 +493,7 @@ Enable Image Resizer + do not loc the Product name. Do you want this feature on / off Image Size From 62c9184658086c94db71aaca37a376fc16aff3b2 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Sat, 31 Oct 2020 01:15:52 -0700 Subject: [PATCH 07/20] Update Resources.resw --- .../Strings/en-us/Resources.resw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw index 9f8879ca2e..83c908a3ee 100644 --- a/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw +++ b/src/core/Microsoft.PowerToys.Settings.UI/Strings/en-us/Resources.resw @@ -408,7 +408,7 @@ Restart as administrator - running PowerToys as a higher level user, account is typically referred to as an admin / adminsitrator + running PowerToys as a higher level user, account is typically referred to as an admin / administrator Run at startup @@ -786,4 +786,4 @@ Windows color settings Windows refers to the Operating system - \ No newline at end of file + From 7ff8b97006376e8ed8984c930fc8ac2ff85e1b41 Mon Sep 17 00:00:00 2001 From: Mehmet Murat Akburak Date: Sat, 31 Oct 2020 11:25:16 +0300 Subject: [PATCH 08/20] [PowerRename] Split "status message" / "items count label" into two lines (#7696) * Split status message * Use spaces instead of tabs --- .../powerrename/ui/PowerRenameUI.base.rc | Bin 6974 -> 7142 bytes src/modules/powerrename/ui/PowerRenameUI.cpp | 35 +++++++++++----- src/modules/powerrename/ui/PowerRenameUI.h | 3 +- src/modules/powerrename/ui/Resources.resx | 12 ++++-- src/modules/powerrename/ui/resource.base.h | 39 +++++++++--------- 5 files changed, 55 insertions(+), 34 deletions(-) diff --git a/src/modules/powerrename/ui/PowerRenameUI.base.rc b/src/modules/powerrename/ui/PowerRenameUI.base.rc index 1338197c5cc8bd24f804300a5f00ec61dc28f577..0369a50812c9f847a0a865c97684a5e412a2c4f7 100644 GIT binary patch delta 122 zcmdmI_RM^Pl(>03LokCYgAWipGlT$17X}>$1qMSP1kuI}MnDV^F=jA_vlJ#D77I6w dX9xo7@MCaf@MZ7>((Y(_jnVaPHWcS&0RX^?5s?4@ delta 36 ncmaE6zRzrfl(@JKgCP*=Fc>o!F_;2rLm(m_itemsPositioning.listPreviewWidthDiff * scale); height = mainWindowHeight - static_cast(m_itemsPositioning.listPreviewHeightDiff * scale); break; - case IDC_STATUS_MESSAGE: - y = mainWindowHeight - static_cast(m_itemsPositioning.statusMessageYDiff * scale); + case IDC_STATUS_MESSAGE_SELECTED: + y = mainWindowHeight - static_cast(m_itemsPositioning.statusMessageSelectedYDiff * scale); + break; + case IDC_STATUS_MESSAGE_RENAMING: + y = mainWindowHeight - static_cast(m_itemsPositioning.statusMessageRenamingYDiff * scale); break; case ID_RENAME: x = mainWindowWidth - static_cast(m_itemsPositioning.renameButtonXDiff * scale); @@ -1000,12 +1005,17 @@ void CPowerRenameUI::_UpdateCounts() m_renamingCount = renamingCount; // Update selected and rename count label - wchar_t countsLabelFormat[100] = { 0 }; - LoadString(g_hInst, IDS_COUNTSLABELFMT, countsLabelFormat, ARRAYSIZE(countsLabelFormat)); + wchar_t countsLabelFormatSelected[100] = { 0 }; + wchar_t countsLabelFormatRenaming[100] = { 0 }; + LoadString(g_hInst, IDS_COUNTSLABELSELECTEDFMT, countsLabelFormatSelected, ARRAYSIZE(countsLabelFormatSelected)); + LoadString(g_hInst, IDS_COUNTSLABELRENAMINGFMT, countsLabelFormatRenaming, ARRAYSIZE(countsLabelFormatRenaming)); - wchar_t countsLabel[100] = { 0 }; - StringCchPrintf(countsLabel, ARRAYSIZE(countsLabel), countsLabelFormat, selectedCount, renamingCount); - SetDlgItemText(m_hwnd, IDC_STATUS_MESSAGE, countsLabel); + wchar_t countsLabelSelected[100] = { 0 }; + wchar_t countsLabelRenaming[100] = { 0 }; + StringCchPrintf(countsLabelSelected, ARRAYSIZE(countsLabelSelected), countsLabelFormatSelected, selectedCount); + StringCchPrintf(countsLabelRenaming, ARRAYSIZE(countsLabelRenaming), countsLabelFormatRenaming, renamingCount); + SetDlgItemText(m_hwnd, IDC_STATUS_MESSAGE_SELECTED, countsLabelSelected); + SetDlgItemText(m_hwnd, IDC_STATUS_MESSAGE_RENAMING, countsLabelRenaming); // Update Rename button state EnableWindow(GetDlgItem(m_hwnd, ID_RENAME), (renamingCount > 0)); @@ -1039,8 +1049,11 @@ void CPowerRenameUI::_CollectItemPosition(_In_ DWORD id) m_itemsPositioning.listPreviewWidthDiff = m_initialWidth - itemWidth; m_itemsPositioning.listPreviewHeightDiff = m_initialHeight - itemHeight; break; - case IDC_STATUS_MESSAGE: - m_itemsPositioning.statusMessageYDiff = m_initialHeight - rcWindow.top; + case IDC_STATUS_MESSAGE_SELECTED: + m_itemsPositioning.statusMessageSelectedYDiff = m_initialHeight - rcWindow.top; + break; + case IDC_STATUS_MESSAGE_RENAMING: + m_itemsPositioning.statusMessageRenamingYDiff = m_initialHeight - rcWindow.top; break; case ID_RENAME: m_itemsPositioning.renameButtonXDiff = m_initialWidth - rcWindow.left; diff --git a/src/modules/powerrename/ui/PowerRenameUI.h b/src/modules/powerrename/ui/PowerRenameUI.h index 35b79e0923..c0ef499156 100644 --- a/src/modules/powerrename/ui/PowerRenameUI.h +++ b/src/modules/powerrename/ui/PowerRenameUI.h @@ -83,7 +83,8 @@ private: int searchReplaceWidthDiff; int listPreviewWidthDiff; int listPreviewHeightDiff; - int statusMessageYDiff; + int statusMessageSelectedYDiff; + int statusMessageRenamingYDiff; int renameButtonXDiff; int renameButtonYDiff; int helpButtonXDiff; diff --git a/src/modules/powerrename/ui/Resources.resx b/src/modules/powerrename/ui/Resources.resx index c278b9c056..4da3576bbd 100644 --- a/src/modules/powerrename/ui/Resources.resx +++ b/src/modules/powerrename/ui/Resources.resx @@ -133,8 +133,11 @@ Please select from the options above to show items. Item Name and Extension - - Items Selected: %u | Renaming: %u + + Items Selected: %u + + + Items Renaming: %u Use Regular Expressions @@ -188,7 +191,10 @@ Please select from the options above to show items. Replace with: - Items Selected: 0 | Renaming: 0 + Items Selected: 0 + + + Items Renaming: 0 Options diff --git a/src/modules/powerrename/ui/resource.base.h b/src/modules/powerrename/ui/resource.base.h index 34b94ea1d9..a79a44208c 100644 --- a/src/modules/powerrename/ui/resource.base.h +++ b/src/modules/powerrename/ui/resource.base.h @@ -10,24 +10,25 @@ #define IDC_EDIT_REPLACEWITH 3003 #define IDC_LIST_PREVIEW 3004 #define IDC_CHECK_USEREGEX 3005 -#define IDC_STATUS_MESSAGE 3006 -#define IDC_CHECK_EXCLUDESUBFOLDERS 3007 -#define IDC_CHECK_ENUMITEMS 3008 -#define IDC_CHECK_EXCLUDEFILES 3009 -#define IDC_CHECK_CASESENSITIVE 3010 -#define IDC_CHECK_MATCHALLOCCURENCES 3011 -#define IDC_CHECK_EXCLUDEFOLDERS 3012 -#define IDC_CHECK_NAMEONLY 3013 -#define IDC_CHECK_EXTENSIONONLY 3014 -#define IDC_PREVIEWGROUP 3015 -#define IDC_OPTIONSGROUP 3016 -#define IDC_SEARCHREPLACEGROUP 3017 -#define IDC_TRANSFORM_UPPERCASE 3018 -#define IDC_TRANSFORM_LOWERCASE 3019 -#define IDC_TRANSFORM_TITLECASE 3020 -#define IDC_SEARCH_FOR 3021 -#define IDC_REPLACE_WITH 3022 +#define IDC_STATUS_MESSAGE_SELECTED 3006 +#define IDC_STATUS_MESSAGE_RENAMING 3007 +#define IDC_CHECK_EXCLUDESUBFOLDERS 3008 +#define IDC_CHECK_ENUMITEMS 3009 +#define IDC_CHECK_EXCLUDEFILES 3010 +#define IDC_CHECK_CASESENSITIVE 3011 +#define IDC_CHECK_MATCHALLOCCURENCES 3012 +#define IDC_CHECK_EXCLUDEFOLDERS 3013 +#define IDC_CHECK_NAMEONLY 3014 +#define IDC_CHECK_EXTENSIONONLY 3015 +#define IDC_PREVIEWGROUP 3016 +#define IDC_OPTIONSGROUP 3017 +#define IDC_SEARCHREPLACEGROUP 3018 +#define IDC_TRANSFORM_UPPERCASE 3019 +#define IDC_TRANSFORM_LOWERCASE 3020 +#define IDC_TRANSFORM_TITLECASE 3021 +#define IDC_SEARCH_FOR 3022 +#define IDC_REPLACE_WITH 3023 #define IDC_STATIC -1 -#define IDR_MAINFRAME 3023 -#define IDD_MAIN 3024 +#define IDR_MAINFRAME 3024 +#define IDD_MAIN 3025 #define IDI_RENAME 2001 From 44af8f30f8d6698092609df394869efc86a53d06 Mon Sep 17 00:00:00 2001 From: punker76 Date: Thu, 29 Oct 2020 21:31:32 +0100 Subject: [PATCH 09/20] [PowerLauncher] Remove MahApps dependency and add own LibraryThemeProvider --- installer/PowerToysSetup/Product.wxs | 2 +- src/modules/launcher/PowerLauncher/App.xaml | 3 +++ .../launcher/PowerLauncher/Themes/Dark.xaml | 2 -- .../PowerLauncher/Themes/HighContrast1.xaml | 2 -- .../PowerLauncher/Themes/HighContrast2.xaml | 2 -- .../Themes/HighContrastBlack.xaml | 2 -- .../Themes/HighContrastWhite.xaml | 2 -- .../launcher/PowerLauncher/Themes/Light.xaml | 2 -- .../Wox.Plugin/CustomLibraryThemeProvider.cs | 24 +++++++++++++++++++ .../launcher/Wox.Plugin/ThemeManager.cs | 13 +++++----- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 1 - 11 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 src/modules/launcher/Wox.Plugin/CustomLibraryThemeProvider.cs diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index fa36e6b81a..74307b7181 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -883,7 +883,7 @@ - + diff --git a/src/modules/launcher/PowerLauncher/App.xaml b/src/modules/launcher/PowerLauncher/App.xaml index 31222632df..2e322001f8 100644 --- a/src/modules/launcher/PowerLauncher/App.xaml +++ b/src/modules/launcher/PowerLauncher/App.xaml @@ -1,10 +1,13 @@  + + diff --git a/src/modules/launcher/PowerLauncher/Themes/Dark.xaml b/src/modules/launcher/PowerLauncher/Themes/Dark.xaml index 04ce193d61..9aac73fcae 100644 --- a/src/modules/launcher/PowerLauncher/Themes/Dark.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/Dark.xaml @@ -1,7 +1,5 @@  + public override void FillColorSchemeValues(Dictionary values, RuntimeThemeColorValues colorValues) + { + } + } +} diff --git a/src/modules/launcher/Wox.Plugin/ThemeManager.cs b/src/modules/launcher/Wox.Plugin/ThemeManager.cs index 55b3cdcc06..e83a43c0f5 100644 --- a/src/modules/launcher/Wox.Plugin/ThemeManager.cs +++ b/src/modules/launcher/Wox.Plugin/ThemeManager.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using System.Windows; -using MahApps.Metro.Theming; using ManagedCommon; using Microsoft.Win32; @@ -40,27 +39,27 @@ namespace Wox.Plugin ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( highContrastOneThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( highContrastTwoThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( highContrastBlackThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( highContrastWhiteThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( lightThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new ControlzEx.Theming.LibraryTheme( darkThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ResetTheme(); ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll; diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index 8d9c037483..8aa96202ea 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -67,7 +67,6 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - all From f89b98e7c799cdaf80751e2e7ee6da2c0a237cb5 Mon Sep 17 00:00:00 2001 From: punker76 Date: Fri, 30 Oct 2020 11:54:50 +0100 Subject: [PATCH 10/20] [PowerLauncher] Fix getting theme changed event --- src/modules/launcher/Wox.Plugin/ThemeManager.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/launcher/Wox.Plugin/ThemeManager.cs b/src/modules/launcher/Wox.Plugin/ThemeManager.cs index e83a43c0f5..3118a17c3f 100644 --- a/src/modules/launcher/Wox.Plugin/ThemeManager.cs +++ b/src/modules/launcher/Wox.Plugin/ThemeManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation +// 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. @@ -61,9 +61,14 @@ namespace Wox.Plugin darkThemeUri, CustomLibraryThemeProvider.DefaultInstance)); - ResetTheme(); - ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll; ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged; + + // Currently we don't need to sync all, because the accent is not used + // If we want to sync all and use runtime generated themes, + // then it's necessary to have a "GeneratorParameters.json" and "Theme.Template.xaml". + ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncWithAppMode; + + ControlzEx.Theming.ThemeManager.Current.SyncTheme(); } public Theme GetCurrentTheme() From fa1448163a3f055ad4682f4710bd0d9cc4391168 Mon Sep 17 00:00:00 2001 From: punker76 Date: Sat, 31 Oct 2020 11:58:31 +0100 Subject: [PATCH 11/20] [PowerLauncher] Fix getting theme changed event for and between HighContrast setting --- .../launcher/PowerLauncher/Themes/Dark.xaml | 3 +- .../PowerLauncher/Themes/HighContrast1.xaml | 3 +- .../PowerLauncher/Themes/HighContrast2.xaml | 3 +- .../Themes/HighContrastBlack.xaml | 3 +- .../Themes/HighContrastWhite.xaml | 3 +- .../launcher/PowerLauncher/Themes/Light.xaml | 3 +- .../LibraryThemes/GeneratorParameters.json | 111 ++++++++++++++++++ .../LibraryThemes/Theme.Template.xaml | 50 ++++++++ .../launcher/Wox.Plugin/ThemeManager.cs | 25 ++-- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 9 ++ 10 files changed, 198 insertions(+), 15 deletions(-) create mode 100644 src/modules/launcher/Wox.Plugin/LibraryThemes/GeneratorParameters.json create mode 100644 src/modules/launcher/Wox.Plugin/LibraryThemes/Theme.Template.xaml diff --git a/src/modules/launcher/PowerLauncher/Themes/Dark.xaml b/src/modules/launcher/PowerLauncher/Themes/Dark.xaml index 9aac73fcae..797fd0536f 100644 --- a/src/modules/launcher/PowerLauncher/Themes/Dark.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/Dark.xaml @@ -12,6 +12,7 @@ Dark Accent1 Black + False #FF818181 @@ -35,7 +36,7 @@ #FF1b1b1b - #FFcdcdcd + #FFcdcdcd #FF171717 diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml index f32bc2aedd..884915cf18 100644 --- a/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/HighContrast1.xaml @@ -12,6 +12,7 @@ HighContrast Accent2 White + True #ffff00 @@ -35,7 +36,7 @@ #FF000000 - #FFFFFFFF + #FFFFFFFF #FFFFFFFF diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml index 3c4e2d6332..c9c8e63841 100644 --- a/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/HighContrast2.xaml @@ -12,6 +12,7 @@ HighContrast Accent3 White + True #ffff00 @@ -35,7 +36,7 @@ #FF000000 - #FFFFFFFF + #FFFFFFFF #FFFFFFFF diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml index e0be43816b..c43db5ee5b 100644 --- a/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/HighContrastBlack.xaml @@ -12,6 +12,7 @@ HighContrast Accent4 White + True #66FFFFFF @@ -35,7 +36,7 @@ #FF000000 - #FFFFFFFF + #FFFFFFFF #FFFFFFFF diff --git a/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml b/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml index 957ccc6aaa..aad036fddd 100644 --- a/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/HighContrastWhite.xaml @@ -12,6 +12,7 @@ HighContrast Accent5 White + True #66000000 @@ -35,7 +36,7 @@ #FFf0f0f0 - #FF000000 + #FF000000 #FF000000 diff --git a/src/modules/launcher/PowerLauncher/Themes/Light.xaml b/src/modules/launcher/PowerLauncher/Themes/Light.xaml index ef546f61dc..fb4bc5cdbf 100644 --- a/src/modules/launcher/PowerLauncher/Themes/Light.xaml +++ b/src/modules/launcher/PowerLauncher/Themes/Light.xaml @@ -12,6 +12,7 @@ Light Accent1 White + False #66000000 @@ -35,7 +36,7 @@ #FFf0f0f0 - #FF1d1d1d + #FF1d1d1d #FFf3f3f3 diff --git a/src/modules/launcher/Wox.Plugin/LibraryThemes/GeneratorParameters.json b/src/modules/launcher/Wox.Plugin/LibraryThemes/GeneratorParameters.json new file mode 100644 index 0000000000..3cc5ec4f3a --- /dev/null +++ b/src/modules/launcher/Wox.Plugin/LibraryThemes/GeneratorParameters.json @@ -0,0 +1,111 @@ +{ + "DefaultValues": { + "Theme.IsHighContrast": "false" + }, + "BaseColorSchemes": [ + { + "Name": "Dark", + "Values": { + "PrimaryAccentColor": "Black", + "SystemBaseMediumLowColor": "#FF818181", + "SystemChromeLow": "#FF171717", + "TextControlPlaceholderForeground": "#FF818181", + "TextBox.Static.Border": "Transparent", + "TextBox.MouseOver.Border": "Transparent", + "TextBox.Focus.Border": "Transparent", + "ButtonBackgroundPointerOver": "#30FFFFFF", + "ButtonBorderPointerOver": "#61FFFFFF", + "ButtonBackgroundPressed": "#30FFFFFF", + "ButtonBorderPressed": "#61FFFFFF", + "ListViewItemBackgroundPointerOver": "#FF363636", + "ControlTextBrushKey": "White", + "SecondaryTextForeground": "#FFa1a1a1", + "InactiveSelectionHighlightBrushKey": "White", + "DialogBorderBrush": "#FF373737", + "ScrollBarThumbBackground": "#FF7a7a7a", + "ScrollBarThumbPointerOver": "#FF767676", + "ScrollBarThumbPointerPressed": "#FFa4a4a4", + "ScrollBarBackgroundPointerOver": "#FF1b1b1b", + "ScrollBarLineButtonForeground": "#FFcdcdcd", + "ScrollBarLineButtonForegroundPointerOver": "#FFcdcdcd", + "ScrollBarLineButtonForegroundPointerPressed": "#FF171717", + "ScrollBarLineButtonBackground": "Transparent", + "ScrollBarLineButtonBackgroundPointerOver": "#FF313131", + "ScrollBarLineButtonBackgroundPointerPressed": "#FFa4a4a4", + "ToolTipBorderBrushKey": "#5B000000", + "ToolTipForegroundBrushKey": "#FFFFFFFF", + "ToolTipBackgroundBrushKey": "#FF2B2B2B" + } + }, + { + "Name": "Light", + "Values": { + "PrimaryAccentColor": "White", + "SystemBaseMediumLowColor": "#66000000", + "SystemChromeLow": "#FFF2F2F2", + "TextControlPlaceholderForeground": "#FF5b5b5b", + "TextBox.Static.Border": "Transparent", + "TextBox.MouseOver.Border": "Transparent", + "TextBox.Focus.Border": "Transparent", + "ButtonBackgroundPointerOver": "#2E000000", + "ButtonBorderPointerOver": "#61000000", + "ButtonBackgroundPressed": "#30000000", + "ButtonBorderPressed": "#61000000", + "ListViewItemBackgroundPointerOver": "#FFd2d2d2", + "ControlTextBrushKey": "Black", + "SecondaryTextForeground": "#FF434343", + "InactiveSelectionHighlightBrushKey": "Black", + "DialogBorderBrush": "#FFf7f7f7", + "ScrollBarThumbBackground": "#FF7a7a7a", + "ScrollBarThumbPointerOver": "#FFa0a0a0", + "ScrollBarThumbPointerPressed": "#FF747474", + "ScrollBarBackgroundPointerOver": "#FFf0f0f0", + "ScrollBarLineButtonForeground": "#FF1d1d1d", + "ScrollBarLineButtonForegroundPointerOver": "#FF1d1d1d", + "ScrollBarLineButtonForegroundPointerPressed": "#FFf3f3f3", + "ScrollBarLineButtonBackground": "Transparent", + "ScrollBarLineButtonBackgroundPointerOver": "#FFd2d2d2", + "ScrollBarLineButtonBackgroundPointerPressed": "#FF5d5d5d", + "ToolTipBorderBrushKey": "#FFD0D0D0", + "ToolTipForegroundBrushKey": "#FF000000", + "ToolTipBackgroundBrushKey": "#FFFBFBFB" + } + }, + { + "Name": "HighContrast", + "Values": { + "Theme.IsHighContrast": "true", + "PrimaryAccentColor": "White", + "SystemBaseMediumLowColor": "#ffff00", + "SystemChromeLow": "Black", + "TextControlPlaceholderForeground": "#FF008000", + "TextBox.Static.Border": "Transparent", + "TextBox.MouseOver.Border": "Transparent", + "TextBox.Focus.Border": "Transparent", + "ButtonBackgroundPointerOver": "Black", + "ButtonBorderPointerOver": "White", + "ButtonBackgroundPressed": "White", + "ButtonBorderPressed": "White", + "ListViewItemBackgroundPointerOver": "#FF003300", + "ControlTextBrushKey": "#FFffff00", + "SecondaryTextForeground": "#FF008000", + "InactiveSelectionHighlightBrushKey": "#FFFFFFFF", + "DialogBorderBrush": "#FF373737", + "ScrollBarThumbBackground": "White", + "ScrollBarThumbPointerOver": "#FF008000", + "ScrollBarThumbPointerPressed": "#FF008000", + "ScrollBarBackgroundPointerOver": "#FF000000", + "ScrollBarLineButtonForeground": "#FFFFFFFF", + "ScrollBarLineButtonForegroundPointerOver": "#FFFFFFFF", + "ScrollBarLineButtonForegroundPointerPressed": "#FFFFFFFF", + "ScrollBarLineButtonBackground": "Black", + "ScrollBarLineButtonBackgroundPointerOver": "#FF000000", + "ScrollBarLineButtonBackgroundPointerPressed": "#FF000000", + "ToolTipBorderBrushKey": "#5B000000", + "ToolTipForegroundBrushKey": "#FFFFFFFF", + "ToolTipBackgroundBrushKey": "#FF2B2B2B" + } + } + ], + "ColorSchemes": [] +} \ No newline at end of file diff --git a/src/modules/launcher/Wox.Plugin/LibraryThemes/Theme.Template.xaml b/src/modules/launcher/Wox.Plugin/LibraryThemes/Theme.Template.xaml new file mode 100644 index 0000000000..e0600b3378 --- /dev/null +++ b/src/modules/launcher/Wox.Plugin/LibraryThemes/Theme.Template.xaml @@ -0,0 +1,50 @@ + + + + {{ThemeName}} + PowerToysRun + {{ThemeDisplayName}} + {{BaseColorScheme}} + {{ColorScheme}} + {{PrimaryAccentColor}} + {{IsHighContrast}} + + {{SystemBaseMediumLowColor}} + + + + + + + + + + + + + + + + + {{ScrollBarThumbPointerOver}} + {{ScrollBarThumbPointerPressed}} + + {{ScrollBarBackgroundPointerOver}} + + + {{ScrollBarLineButtonForegroundPointerOver}} + {{ScrollBarLineButtonForegroundPointerPressed}} + + + {{ScrollBarLineButtonBackgroundPointerOver}} + {{ScrollBarLineButtonBackgroundPointerPressed}} + + + + + \ No newline at end of file diff --git a/src/modules/launcher/Wox.Plugin/ThemeManager.cs b/src/modules/launcher/Wox.Plugin/ThemeManager.cs index 3118a17c3f..a8c19bba7c 100644 --- a/src/modules/launcher/Wox.Plugin/ThemeManager.cs +++ b/src/modules/launcher/Wox.Plugin/ThemeManager.cs @@ -63,10 +63,9 @@ namespace Wox.Plugin ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged; - // Currently we don't need to sync all, because the accent is not used - // If we want to sync all and use runtime generated themes, - // then it's necessary to have a "GeneratorParameters.json" and "Theme.Template.xaml". - ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncWithAppMode; + // Currently there is an issue in ControlzEx, so we must use SyncAll to sync also HighContrast themes. + // We can change this after using next release. + ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll; ControlzEx.Theming.ThemeManager.Current.SyncTheme(); } @@ -123,22 +122,22 @@ namespace Wox.Plugin else if (theme == Theme.HighContrastOne) { currentTheme = Theme.HighContrastOne; - ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme); + ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme, true); } else if (theme == Theme.HighContrastTwo) { currentTheme = Theme.HighContrastTwo; - ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme); + ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme, true); } else if (theme == Theme.HighContrastWhite) { currentTheme = Theme.HighContrastWhite; - ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme); + ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme, true); } else if (theme == Theme.HighContrastBlack) { currentTheme = Theme.HighContrastBlack; - ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme); + ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme, true); } else if (theme == Theme.Light) { @@ -161,7 +160,15 @@ namespace Wox.Plugin private void Current_ThemeChanged(object sender, ControlzEx.Theming.ThemeChangedEventArgs e) { - ResetTheme(); + ControlzEx.Theming.ThemeManager.Current.ThemeChanged -= Current_ThemeChanged; + try + { + ResetTheme(); + } + finally + { + ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged; + } } protected virtual void Dispose(bool disposing) diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index 8aa96202ea..b92c794657 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -49,6 +49,15 @@ true + + $(DefaultItemExcludes);**/*.Template.xaml + + + + + + + From 954b483e4fd285749f3a6e45fd2416ce44fdf67f Mon Sep 17 00:00:00 2001 From: csigs Date: Sat, 31 Oct 2020 11:05:39 +0000 Subject: [PATCH 12/20] LEGO: check in for master to temporary branch. --- .../Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/nl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/nl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl index 5847f1a8de..9c47d5f84f 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/nl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/loc/nl/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Properties/Resources.resx.lcl @@ -39,10 +39,13 @@ - + - + + + + From 4e0120493e90bc865148f4f22d4987e66723d51a Mon Sep 17 00:00:00 2001 From: csigs Date: Sat, 31 Oct 2020 23:05:28 +0000 Subject: [PATCH 13/20] LEGO: check in for master to temporary branch. --- .../modules/fancyzones/lib/Resources.resx.lcl | 43 ++++++++++--------- .../Properties/Resources.resx.lcl | 9 ++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/modules/fancyzones/lib/loc/cs/src/modules/fancyzones/lib/Resources.resx.lcl b/src/modules/fancyzones/lib/loc/cs/src/modules/fancyzones/lib/Resources.resx.lcl index 73e8e4d943..bd290686ec 100644 --- a/src/modules/fancyzones/lib/loc/cs/src/modules/fancyzones/lib/Resources.resx.lcl +++ b/src/modules/fancyzones/lib/loc/cs/src/modules/fancyzones/lib/Resources.resx.lcl @@ -37,7 +37,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -73,7 +73,7 @@ - + @@ -91,7 +91,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -109,7 +109,7 @@ - + @@ -118,7 +118,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -172,7 +172,7 @@ - + @@ -190,7 +190,7 @@ - + @@ -219,10 +219,13 @@ - + + + + @@ -244,7 +247,7 @@ - + @@ -253,7 +256,7 @@ - + @@ -271,7 +274,7 @@ - + @@ -289,7 +292,7 @@ - + @@ -316,7 +319,7 @@ - + @@ -334,7 +337,7 @@ - + diff --git a/src/modules/launcher/PowerLauncher/loc/cs/src/modules/launcher/PowerLauncher/Properties/Resources.resx.lcl b/src/modules/launcher/PowerLauncher/loc/cs/src/modules/launcher/PowerLauncher/Properties/Resources.resx.lcl index decc7d3432..2fe00b7e59 100644 --- a/src/modules/launcher/PowerLauncher/loc/cs/src/modules/launcher/PowerLauncher/Properties/Resources.resx.lcl +++ b/src/modules/launcher/PowerLauncher/loc/cs/src/modules/launcher/PowerLauncher/Properties/Resources.resx.lcl @@ -120,10 +120,13 @@ - + + + + @@ -154,7 +157,7 @@ - + @@ -163,7 +166,7 @@ - + From 5629e8068b025da1c3acc7ce96de2e7d2e720102 Mon Sep 17 00:00:00 2001 From: yuyoyuppe Date: Thu, 10 Sep 2020 21:09:04 +0300 Subject: [PATCH 14/20] make build script less noisy --- tools/build/convert-resx-to-rc.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/convert-resx-to-rc.ps1 b/tools/build/convert-resx-to-rc.ps1 index 6a6fab526b..748e6c1731 100644 --- a/tools/build/convert-resx-to-rc.ps1 +++ b/tools/build/convert-resx-to-rc.ps1 @@ -177,7 +177,7 @@ try { Set-Content -Path $generatedFilesFolder\$generatedHeaderFileName -Value $headerFileContent } else { - echo "Skipping write to generated header file" + # echo "Skipping write to generated header file" } } catch { @@ -191,7 +191,7 @@ try { Set-Content -Path $generatedFilesFolder\$generatedRCFileName -Value $rcFileContent -Encoding unicode } else { - echo "Skipping write to generated rc file" + # echo "Skipping write to generated rc file" } } catch { From f33b3c771aa407ad248e5f83077af44a544bdfda Mon Sep 17 00:00:00 2001 From: yuyoyuppe Date: Thu, 22 Oct 2020 19:02:59 +0300 Subject: [PATCH 15/20] common project localization: move out all updating strings - finish localizing boostrapper/runner/action_runner --- .../bootstrapper/Resources.resx | 90 ++++++++++++++++ .../bootstrapper/bootstrapper.cpp | 43 +++----- src/action_runner/Resources.resx | 63 +++++++++++ src/action_runner/action_runner.cpp | 8 +- src/common/common.cpp | 12 +-- src/common/common.h | 8 +- src/common/notifications.cpp | 10 +- src/common/notifications.h | 3 +- src/common/updating/notifications.cpp | 102 ++++++++---------- src/common/updating/notifications.h | 68 ++++++++++-- src/common/updating/updating.cpp | 43 ++++---- src/common/updating/updating.h | 11 +- src/runner/LocProject.json | 4 +- src/runner/Resources.resx | 82 +++++++++++++- src/runner/general_settings.cpp | 13 +-- src/runner/main.cpp | 33 +++--- src/runner/settings_window.cpp | 2 +- src/runner/update_utils.cpp | 13 ++- 18 files changed, 427 insertions(+), 181 deletions(-) diff --git a/installer/PowerToysBootstrapper/bootstrapper/Resources.resx b/installer/PowerToysBootstrapper/bootstrapper/Resources.resx index d1ca376f1a..e80ed5a84a 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/Resources.resx +++ b/installer/PowerToysBootstrapper/bootstrapper/Resources.resx @@ -64,4 +64,94 @@ PowerToys installation error + + An update to PowerToys is available. + + + PowerToys download started. + + + An update to PowerToys is ready to install. + + + Error: couldn't download PowerToys installer. Visit our GitHub page to update. + + + Update now + + + At next launch + + + Error: please uninstall the previous version of PowerToys manually. + + + An update to PowerToys is available. Visit our GitHub page to update. + + + PowerToys is up to date. + + + Visit + + + More info... + + + Abort + + + Click Snooze to be reminded in: + + + 1 day + + + 5 days + + + Downloading... + + + Download complete + + + PowerToys Update + + + We've detected a previous installation of PowerToys. Would you like to remove it? + + + PowerToys: uninstall previous version? + + + Couldn't extract MSI installer! + + + Extracting PowerToys MSI... + + + Uninstalling previous PowerToys version... + + + Couldn't uninstall previous PowerToys version! + + + Installing dotnet... + + + Couldn't install dotnet! + + + Installing new PowerToys version... + + + PowerToys installation complete! + + + Couldn't install new PowerToys version. + + + Snooze + \ No newline at end of file diff --git a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp index 2ab0c29cd5..85774cc741 100644 --- a/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp +++ b/installer/PowerToysBootstrapper/bootstrapper/bootstrapper.cpp @@ -14,11 +14,14 @@ extern "C" IMAGE_DOS_HEADER __ImageBase; +auto Strings = updating::notifications::strings::create(); + #define STR_HELPER(x) #x #define STR(x) STR_HELPER(x) -namespace +namespace // Strings in this namespace should not be localized { const wchar_t APPLICATION_ID[] = L"PowerToysInstaller"; + const wchar_t INSTALLATION_TOAST_TITLE[] = L"PowerToys Installation"; const wchar_t TOAST_TAG[] = L"PowerToysInstallerProgress"; const char LOG_FILENAME[] = "powertoys-bootstrapper-" STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_REVISION) ".log"; const char MSI_LOG_FILENAME[] = "powertoys-bootstrapper-msi-" STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_REVISION) ".log"; @@ -27,20 +30,6 @@ namespace #undef STR #undef STR_HELPER -namespace localized_strings -{ - const wchar_t INSTALLER_EXTRACT_ERROR[] = L"Couldn't extract MSI installer!"; - const wchar_t TOAST_TITLE[] = L"PowerToys Installation"; - const wchar_t EXTRACTING_INSTALLER[] = L"Extracting PowerToys MSI..."; - const wchar_t UNINSTALLING_PREVIOUS_VERSION[] = L"Uninstalling previous PowerToys version..."; - const wchar_t UNINSTALL_PREVIOUS_VERSION_ERROR[] = L"Couldn't uninstall previous PowerToys version!"; - const wchar_t INSTALLING_DOTNET[] = L"Installing dotnet..."; - const wchar_t DOTNET_INSTALL_ERROR[] = L"Couldn't install dotnet!"; - const wchar_t INSTALLING_NEW_VERSION[] = L"Installing new PowerToys version..."; - const wchar_t NEW_VERSION_INSTALLATION_DONE[] = L"PowerToys installation complete!"; - const wchar_t NEW_VERSION_INSTALLATION_ERROR[] = L"Couldn't install new PowerToys version."; -} - namespace fs = std::filesystem; std::optional extractEmbeddedInstaller() @@ -96,7 +85,6 @@ void setup_log(fs::path directory, const spdlog::level::level_enum severity) int bootstrapper() { - using namespace localized_strings; winrt::init_apartment(); cxxopts::Options options{ "PowerToysBootstrapper" }; // clang-format off @@ -252,7 +240,7 @@ int bootstrapper() iconPath = std::move(*extractedIcon); } spdlog::debug("Registering app id for toast notifications"); - notifications::register_application_id(TOAST_TITLE, iconPath.c_str()); + notifications::register_application_id(INSTALLATION_TOAST_TITLE, iconPath.c_str()); auto removeShortcut = wil::scope_exit([&] { notifications::unregister_application_id(); @@ -274,12 +262,12 @@ int bootstrapper() std::mutex progressLock; notifications::progress_bar_params progressParams; progressParams.progress = 0.0f; - progressParams.progress_title = EXTRACTING_INSTALLER; + progressParams.progress_title = GET_RESOURCE_STRING(IDS_EXTRACTING_INSTALLER); notifications::toast_params params{ TOAST_TAG, false, std::move(progressParams) }; if (!silent) { spdlog::debug("Launching progress toast notification"); - notifications::show_toast_with_activations({}, TOAST_TITLE, {}, {}, std::move(params)); + notifications::show_toast_with_activations({}, INSTALLATION_TOAST_TITLE, {}, {}, std::move(params)); } auto processToasts = wil::scope_exit([&] { @@ -322,7 +310,7 @@ int bootstrapper() { if (!silent) { - notifications::show_toast(INSTALLER_EXTRACT_ERROR, TOAST_TITLE); + notifications::show_toast(GET_RESOURCE_STRING(IDS_INSTALLER_EXTRACT_ERROR), INSTALLATION_TOAST_TITLE); } spdlog::error("Couldn't install the MSI installer ({})", GetLastError()); return 1; @@ -332,7 +320,7 @@ int bootstrapper() fs::remove(*installerPath, _); }); - updateProgressBar(.25f, UNINSTALLING_PREVIOUS_VERSION); + updateProgressBar(.25f, GET_RESOURCE_STRING(IDS_UNINSTALLING_PREVIOUS_VERSION).c_str()); spdlog::debug("Acquiring existing MSI package path"); const auto package_path = updating::get_msi_package_path(); if (!package_path.empty()) @@ -343,15 +331,15 @@ int bootstrapper() { spdlog::debug("Existing MSI package path not found"); } - if (!package_path.empty() && !updating::uninstall_msi_version(package_path) && !silent) + if (!package_path.empty() && !updating::uninstall_msi_version(package_path, Strings) && !silent) { spdlog::error("Couldn't install the existing MSI package ({})", GetLastError()); - notifications::show_toast(UNINSTALL_PREVIOUS_VERSION_ERROR, TOAST_TITLE); + notifications::show_toast(GET_RESOURCE_STRING(IDS_UNINSTALL_PREVIOUS_VERSION_ERROR), INSTALLATION_TOAST_TITLE); } const bool installDotnet = !skipDotnetInstall; if (installDotnet) { - updateProgressBar(.5f, INSTALLING_DOTNET); + updateProgressBar(.5f, GET_RESOURCE_STRING(IDS_INSTALLING_DOTNET).c_str()); } try @@ -365,7 +353,7 @@ int bootstrapper() !updating::install_dotnet(silent) && !silent) { - notifications::show_toast(DOTNET_INSTALL_ERROR, TOAST_TITLE); + notifications::show_toast(GET_RESOURCE_STRING(IDS_DOTNET_INSTALL_ERROR), INSTALLATION_TOAST_TITLE); } } } @@ -375,13 +363,14 @@ int bootstrapper() MessageBoxW(nullptr, L".NET Core installation", L"Unknown exception encountered!", MB_OK | MB_ICONERROR); } - updateProgressBar(.75f, INSTALLING_NEW_VERSION); + updateProgressBar(.75f, GET_RESOURCE_STRING(IDS_INSTALLING_NEW_VERSION).c_str()); // Always skip dotnet install, because we should've installed it from here earlier std::wstring msiProps = L"SKIPDOTNETINSTALL=1 "; spdlog::debug("Launching MSI installation for new package {}", installerPath->string()); const bool installationDone = MsiInstallProductW(installerPath->c_str(), msiProps.c_str()) == ERROR_SUCCESS; - updateProgressBar(1.f, installationDone ? NEW_VERSION_INSTALLATION_DONE : NEW_VERSION_INSTALLATION_ERROR); + updateProgressBar(1.f, + installationDone ? GET_RESOURCE_STRING(IDS_NEW_VERSION_INSTALLATION_DONE).c_str() : GET_RESOURCE_STRING(IDS_NEW_VERSION_INSTALLATION_ERROR).c_str()); if (!installationDone) { spdlog::error("Couldn't install new MSI package ({})", GetLastError()); diff --git a/src/action_runner/Resources.resx b/src/action_runner/Resources.resx index d1ca376f1a..1b90cd3d36 100644 --- a/src/action_runner/Resources.resx +++ b/src/action_runner/Resources.resx @@ -64,4 +64,67 @@ PowerToys installation error + + An update to PowerToys is available. + + + PowerToys download started. + + + An update to PowerToys is ready to install. + + + Error: couldn't download PowerToys installer. Visit our GitHub page to update. + + + Update now + + + At next launch + + + Error: please uninstall the previous version of PowerToys manually. + + + An update to PowerToys is available. Visit our GitHub page to update. + + + PowerToys is up to date. + + + Visit + + + More info... + + + Abort + + + Click Snooze to be reminded in: + + + 1 day + + + 5 days + + + Downloading... + + + Download complete + + + PowerToys Update + + + We've detected a previous installation of PowerToys. Would you like to remove it? + + + PowerToys: uninstall previous version? + + + Snooze + \ No newline at end of file diff --git a/src/action_runner/action_runner.cpp b/src/action_runner/action_runner.cpp index acabf8d767..321be922b2 100644 --- a/src/action_runner/action_runner.cpp +++ b/src/action_runner/action_runner.cpp @@ -1,4 +1,6 @@ #define WIN32_LEAN_AND_MEAN +#include "Generated Files/resource.h" + #include #include @@ -16,10 +18,10 @@ #include "../runner/tray_icon.h" #include "../runner/action_runner_utils.h" -#include "Generated Files/resource.h" - extern "C" IMAGE_DOS_HEADER __ImageBase; +auto Strings = updating::notifications::strings::create(); + int uninstall_msi_action() { const auto package_path = updating::get_msi_package_path(); @@ -27,7 +29,7 @@ int uninstall_msi_action() { return 0; } - if (!updating::uninstall_msi_version(package_path)) + if (!updating::uninstall_msi_version(package_path, Strings)) { return -1; } diff --git a/src/common/common.cpp b/src/common/common.cpp index 8d9d251e72..2c7d3e919d 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -85,22 +85,22 @@ std::optional get_last_error_message(const DWORD dw) return message; } -void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle) +void show_last_error_message(LPCWSTR functionName, DWORD dw, LPCWSTR errorTitle) { const auto system_message = get_last_error_message(dw); if (!system_message.has_value()) { return; } - LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(lpszFunction) + 40) * sizeof(WCHAR)); + LPWSTR lpDisplayBuf = (LPWSTR)LocalAlloc(LMEM_ZEROINIT, (system_message->size() + lstrlenW(functionName) + 40) * sizeof(WCHAR)); if (lpDisplayBuf != NULL) { StringCchPrintfW(lpDisplayBuf, LocalSize(lpDisplayBuf) / sizeof(WCHAR), - localized_strings::LAST_ERROR_FORMAT_STRING, - lpszFunction, - dw, - system_message->c_str()); + L"%s: %s (%d)", + functionName, + system_message->c_str(), + dw); MessageBoxW(NULL, (LPCTSTR)lpDisplayBuf, errorTitle, MB_OK | MB_ICONERROR); LocalFree(lpDisplayBuf); } diff --git a/src/common/common.h b/src/common/common.h index e826702a7b..ed3db9e0a4 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -7,12 +7,6 @@ #include -namespace localized_strings -{ - const wchar_t LAST_ERROR_FORMAT_STRING[] = L"%s failed with error %d: %s"; - const wchar_t LAST_ERROR_TITLE_STRING[] = L"Error"; -} - // Gets position of given window. std::optional get_window_pos(HWND hwnd); @@ -23,7 +17,7 @@ bool is_system_window(HWND hwnd, const char* class_name); int run_message_loop(const bool until_idle = false, const std::optional timeout_seconds = {}); std::optional get_last_error_message(const DWORD dw); -void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle = localized_strings::LAST_ERROR_TITLE_STRING); +void show_last_error_message(LPCWSTR lpszFunction, DWORD dw, LPCWSTR errorTitle); enum WindowState { diff --git a/src/common/notifications.cpp b/src/common/notifications.cpp index f87064b4cd..bb48d76feb 100644 --- a/src/common/notifications.cpp +++ b/src/common/notifications.cpp @@ -33,8 +33,7 @@ using winrt::Windows::UI::Notifications::ToastNotificationManager; namespace fs = std::filesystem; -// This namespace contains strings that SHOULD NOT be localized -namespace +namespace // Strings in this namespace should not be localized { constexpr std::wstring_view TASK_NAME = L"PowerToysBackgroundNotificationsHandler"; constexpr std::wstring_view TASK_ENTRYPOINT = L"PowerToysNotifications.BackgroundHandler"; @@ -45,11 +44,6 @@ namespace constexpr std::wstring_view DEFAULT_TOAST_GROUP = L"PowerToysToastTag"; } -namespace localized_strings -{ - constexpr std::wstring_view SNOOZE_BUTTON = L"Snooze"; -} - static DWORD loop_thread_id() { static const DWORD thread_id = GetCurrentThreadId(); @@ -365,7 +359,7 @@ void notifications::show_toast_with_activations(std::wstring message, toast_xml += '"'; } toast_xml += LR"( content=")"; - toast_xml += localized_strings::SNOOZE_BUTTON; + toast_xml += b.snooze_button_title; toast_xml += LR"(" />)"; } }, actions[i]); diff --git a/src/common/notifications.h b/src/common/notifications.h index ac52539b4f..01a0a986e0 100644 --- a/src/common/notifications.h +++ b/src/common/notifications.h @@ -28,6 +28,7 @@ namespace notifications { std::wstring snooze_title; std::vector durations; + std::wstring snooze_button_title; }; struct link_button @@ -45,7 +46,7 @@ namespace notifications struct progress_bar_params { - std::wstring_view progress_title; + std::wstring progress_title; float progress = 0.f; }; diff --git a/src/common/updating/notifications.cpp b/src/common/updating/notifications.cpp index 8984df265f..01e523e657 100644 --- a/src/common/updating/notifications.cpp +++ b/src/common/updating/notifications.cpp @@ -9,39 +9,10 @@ #include "VersionHelper.h" #include "version.h" -namespace -{ - const wchar_t TOAST_TITLE[] = L"PowerToys Update"; -} - -namespace localized_strings -{ - const wchar_t GITHUB_NEW_VERSION_AVAILABLE[] = L"An update to PowerToys is available.\n"; - const wchar_t GITHUB_NEW_VERSION_DOWNLOAD_STARTED[] = L"PowerToys download started.\n"; - const wchar_t GITHUB_NEW_VERSION_READY_TO_INSTALL[] = L"An update to PowerToys is ready to install.\n"; - const wchar_t GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR[] = L"Error: couldn't download PowerToys installer. Visit our GitHub page to update.\n"; - const wchar_t GITHUB_NEW_VERSION_UPDATE_NOW[] = L"Update now"; - const wchar_t GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART[] = L"At next launch"; - - const wchar_t UNINSTALLATION_UNKNOWN_ERROR[] = L"Error: please uninstall the previous version of PowerToys manually."; - - const wchar_t GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT[] = L"An update to PowerToys is available. Visit our GitHub page to update.\n"; - const wchar_t GITHUB_NEW_VERSION_UNAVAILABLE[] = L"PowerToys is up to date.\n"; - const wchar_t GITHUB_NEW_VERSION_VISIT[] = L"Visit"; - const wchar_t GITHUB_NEW_VERSION_MORE_INFO[] = L"More info..."; - const wchar_t GITHUB_NEW_VERSION_ABORT[] = L"Abort"; - const wchar_t GITHUB_NEW_VERSION_SNOOZE_TITLE[] = L"Click Snooze to be reminded in:"; - const wchar_t GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D[] = L"1 day"; - const wchar_t GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D[] = L"5 days"; - const wchar_t DOWNLOAD_IN_PROGRESS[] = L"Downloading..."; - const wchar_t DOWNLOAD_COMPLETE[] = L"Download complete"; -} - namespace updating { namespace notifications { - using namespace localized_strings; using namespace ::notifications; std::wstring current_version_to_next_version(const updating::new_version_download_info& info) { @@ -51,108 +22,123 @@ namespace updating return current_version_to_next_version; } - void show_unavailable() + void show_unavailable(const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false }; - std::wstring contents = GITHUB_NEW_VERSION_UNAVAILABLE; - show_toast(std::move(contents), TOAST_TITLE, std::move(toast_params)); + std::wstring contents = strings.GITHUB_NEW_VERSION_UNAVAILABLE; + show_toast(std::move(contents), strings.TOAST_TITLE, std::move(toast_params)); } - void show_available(const updating::new_version_download_info& info) + void show_available(const updating::new_version_download_info& info, const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false }; - std::wstring contents = GITHUB_NEW_VERSION_AVAILABLE; + std::wstring contents = strings.GITHUB_NEW_VERSION_AVAILABLE; + contents += L'\n'; contents += current_version_to_next_version(info); show_toast_with_activations(std::move(contents), - TOAST_TITLE, + strings.TOAST_TITLE, {}, - { link_button{ GITHUB_NEW_VERSION_UPDATE_NOW, L"powertoys://download_and_install_update/" }, link_button{ GITHUB_NEW_VERSION_MORE_INFO, info.release_page_uri.ToString().c_str() } }, + { link_button{ strings.GITHUB_NEW_VERSION_UPDATE_NOW, + L"powertoys://download_and_install_update/" }, + link_button{ strings.GITHUB_NEW_VERSION_MORE_INFO, + info.release_page_uri.ToString().c_str() } }, std::move(toast_params)); } - void show_download_start(const updating::new_version_download_info& info) + void show_download_start(const updating::new_version_download_info& info, const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); progress_bar_params progress_bar_params; std::wstring progress_title{ info.version_string }; progress_title += L' '; - progress_title += localized_strings::DOWNLOAD_IN_PROGRESS; + progress_title += strings.DOWNLOAD_IN_PROGRESS; progress_bar_params.progress_title = progress_title; progress_bar_params.progress = .0f; toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false, std::move(progress_bar_params) }; - show_toast_with_activations(localized_strings::GITHUB_NEW_VERSION_DOWNLOAD_STARTED, - TOAST_TITLE, + show_toast_with_activations(strings.GITHUB_NEW_VERSION_DOWNLOAD_STARTED, + strings.TOAST_TITLE, {}, {}, std::move(toast_params)); } - void show_visit_github(const updating::new_version_download_info& info) + void show_visit_github(const updating::new_version_download_info& info, const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false }; - std::wstring contents = GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT; + std::wstring contents = strings.GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT; + contents += L'\n'; contents += current_version_to_next_version(info); show_toast_with_activations(std::move(contents), - TOAST_TITLE, + strings.TOAST_TITLE, {}, - { link_button{ GITHUB_NEW_VERSION_VISIT, info.release_page_uri.ToString().c_str() } }, + { link_button{ strings.GITHUB_NEW_VERSION_VISIT, + info.release_page_uri.ToString().c_str() } }, std::move(toast_params)); } - void show_install_error(const updating::new_version_download_info& info) + void show_install_error(const updating::new_version_download_info& info, const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false }; - std::wstring contents = GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR; + std::wstring contents = strings.GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR; + contents += L'\n'; contents += current_version_to_next_version(info); show_toast_with_activations(std::move(contents), - TOAST_TITLE, + strings.TOAST_TITLE, {}, - { link_button{ GITHUB_NEW_VERSION_VISIT, info.release_page_uri.ToString().c_str() } }, + { link_button{ strings.GITHUB_NEW_VERSION_VISIT, info.release_page_uri.ToString().c_str() } }, std::move(toast_params)); } - void show_version_ready(const updating::new_version_download_info& info) + void show_version_ready(const updating::new_version_download_info& info, const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); toast_params toast_params{ UPDATING_PROCESS_TOAST_TAG, false }; - std::wstring new_version_ready{ GITHUB_NEW_VERSION_READY_TO_INSTALL }; + std::wstring new_version_ready{ strings.GITHUB_NEW_VERSION_READY_TO_INSTALL }; + new_version_ready += L'\n'; new_version_ready += current_version_to_next_version(info); show_toast_with_activations(std::move(new_version_ready), - TOAST_TITLE, + strings.TOAST_TITLE, {}, - { link_button{ GITHUB_NEW_VERSION_UPDATE_NOW, L"powertoys://update_now/" + info.installer_filename }, - link_button{ GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART, L"powertoys://schedule_update/" + info.installer_filename }, - snooze_button{ GITHUB_NEW_VERSION_SNOOZE_TITLE, { { GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D, 24 * 60 }, { GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D, 120 * 60 } } } }, + { link_button{ strings.GITHUB_NEW_VERSION_UPDATE_NOW, + L"powertoys://update_now/" + info.installer_filename }, + link_button{ strings.GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART, + L"powertoys://schedule_update/" + info.installer_filename }, + snooze_button{ + strings.GITHUB_NEW_VERSION_SNOOZE_TITLE, + { { strings.GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D, 24 * 60 }, + { strings.GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D, 120 * 60 } }, + strings.SNOOZE_BUTTON + } }, std::move(toast_params)); } - void show_uninstallation_error() + void show_uninstallation_error(const notifications::strings& strings) { remove_toasts(UPDATING_PROCESS_TOAST_TAG); - show_toast(localized_strings::UNINSTALLATION_UNKNOWN_ERROR, TOAST_TITLE); + show_toast(strings.UNINSTALLATION_UNKNOWN_ERROR, strings.TOAST_TITLE); } - void update_download_progress(const updating::new_version_download_info& info, float progress) + void update_download_progress(const updating::new_version_download_info& info, float progress, const notifications::strings& strings) { progress_bar_params progress_bar_params; std::wstring progress_title{ info.version_string }; progress_title += L' '; - progress_title += progress < 1 ? localized_strings::DOWNLOAD_IN_PROGRESS : localized_strings::DOWNLOAD_COMPLETE; + progress_title += progress < 1 ? strings.DOWNLOAD_IN_PROGRESS : strings.DOWNLOAD_COMPLETE; progress_bar_params.progress_title = progress_title; progress_bar_params.progress = progress; update_toast_progress_bar(UPDATING_PROCESS_TOAST_TAG, progress_bar_params); diff --git a/src/common/updating/notifications.h b/src/common/updating/notifications.h index 30f33f0470..0bd791620f 100644 --- a/src/common/updating/notifications.h +++ b/src/common/updating/notifications.h @@ -6,14 +6,66 @@ namespace updating namespace notifications { - void show_unavailable(); - void show_available(const updating::new_version_download_info& info); - void show_download_start(const updating::new_version_download_info& info); - void show_visit_github(const updating::new_version_download_info& info); - void show_install_error(const updating::new_version_download_info& info); - void show_version_ready(const updating::new_version_download_info& info); - void show_uninstallation_error(); + struct strings + { + std::wstring GITHUB_NEW_VERSION_AVAILABLE; + std::wstring GITHUB_NEW_VERSION_DOWNLOAD_STARTED; + std::wstring GITHUB_NEW_VERSION_READY_TO_INSTALL; + std::wstring GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR; + std::wstring GITHUB_NEW_VERSION_UPDATE_NOW; + std::wstring GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART; + std::wstring UNINSTALLATION_UNKNOWN_ERROR; + std::wstring GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT; + std::wstring GITHUB_NEW_VERSION_UNAVAILABLE; + std::wstring GITHUB_NEW_VERSION_VISIT; + std::wstring GITHUB_NEW_VERSION_MORE_INFO; + std::wstring GITHUB_NEW_VERSION_ABORT; + std::wstring GITHUB_NEW_VERSION_SNOOZE_TITLE; + std::wstring SNOOZE_BUTTON; + std::wstring GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D; + std::wstring GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D; + std::wstring DOWNLOAD_IN_PROGRESS; + std::wstring DOWNLOAD_COMPLETE; + std::wstring TOAST_TITLE; + std::wstring OFFER_UNINSTALL_MSI; + std::wstring OFFER_UNINSTALL_MSI_TITLE; + template + static strings create() + { + return strings{ + .GITHUB_NEW_VERSION_AVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE), + .GITHUB_NEW_VERSION_DOWNLOAD_STARTED = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_STARTED), + .GITHUB_NEW_VERSION_READY_TO_INSTALL = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_READY_TO_INSTALL), + .GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_DOWNLOAD_INSTALL_ERROR), + .GITHUB_NEW_VERSION_UPDATE_NOW = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW), + .GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_AFTER_RESTART), + .UNINSTALLATION_UNKNOWN_ERROR = GET_RESOURCE_STRING(IDS_UNINSTALLATION_UNKNOWN_ERROR), + .GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE_OFFER_VISIT), + .GITHUB_NEW_VERSION_UNAVAILABLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UNAVAILABLE), + .GITHUB_NEW_VERSION_VISIT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_VISIT), + .GITHUB_NEW_VERSION_MORE_INFO = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO), + .GITHUB_NEW_VERSION_ABORT = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_ABORT), + .GITHUB_NEW_VERSION_SNOOZE_TITLE = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_SNOOZE_TITLE), + .SNOOZE_BUTTON = GET_RESOURCE_STRING(IDS_SNOOZE_BUTTON), + .GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_1D), + .GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D = GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_SNOOZE_5D), + .DOWNLOAD_IN_PROGRESS = GET_RESOURCE_STRING(IDS_DOWNLOAD_IN_PROGRESS), + .DOWNLOAD_COMPLETE = GET_RESOURCE_STRING(IDS_DOWNLOAD_COMPLETE), + .TOAST_TITLE = GET_RESOURCE_STRING(IDS_TOAST_TITLE), + .OFFER_UNINSTALL_MSI = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI), + .OFFER_UNINSTALL_MSI_TITLE = GET_RESOURCE_STRING(IDS_OFFER_UNINSTALL_MSI_TITLE) + }; + } + }; - void update_download_progress(const updating::new_version_download_info& info, float progress); + void show_unavailable(const notifications::strings& strings); + void show_available(const updating::new_version_download_info& info, const strings&); + void show_download_start(const updating::new_version_download_info& info, const strings&); + void show_visit_github(const updating::new_version_download_info& info, const strings&); + void show_install_error(const updating::new_version_download_info& info, const strings&); + void show_version_ready(const updating::new_version_download_info& info, const strings&); + void show_uninstallation_error(const notifications::strings& strings); + + void update_download_progress(const updating::new_version_download_info& info, float progress, const notifications::strings& strings); } } \ No newline at end of file diff --git a/src/common/updating/updating.cpp b/src/common/updating/updating.cpp index c2f0e6e536..0160d4b0fc 100644 --- a/src/common/updating/updating.cpp +++ b/src/common/updating/updating.cpp @@ -19,7 +19,7 @@ #include "VersionHelper.h" #include -namespace +namespace // Strings in this namespace should not be localized { const wchar_t POWER_TOYS_UPGRADE_CODE[] = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}"; const wchar_t POWERTOYS_EXE_COMPONENT[] = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}"; @@ -32,12 +32,6 @@ namespace const wchar_t TOAST_TITLE[] = L"PowerToys"; } -namespace localized_strings -{ - const wchar_t OFFER_UNINSTALL_MSI[] = L"We've detected a previous installation of PowerToys. Would you like to remove it?"; - const wchar_t OFFER_UNINSTALL_MSI_TITLE[] = L"PowerToys: uninstall previous version?"; -} - namespace updating { std::wstring get_msi_package_path() @@ -73,13 +67,18 @@ namespace updating return package_path; } - bool offer_msi_uninstallation() + bool offer_msi_uninstallation(const notifications::strings& strings) { - const auto selection = SHMessageBoxCheckW(nullptr, localized_strings::OFFER_UNINSTALL_MSI, localized_strings::OFFER_UNINSTALL_MSI_TITLE, MB_ICONQUESTION | MB_YESNO, IDNO, DONT_SHOW_AGAIN_RECORD_REGISTRY_PATH); + const auto selection = SHMessageBoxCheckW(nullptr, + strings.OFFER_UNINSTALL_MSI.c_str(), + strings.OFFER_UNINSTALL_MSI_TITLE.c_str(), + MB_ICONQUESTION | MB_YESNO, + IDNO, + DONT_SHOW_AGAIN_RECORD_REGISTRY_PATH); return selection == IDYES; } - bool uninstall_msi_version(const std::wstring& package_path) + bool uninstall_msi_version(const std::wstring& package_path, const notifications::strings& strings) { const auto uninstall_result = MsiInstallProductW(package_path.c_str(), L"REMOVE=ALL"); if (ERROR_SUCCESS == uninstall_result) @@ -94,7 +93,7 @@ namespace updating } catch (...) { - updating::notifications::show_uninstallation_error(); + updating::notifications::show_uninstallation_error(strings); } } return false; @@ -202,7 +201,7 @@ namespace updating return installer_download_dst; } - std::future try_autoupdate(const bool download_updates_automatically) + std::future try_autoupdate(const bool download_updates_automatically, const notifications::strings& strings) { const auto new_version = co_await get_new_github_version_info_async(); if (!new_version) @@ -230,32 +229,32 @@ namespace updating } if (!download_success) { - updating::notifications::show_install_error(new_version.value()); + updating::notifications::show_install_error(new_version.value(), strings); co_return; } - updating::notifications::show_version_ready(new_version.value()); + updating::notifications::show_version_ready(new_version.value(), strings); } else { - updating::notifications::show_visit_github(new_version.value()); + updating::notifications::show_visit_github(new_version.value(), strings); } } - std::future check_new_version_available() + std::future check_new_version_available(const notifications::strings& strings) { const auto new_version = co_await get_new_github_version_info_async(); if (!new_version) { - updating::notifications::show_unavailable(); + updating::notifications::show_unavailable(strings); co_return VersionHelper{ VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION }.toWstring(); } - updating::notifications::show_available(new_version.value()); + updating::notifications::show_available(new_version.value(), strings); co_return new_version->version_string; } - std::future download_update() + std::future download_update(const notifications::strings& strings) { const auto new_version = co_await get_new_github_version_info_async(); if (!new_version) @@ -264,12 +263,12 @@ namespace updating } auto installer_download_dst = create_download_path() / new_version->installer_filename; - updating::notifications::show_download_start(new_version.value()); + updating::notifications::show_download_start(new_version.value(), strings); try { auto progressUpdateHandle = [&](float progress) { - updating::notifications::update_download_progress(new_version.value(), progress); + updating::notifications::update_download_progress(new_version.value(), progress, strings); }; http::HttpClient client; @@ -277,7 +276,7 @@ namespace updating } catch (...) { - updating::notifications::show_install_error(new_version.value()); + updating::notifications::show_install_error(new_version.value(), strings); co_return L""; } diff --git a/src/common/updating/updating.h b/src/common/updating/updating.h index 597a866b16..ea993f6d60 100644 --- a/src/common/updating/updating.h +++ b/src/common/updating/updating.h @@ -6,13 +6,14 @@ #include #include +#include "notifications.h" #include "../VersionHelper.h" namespace updating { std::wstring get_msi_package_path(); - bool uninstall_msi_version(const std::wstring& package_path); - bool offer_msi_uninstallation(); + bool uninstall_msi_version(const std::wstring& package_path, const notifications::strings&); + bool offer_msi_uninstallation(const notifications::strings&); std::optional get_msi_package_installed_path(); std::optional get_installed_powertoys_version(); @@ -27,11 +28,11 @@ namespace updating }; std::future> get_new_github_version_info_async(); - std::future try_autoupdate(const bool download_updates_automatically); + std::future try_autoupdate(const bool download_updates_automatically, const notifications::strings&); std::filesystem::path get_pending_updates_path(); - std::future check_new_version_available(); - std::future download_update(); + std::future check_new_version_available(const notifications::strings&); + std::future download_update(const notifications::strings&); // non-localized constexpr inline std::wstring_view INSTALLER_FILENAME_PATTERN = L"powertoyssetup"; diff --git a/src/runner/LocProject.json b/src/runner/LocProject.json index 640d8f23ce..a7978f0a33 100644 --- a/src/runner/LocProject.json +++ b/src/runner/LocProject.json @@ -4,9 +4,9 @@ "LanguageSet": "Azure_Languages", "LocItems": [ { - "SourceFile": "src\\action_runner\\Resources.resx", + "SourceFile": "src\\runner\\Resources.resx", "CopyOption": "LangIDOnName", - "OutputPath": "src\\action_runner" + "OutputPath": "src\\runner" } ] } diff --git a/src/runner/Resources.resx b/src/runner/Resources.resx index 50f74f777e..836c1340d3 100644 --- a/src/runner/Resources.resx +++ b/src/runner/Resources.resx @@ -73,5 +73,85 @@ PowerToys was successfully updated! - + + An older version of PowerToys is already running. + + + Couldn't download PowerToys update! Please report the issue on Github. + + + An older MSIX version of PowerToys was uninstalled. + + + PowerToys was updated successfully! + + + This setting has been disabled by your administrator. + + + This setting has been disabled manually via <a href="https://ms_settings_startupapps" target="_blank">Startup Settings</a>. + + + An update to PowerToys is available. + + + PowerToys download started. + + + An update to PowerToys is ready to install. + + + Error: couldn't download PowerToys installer. Visit our GitHub page to update. + + + Update now + + + At next launch + + + Error: please uninstall the previous version of PowerToys manually. + + + An update to PowerToys is available. Visit our GitHub page to update. + + + PowerToys is up to date. + + + Visit + + + More info... + + + Abort + + + Click Snooze to be reminded in: + + + 1 day + + + 5 days + + + Downloading... + + + Download complete + + + PowerToys Update + + + We've detected a previous installation of PowerToys. Would you like to remove it? + + + PowerToys: uninstall previous version? + + + Snooze + \ No newline at end of file diff --git a/src/runner/general_settings.cpp b/src/runner/general_settings.cpp index a1f4ce357a..5c7e950da5 100644 --- a/src/runner/general_settings.cpp +++ b/src/runner/general_settings.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "general_settings.h" #include "auto_start_helper.h" +#include "Generated files/resource.h" #include #include @@ -15,12 +16,7 @@ static std::wstring settings_theme = L"system"; static bool run_as_elevated = false; static bool download_updates_automatically = true; -// TODO: add resource.rc for settings project and localize -namespace localized_strings -{ - const std::wstring_view STARTUP_DISABLED_BY_POLICY = L"This setting has been disabled by your administrator."; - const std::wstring_view STARTUP_DISABLED_BY_USER = LR"(This setting has been disabled manually via Startup Settings.)"; -} +extern "C" IMAGE_DOS_HEADER __ImageBase; json::JsonObject GeneralSettings::to_json() { @@ -81,7 +77,6 @@ GeneralSettings get_general_settings() if (winstore::running_as_packaged()) { - using namespace localized_strings; const auto task_state = winstore::get_startup_task_status_async().get(); switch (task_state) { @@ -92,11 +87,11 @@ GeneralSettings get_general_settings() settings.isStartupEnabled = true; break; case winstore::StartupTaskState::DisabledByPolicy: - settings.startupDisabledReason = STARTUP_DISABLED_BY_POLICY; + settings.startupDisabledReason = GET_RESOURCE_STRING(IDS_STARTUP_DISABLED_BY_POLICY); settings.isStartupEnabled = false; break; case winstore::StartupTaskState::DisabledByUser: - settings.startupDisabledReason = STARTUP_DISABLED_BY_USER; + settings.startupDisabledReason = GET_RESOURCE_STRING(IDS_STARTUP_DISABLED_BY_USER); settings.isStartupEnabled = false; break; } diff --git a/src/runner/main.cpp b/src/runner/main.cpp index ec7a56ad0c..d68a1fec1d 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -35,20 +35,12 @@ #endif extern "C" IMAGE_DOS_HEADER __ImageBase; - -namespace localized_strings -{ - const wchar_t MSI_VERSION_IS_ALREADY_RUNNING[] = L"An older version of PowerToys is already running."; - const wchar_t DOWNLOAD_UPDATE_ERROR[] = L"Couldn't download PowerToys update! Please report the issue on Github."; - const wchar_t OLDER_MSIX_UNINSTALLED[] = L"An older MSIX version of PowerToys was uninstalled."; - const wchar_t PT_UPDATE_MESSAGE_BOX_TEXT[] = L"PowerToys was updated successfully!"; - const wchar_t POWER_TOYS[] = L"PowerToys"; - const wchar_t POWER_TOYS_MODULE_LOAD_FAIL[] = L"Failed to load "; // Module name will be appended on this message and it is not localized. -} +extern updating::notifications::strings Strings; namespace { const wchar_t PT_URI_PROTOCOL_SCHEME[] = L"powertoys://"; + const wchar_t POWER_TOYS_MODULE_LOAD_FAIL[] = L"Failed to load "; // Module name will be appended on this message and it is not localized. } void chdir_current_executable() @@ -59,7 +51,7 @@ void chdir_current_executable() PathRemoveFileSpec(executable_path); if (!SetCurrentDirectory(executable_path)) { - show_last_error_message(L"Change Directory to Executable Path", GetLastError()); + show_last_error_message(L"Change Directory to Executable Path", GetLastError(), L"PowerToys - runner"); } } @@ -110,7 +102,7 @@ int runner(bool isProcessElevated) std::thread{ [] { if (updating::uninstall_previous_msix_version_async().get()) { - notifications::show_toast(localized_strings::OLDER_MSIX_UNINSTALLED, L"PowerToys"); + notifications::show_toast(GET_RESOURCE_STRING(IDS_OLDER_MSIX_UNINSTALLED).c_str(), L"PowerToys"); } } }.detach(); } @@ -140,11 +132,12 @@ int runner(bool isProcessElevated) } catch (...) { - std::wstring errorMessage = std::wstring(localized_strings::POWER_TOYS_MODULE_LOAD_FAIL) + moduleSubdir.data(); - MessageBox(NULL, - errorMessage.c_str(), - localized_strings::POWER_TOYS, - MB_OK | MB_ICONERROR); + std::wstring errorMessage = POWER_TOYS_MODULE_LOAD_FAIL; + errorMessage += moduleSubdir; + MessageBoxW(NULL, + errorMessage.c_str(), + L"PowerToys", + MB_OK | MB_ICONERROR); } } // Start initial powertoys @@ -243,7 +236,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ { try { - std::wstring installer_filename = updating::download_update().get(); + std::wstring installer_filename = updating::download_update(Strings).get(); std::wstring args{ UPDATE_NOW_LAUNCH_STAGE1_CMDARG }; args += L' '; @@ -255,7 +248,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ catch (...) { MessageBoxW(nullptr, - localized_strings::DOWNLOAD_UPDATE_ERROR, + GET_RESOURCE_STRING(IDS_DOWNLOAD_UPDATE_ERROR).c_str(), L"PowerToys", MB_ICONWARNING | MB_OK); @@ -314,7 +307,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine case SpecialMode::ReportSuccessfulUpdate: { notifications::remove_toasts(notifications::UPDATING_PROCESS_TOAST_TAG); - notifications::show_toast(localized_strings::PT_UPDATE_MESSAGE_BOX_TEXT, + notifications::show_toast(GET_RESOURCE_STRING(IDS_PT_UPDATE_MESSAGE_BOX_TEXT), L"PowerToys", notifications::toast_params{ notifications::UPDATING_PROCESS_TOAST_TAG }); break; diff --git a/src/runner/settings_window.cpp b/src/runner/settings_window.cpp index a6d0786672..83b3dd7647 100644 --- a/src/runner/settings_window.cpp +++ b/src/runner/settings_window.cpp @@ -390,7 +390,7 @@ void run_settings_window() WaitForSingleObject(process_info.hProcess, INFINITE); if (WaitForSingleObject(process_info.hProcess, INFINITE) != WAIT_OBJECT_0) { - show_last_error_message(L"Couldn't wait on the Settings Window to close.", GetLastError()); + show_last_error_message(L"Couldn't wait on the Settings Window to close.", GetLastError(), L"PowerToys - runner"); } LExit: diff --git a/src/runner/update_utils.cpp b/src/runner/update_utils.cpp index c66d16dbeb..5a2f30eb8b 100644 --- a/src/runner/update_utils.cpp +++ b/src/runner/update_utils.cpp @@ -1,5 +1,8 @@ #include "pch.h" +#include +#include "Generated Files/resource.h" + #include "action_runner_utils.h" #include "update_state.h" #include "update_utils.h" @@ -8,6 +11,10 @@ #include #include +extern "C" IMAGE_DOS_HEADER __ImageBase; + +auto Strings = updating::notifications::strings::create(); + bool start_msi_uninstallation_sequence() { const auto package_path = updating::get_msi_package_path(); @@ -18,7 +25,7 @@ bool start_msi_uninstallation_sequence() return true; } - if (!updating::offer_msi_uninstallation()) + if (!updating::offer_msi_uninstallation(Strings)) { // User declined to uninstall or opted for "Don't show again" return false; @@ -54,7 +61,7 @@ void github_update_worker() const bool download_updates_automatically = get_general_settings().downloadUpdatesAutomatically; try { - updating::try_autoupdate(download_updates_automatically).get(); + updating::try_autoupdate(download_updates_automatically, Strings).get(); } catch (...) { @@ -70,7 +77,7 @@ std::wstring check_for_updates() { try { - return updating::check_new_version_available().get(); + return updating::check_new_version_available(Strings).get(); } catch (...) { From ebf81a6a0336e85c887dedd6bf90d11f3ab17b70 Mon Sep 17 00:00:00 2001 From: stefansjfw <57057282+stefansjfw@users.noreply.github.com> Date: Mon, 2 Nov 2020 10:05:57 +0100 Subject: [PATCH 16/20] Associate Name label with textbox (#7621) --- .../fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml index 9e7e74ac27..7c7ad39c71 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml +++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml @@ -166,8 +166,8 @@ - - + +