diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 00577dc9e806..57295f1145ac 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -389,6 +389,7 @@ DComposition ddf Deact debian +debugbreak DECLAR declspec decltype @@ -936,6 +937,7 @@ IRegistration IRegistry IReloadable IRepository +IResource IResult ISavable isbi @@ -975,6 +977,7 @@ IView IVirtual IWeb IWIC +IWindow IWindows IWork IXaml @@ -1527,7 +1530,6 @@ powerlauncher powerpreview powerrename POWERRENAMETEST -POWERRENAMEUIHOST powertoy powertoysinterop powertoyssetup @@ -1690,6 +1692,7 @@ RESOURCEID RESTORESIZE RESTORETOMAXIMIZED restrictedcapabilities +restrictederrorinfo resultlist resw resx @@ -1996,6 +1999,7 @@ TApplied targ TARGETAPPHEADER TARGETDIR +targetentrypoint TARGETHEADER targetnametoken targetsize diff --git a/PowerToys.sln b/PowerToys.sln index a610747b8dd1..ac74dbede40a 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -275,8 +275,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643 src\common\utils\modulesRegistry.h = src\common\utils\modulesRegistry.h src\common\utils\MsiUtils.h = src\common\utils\MsiUtils.h src\common\utils\os-detect.h = src\common\utils\os-detect.h - src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h src\common\utils\process_path.h = src\common\utils\process_path.h + src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h src\common\utils\registry.h = src\common\utils\registry.h src\common\utils\resources.h = src\common\utils\resources.h src\common\utils\string_utils.h = src\common\utils\string_utils.h @@ -341,7 +341,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plu EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoConferenceShared", "src\modules\videoconference\VideoConferenceShared\VideoConferenceShared.vcxproj", "{459E0768-7EBD-4C41-BBA1-6DB3B3815E0A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoConferenceModule", "src\modules\videoconference\VideoConferenceModule\Video Conference.vcxproj", "{5ABA70DE-3A3F-41F6-A1F5-D1F74F54F9BB}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoConferenceModule", "src\modules\videoconference\VideoConferenceModule\VideoConference.vcxproj", "{5ABA70DE-3A3F-41F6-A1F5-D1F74F54F9BB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VideoConferenceProxyFilter", "src\modules\videoconference\VideoConferenceProxyFilter\VideoConferenceProxyFilter.vcxproj", "{AC2857B4-103D-4D6D-9740-926EBF785042}" ProjectSection(ProjectDependencies) = postProject @@ -358,13 +358,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plu EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.WindowsTerminal.UnitTests", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsTerminal.UnitTests\Microsoft.Plugin.WindowsTerminal.UnitTests.csproj", "{4ED320BC-BA04-4D42-8D15-CBE62151F08B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUIHost", "src\modules\powerrename\PowerRenameUIHost\PowerRenameUIHost.vcxproj", "{F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}" - ProjectSection(ProjectDependencies) = postProject - {4642D596-723F-4BFC-894C-46811219AC4A} = {4642D596-723F-4BFC-894C-46811219AC4A} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUILib", "src\modules\powerrename\PowerRenameUILib\PowerRenameUILib.vcxproj", "{4642D596-723F-4BFC-894C-46811219AC4A}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MouseUtils", "MouseUtils", "{322566EF-20DC-43A6-B9F8-616AF942579A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindMyMouse", "src\modules\MouseUtils\FindMyMouse\FindMyMouse.vcxproj", "{E94FD11C-0591-456F-899F-EFC0CA548336}" @@ -405,6 +398,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Plugin.WindowWalk EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerToys.Settings", "src\settings-ui\Settings.UI\PowerToys.Settings.csproj", "{020A7474-3601-4160-A159-D7B70B77B15F}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PowerRenameUI", "src\modules\powerrename\ui\PowerRenameUI.vcxproj", "{27718999-C175-450A-861C-89F911E16A88}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -1360,26 +1355,6 @@ Global {4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x64.Build.0 = Release|x64 {4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.ActiveCfg = Release|x64 {4ED320BC-BA04-4D42-8D15-CBE62151F08B}.Release|x86.Build.0 = Release|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|ARM64.ActiveCfg = Debug|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|ARM64.Build.0 = Debug|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x64.ActiveCfg = Debug|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x64.Build.0 = Debug|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Debug|x86.ActiveCfg = Debug|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Release|ARM64.ActiveCfg = Release|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Release|ARM64.Build.0 = Release|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Release|x64.ActiveCfg = Release|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Release|x64.Build.0 = Release|x64 - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63}.Release|x86.ActiveCfg = Release|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Debug|ARM64.ActiveCfg = Debug|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Debug|ARM64.Build.0 = Debug|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Debug|x64.ActiveCfg = Debug|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Debug|x64.Build.0 = Debug|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Debug|x86.ActiveCfg = Debug|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Release|ARM64.ActiveCfg = Release|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Release|ARM64.Build.0 = Release|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Release|x64.ActiveCfg = Release|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Release|x64.Build.0 = Release|x64 - {4642D596-723F-4BFC-894C-46811219AC4A}.Release|x86.ActiveCfg = Release|x64 {E94FD11C-0591-456F-899F-EFC0CA548336}.Debug|ARM64.ActiveCfg = Debug|x64 {E94FD11C-0591-456F-899F-EFC0CA548336}.Debug|ARM64.Build.0 = Debug|x64 {E94FD11C-0591-456F-899F-EFC0CA548336}.Debug|x64.ActiveCfg = Debug|x64 @@ -1570,6 +1545,18 @@ Global {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x64.Build.0 = Release|x64 {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x86.ActiveCfg = Release|x64 {020A7474-3601-4160-A159-D7B70B77B15F}.Release|x86.Build.0 = Release|x64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|ARM64.Build.0 = Debug|ARM64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|x64.ActiveCfg = Debug|x64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|x64.Build.0 = Debug|x64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|x86.ActiveCfg = Debug|x64 + {27718999-C175-450A-861C-89F911E16A88}.Debug|x86.Build.0 = Debug|x64 + {27718999-C175-450A-861C-89F911E16A88}.Release|ARM64.ActiveCfg = Release|ARM64 + {27718999-C175-450A-861C-89F911E16A88}.Release|ARM64.Build.0 = Release|ARM64 + {27718999-C175-450A-861C-89F911E16A88}.Release|x64.ActiveCfg = Release|x64 + {27718999-C175-450A-861C-89F911E16A88}.Release|x64.Build.0 = Release|x64 + {27718999-C175-450A-861C-89F911E16A88}.Release|x86.ActiveCfg = Release|x64 + {27718999-C175-450A-861C-89F911E16A88}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1682,8 +1669,6 @@ Global {F40C3397-1834-4530-B2D9-8F8B8456BCDF} = {2F305555-C296-497E-AC20-5FA1B237996A} {A2D583F0-B70C-4462-B1F0-8E81AFB7BA85} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {4ED320BC-BA04-4D42-8D15-CBE62151F08B} = {4AFC9975-2456-4C70-94A4-84073C1CED93} - {F7EC4E6C-19CA-4FBD-9918-B8AC5FEF4F63} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} - {4642D596-723F-4BFC-894C-46811219AC4A} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} {322566EF-20DC-43A6-B9F8-616AF942579A} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {E94FD11C-0591-456F-899F-EFC0CA548336} = {322566EF-20DC-43A6-B9F8-616AF942579A} {782A61BE-9D85-4081-B35C-1CCC9DCC1E88} = {322566EF-20DC-43A6-B9F8-616AF942579A} @@ -1704,6 +1689,7 @@ Global {FD464B4C-2F68-4D06-91E7-4208146C41F5} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {8FE5A5EE-1B59-401C-9FB3-B04ECD3E29C1} = {4AFC9975-2456-4C70-94A4-84073C1CED93} {020A7474-3601-4160-A159-D7B70B77B15F} = {C3081D9A-1586-441A-B5F4-ED815B3719C1} + {27718999-C175-450A-861C-89F911E16A88} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index 4c66037f3284..e861f62f068d 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -102,11 +102,7 @@ - - - - - + - + @@ -64,15 +64,15 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/ActionRunner/packages.config b/src/ActionRunner/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/ActionRunner/packages.config +++ b/src/ActionRunner/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/Update/PowerToys.Update.vcxproj b/src/Update/PowerToys.Update.vcxproj index d94596054207..8d260d75927e 100644 --- a/src/Update/PowerToys.Update.vcxproj +++ b/src/Update/PowerToys.Update.vcxproj @@ -1,6 +1,6 @@ - + @@ -70,15 +70,15 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + + + \ No newline at end of file diff --git a/src/Update/packages.config b/src/Update/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/Update/packages.config +++ b/src/Update/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/common/SettingsAPI/SettingsAPI.vcxproj b/src/common/SettingsAPI/SettingsAPI.vcxproj index 98d9804a1daf..da7bafbef77a 100644 --- a/src/common/SettingsAPI/SettingsAPI.vcxproj +++ b/src/common/SettingsAPI/SettingsAPI.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {6955446D-23F7-4023-9BB3-8657F904AF99} @@ -44,13 +44,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/Themes/Themes.vcxproj b/src/common/Themes/Themes.vcxproj index 8c63af54ea6f..b9335299b11a 100644 --- a/src/common/Themes/Themes.vcxproj +++ b/src/common/Themes/Themes.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {98537082-0FDB-40DE-ABD8-0DC5A4269BAB} @@ -42,13 +42,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/Themes/packages.config b/src/common/Themes/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/common/Themes/packages.config +++ b/src/common/Themes/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj index ca8d7682cee7..3c4d7e21aea3 100644 --- a/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj +++ b/src/common/UnitTests-CommonLib/UnitTests-CommonLib.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {1A066C63-64B3-45F8-92FE-664E1CCE8077} @@ -59,13 +59,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/UnitTests-CommonLib/packages.config b/src/common/UnitTests-CommonLib/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/common/UnitTests-CommonLib/packages.config +++ b/src/common/UnitTests-CommonLib/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/common/logger/logger.vcxproj b/src/common/logger/logger.vcxproj index 7d92b81b45b3..d319a0c36b2b 100644 --- a/src/common/logger/logger.vcxproj +++ b/src/common/logger/logger.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -70,23 +70,23 @@ Create - - - {7e1e3f13-2bd6-3f75-a6a7-873a2b55c60f} + + + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/logger/packages.config b/src/common/logger/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/common/logger/packages.config +++ b/src/common/logger/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj b/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj index 32df697f375d..c1bf3d2dd2b8 100644 --- a/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj +++ b/src/common/notifications/BackgroundActivator/BackgroundActivator.vcxproj @@ -1,6 +1,6 @@ - + true true @@ -22,7 +22,6 @@ Unicode false - true true @@ -48,7 +47,6 @@ notifications $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\ - MultiThreadedDebugDLL @@ -59,7 +57,6 @@ MultiThreadedDLL - $(IntDir)pch.pch @@ -104,13 +101,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/notifications/BackgroundActivator/packages.config b/src/common/notifications/BackgroundActivator/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/common/notifications/BackgroundActivator/packages.config +++ b/src/common/notifications/BackgroundActivator/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj index d1112377f7da..34044b2b1eb1 100644 --- a/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj +++ b/src/common/notifications/BackgroundActivatorDLL/BackgroundActivatorDLL.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {031AC72E-FA28-4AB7-B690-6F7B9C28AA73} @@ -37,7 +37,7 @@ Level4 - NDEBUG;NOTIFICATIONSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + WINRT_NO_MAKE_DETECTION;NDEBUG;NOTIFICATIONSDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) false @@ -64,7 +64,7 @@ - + @@ -78,7 +78,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/notifications/BackgroundActivatorDLL/packages.config b/src/common/notifications/BackgroundActivatorDLL/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/common/notifications/BackgroundActivatorDLL/packages.config +++ b/src/common/notifications/BackgroundActivatorDLL/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/common/notifications/notifications.vcxproj b/src/common/notifications/notifications.vcxproj index b1f89201b95b..8be7d73edc74 100644 --- a/src/common/notifications/notifications.vcxproj +++ b/src/common/notifications/notifications.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {1D5BE09D-78C0-4FD7-AF00-AE7C1AF7C525} @@ -42,15 +42,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/common/notifications/packages.config b/src/common/notifications/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/common/notifications/packages.config +++ b/src/common/notifications/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/common/updating/packages.config b/src/common/updating/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/common/updating/packages.config +++ b/src/common/updating/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/common/updating/updating.vcxproj b/src/common/updating/updating.vcxproj index 7c5d99f5363b..7e408c4e6c6d 100644 --- a/src/common/updating/updating.vcxproj +++ b/src/common/updating/updating.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {17DA04DF-E393-4397-9CF0-84DABE11032E} @@ -59,15 +59,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj index 159341698518..eba28b413d67 100644 --- a/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj +++ b/src/modules/MouseUtils/FindMyMouse/FindMyMouse.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -134,13 +134,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/MouseUtils/FindMyMouse/packages.config b/src/modules/MouseUtils/FindMyMouse/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/MouseUtils/FindMyMouse/packages.config +++ b/src/modules/MouseUtils/FindMyMouse/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.vcxproj b/src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.vcxproj index ea3b45a3a04d..1a242d7c58dc 100644 --- a/src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.vcxproj +++ b/src/modules/MouseUtils/MouseHighlighter/MouseHighlighter.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -133,13 +133,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/MouseUtils/MouseHighlighter/packages.config b/src/modules/MouseUtils/MouseHighlighter/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/MouseUtils/MouseHighlighter/packages.config +++ b/src/modules/MouseUtils/MouseHighlighter/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/MouseUtils/MousePointerCrosshairs/MousePointerCrosshairs.vcxproj b/src/modules/MouseUtils/MousePointerCrosshairs/MousePointerCrosshairs.vcxproj index 6e372e73d3b8..3d4c70ffd4f8 100644 --- a/src/modules/MouseUtils/MousePointerCrosshairs/MousePointerCrosshairs.vcxproj +++ b/src/modules/MouseUtils/MousePointerCrosshairs/MousePointerCrosshairs.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -133,13 +133,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/MouseUtils/MousePointerCrosshairs/packages.config b/src/modules/MouseUtils/MousePointerCrosshairs/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/MouseUtils/MousePointerCrosshairs/packages.config +++ b/src/modules/MouseUtils/MousePointerCrosshairs/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj b/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj index 9efea4031a1b..8a193062f879 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj +++ b/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj @@ -1,6 +1,6 @@ - + @@ -180,13 +180,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj.filters b/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj.filters index f86e34e50370..a97390b57483 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj.filters +++ b/src/modules/ShortcutGuide/ShortcutGuide/ShortcutGuide.vcxproj.filters @@ -113,10 +113,10 @@ - Resource Files + diff --git a/src/modules/ShortcutGuide/ShortcutGuide/packages.config b/src/modules/ShortcutGuide/ShortcutGuide/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide/packages.config +++ b/src/modules/ShortcutGuide/ShortcutGuide/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj index 7eba9b0717a0..71871b730f11 100644 --- a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj +++ b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -79,9 +79,6 @@ Create - - - {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} @@ -95,18 +92,19 @@ + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj.filters b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj.filters index 831d437b7ec7..c2c77bfaf6a7 100644 --- a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj.filters +++ b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/ShortcutGuideModuleInterface.vcxproj.filters @@ -37,10 +37,10 @@ - Resource Files + diff --git a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/packages.config b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/packages.config +++ b/src/modules/ShortcutGuide/ShortcutGuideModuleInterface/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.vcxproj b/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.vcxproj index cb3d95f4238e..e301d03c3a5c 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.vcxproj +++ b/src/modules/alwaysontop/AlwaysOnTop/AlwaysOnTop.vcxproj @@ -1,8 +1,8 @@ - + true @@ -170,14 +170,14 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/alwaysontop/AlwaysOnTop/packages.config b/src/modules/alwaysontop/AlwaysOnTop/packages.config index 510c10c51fd5..669cfedf9bbd 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/packages.config +++ b/src/modules/alwaysontop/AlwaysOnTop/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/AlwaysOnTopModuleInterface.vcxproj b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/AlwaysOnTopModuleInterface.vcxproj index 5e3a16c66bef..08f5d94cce3a 100644 --- a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/AlwaysOnTopModuleInterface.vcxproj +++ b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/AlwaysOnTopModuleInterface.vcxproj @@ -1,6 +1,6 @@ - + 15.0 {48A0A19E-A0BE-4256-ACF8-CC3B80291AF9} @@ -17,7 +17,6 @@ - @@ -64,13 +63,17 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/packages.config b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/alwaysontop/AlwaysOnTopModuleInterface/packages.config +++ b/src/modules/alwaysontop/AlwaysOnTopModuleInterface/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj b/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj index a9a497a26d9d..283d63783bca 100644 --- a/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj +++ b/src/modules/awake/AwakeModuleInterface/AwakeModuleInterface.vcxproj @@ -1,6 +1,6 @@ - + 15.0 {5e7360a8-d048-4ed3-8f09-0bfd64c5529a} @@ -67,15 +67,15 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/awake/AwakeModuleInterface/packages.config b/src/modules/awake/AwakeModuleInterface/packages.config index f29ad9ef3e3d..3b0b048f0bd3 100644 --- a/src/modules/awake/AwakeModuleInterface/packages.config +++ b/src/modules/awake/AwakeModuleInterface/packages.config @@ -1,5 +1,5 @@ - + - + \ No newline at end of file diff --git a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj index 0d424ed2cfd0..947138f27293 100644 --- a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj +++ b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj @@ -1,6 +1,6 @@ - + @@ -14,7 +14,7 @@ DynamicLibrary - v143 + v143 @@ -23,11 +23,11 @@ - + $(SolutionDir)$(Platform)\$(Configuration)\modules\$(ProjectName)\ - PowerToys.ColorPicker + PowerToys.ColorPicker @@ -41,6 +41,7 @@ + @@ -64,22 +65,19 @@ - - - - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters index b087129bc48a..5580f97f9e98 100644 --- a/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters +++ b/src/modules/colorPicker/ColorPicker/ColorPicker.vcxproj.filters @@ -43,7 +43,6 @@ - Resource Files @@ -53,6 +52,7 @@ Resource Files + diff --git a/src/modules/colorPicker/ColorPicker/packages.config b/src/modules/colorPicker/ColorPicker/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/colorPicker/ColorPicker/packages.config +++ b/src/modules/colorPicker/ColorPicker/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZones/FancyZones.vcxproj b/src/modules/fancyzones/FancyZones/FancyZones.vcxproj index 97a4b459e9b3..387e121a3a1b 100644 --- a/src/modules/fancyzones/FancyZones/FancyZones.vcxproj +++ b/src/modules/fancyzones/FancyZones/FancyZones.vcxproj @@ -1,7 +1,7 @@ - + Debug @@ -176,15 +176,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZones/packages.config b/src/modules/fancyzones/FancyZones/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/fancyzones/FancyZones/packages.config +++ b/src/modules/fancyzones/FancyZones/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesLib/FancyZonesLib.vcxproj b/src/modules/fancyzones/FancyZonesLib/FancyZonesLib.vcxproj index 903bd5538fbb..bb59239093c2 100644 --- a/src/modules/fancyzones/FancyZonesLib/FancyZonesLib.vcxproj +++ b/src/modules/fancyzones/FancyZonesLib/FancyZonesLib.vcxproj @@ -1,6 +1,6 @@ - + @@ -147,15 +147,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesLib/packages.config b/src/modules/fancyzones/FancyZonesLib/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/fancyzones/FancyZonesLib/packages.config +++ b/src/modules/fancyzones/FancyZonesLib/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesModuleInterface/FancyZonesModuleInterface.vcxproj b/src/modules/fancyzones/FancyZonesModuleInterface/FancyZonesModuleInterface.vcxproj index 65ed40ab0a73..95366a3b8687 100644 --- a/src/modules/fancyzones/FancyZonesModuleInterface/FancyZonesModuleInterface.vcxproj +++ b/src/modules/fancyzones/FancyZonesModuleInterface/FancyZonesModuleInterface.vcxproj @@ -1,6 +1,6 @@ - + 15.0 {48804216-2A0E-4168-A6D8-9CD068D14227} @@ -21,10 +21,6 @@ - - - - @@ -79,13 +75,17 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesModuleInterface/packages.config b/src/modules/fancyzones/FancyZonesModuleInterface/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/fancyzones/FancyZonesModuleInterface/packages.config +++ b/src/modules/fancyzones/FancyZonesModuleInterface/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/UnitTests.vcxproj b/src/modules/fancyzones/FancyZonesTests/UnitTests/UnitTests.vcxproj index 49d3cbbd0100..aab3d1cda342 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/UnitTests.vcxproj +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/UnitTests.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9} @@ -88,15 +88,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/packages.config b/src/modules/fancyzones/FancyZonesTests/UnitTests/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/packages.config +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj index 3ce7f877b8e0..d5075716e597 100644 --- a/src/modules/imageresizer/dll/ImageResizerExt.vcxproj +++ b/src/modules/imageresizer/dll/ImageResizerExt.vcxproj @@ -1,6 +1,6 @@  - + @@ -138,13 +138,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/imageresizer/dll/packages.config b/src/modules/imageresizer/dll/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/imageresizer/dll/packages.config +++ b/src/modules/imageresizer/dll/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj index 53d1533392a9..b7621e2ece6d 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj @@ -1,7 +1,7 @@ - + Debug @@ -134,6 +134,7 @@ + @@ -165,9 +166,6 @@ {23d2070d-e4ad-4add-85a7-083d9c76ad49} - - - @@ -179,17 +177,17 @@ - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj.filters b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj.filters index b940b683fb37..4dba0e069e9a 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj.filters +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/KeyboardManagerEditor.vcxproj.filters @@ -45,7 +45,6 @@ - Resource Files @@ -55,6 +54,7 @@ Resource Files + diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/packages.config b/src/modules/keyboardmanager/KeyboardManagerEditor/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/packages.config +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerEditorLibrary.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerEditorLibrary.vcxproj index 1a98d0340edb..214dbcbcc4fc 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerEditorLibrary.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyboardManagerEditorLibrary.vcxproj @@ -1,6 +1,6 @@ - + 16.0 Win32Proj @@ -100,15 +100,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorTest/KeyboardManagerEditorTest.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEditorTest/KeyboardManagerEditorTest.vcxproj index 2af4604c296c..15b8f47529ea 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorTest/KeyboardManagerEditorTest.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEditorTest/KeyboardManagerEditorTest.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {62173D9A-6724-4C00-A1C8-FB646480A9EC} @@ -74,13 +74,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorTest/packages.config b/src/modules/keyboardmanager/KeyboardManagerEditorTest/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorTest/packages.config +++ b/src/modules/keyboardmanager/KeyboardManagerEditorTest/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngine/KeyboardManagerEngine.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEngine/KeyboardManagerEngine.vcxproj index 17ca6b98e569..f692ef4f2d6b 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngine/KeyboardManagerEngine.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEngine/KeyboardManagerEngine.vcxproj @@ -1,6 +1,6 @@ - + true true @@ -88,13 +88,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngine/packages.config b/src/modules/keyboardmanager/KeyboardManagerEngine/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngine/packages.config +++ b/src/modules/keyboardmanager/KeyboardManagerEngine/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardManagerEngineLibrary.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardManagerEngineLibrary.vcxproj index 5b2d5382ab24..c4282ff90c9b 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardManagerEngineLibrary.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardManagerEngineLibrary.vcxproj @@ -1,6 +1,6 @@ - + 16.0 Win32Proj @@ -65,13 +65,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/packages.config b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/packages.config +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineTest/KeyboardManagerEngineTest.vcxproj b/src/modules/keyboardmanager/KeyboardManagerEngineTest/KeyboardManagerEngineTest.vcxproj index b1826200b9d5..947deaae5641 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineTest/KeyboardManagerEngineTest.vcxproj +++ b/src/modules/keyboardmanager/KeyboardManagerEngineTest/KeyboardManagerEngineTest.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {7f4b3a60-bc27-45a7-8000-68b0b6ea7466} @@ -78,13 +78,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineTest/packages.config b/src/modules/keyboardmanager/KeyboardManagerEngineTest/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineTest/packages.config +++ b/src/modules/keyboardmanager/KeyboardManagerEngineTest/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj index 10b8209b585a..479a915d14c2 100644 --- a/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj +++ b/src/modules/keyboardmanager/common/KeyboardManagerCommon.vcxproj @@ -1,6 +1,6 @@ - + 16.0 {8AFFA899-0B73-49EC-8C50-0FADDA57B2FC} @@ -87,13 +87,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/common/packages.config b/src/modules/keyboardmanager/common/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/common/packages.config +++ b/src/modules/keyboardmanager/common/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj index df150e491498..b2492b8f806c 100644 --- a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj +++ b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj @@ -1,6 +1,6 @@ - + 15.0 {89f34af7-1c34-4a72-aa6e-534bcf972bd9} @@ -57,6 +57,7 @@ + @@ -81,22 +82,19 @@ - - - - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj.filters b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj.filters index 0b957e0921ca..f6bc4bb23092 100644 --- a/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj.filters +++ b/src/modules/keyboardmanager/dll/KeyboardManager.vcxproj.filters @@ -40,7 +40,6 @@ - Resource Files @@ -50,6 +49,7 @@ Resource Files + diff --git a/src/modules/keyboardmanager/dll/packages.config b/src/modules/keyboardmanager/dll/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/src/modules/keyboardmanager/dll/packages.config +++ b/src/modules/keyboardmanager/dll/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj index 2a3a3f8e66c9..6639d14466fe 100644 --- a/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj +++ b/src/modules/launcher/Microsoft.Launcher/Microsoft.Launcher.vcxproj @@ -1,6 +1,6 @@ - + @@ -30,7 +30,7 @@ - + PowerToys.Launcher @@ -80,15 +80,15 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/launcher/Microsoft.Launcher/packages.config b/src/modules/launcher/Microsoft.Launcher/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/launcher/Microsoft.Launcher/packages.config +++ b/src/modules/launcher/Microsoft.Launcher/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.cpp b/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.cpp deleted file mode 100644 index 3b982def7194..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.cpp +++ /dev/null @@ -1,1023 +0,0 @@ -// PowerRenameUIHost.cpp : Defines the entry point for the application. -// -#include "pch.h" - -#include "PowerRenameUIHost.h" -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#define MAX_LOADSTRING 100 - -// Non-localizable -const std::wstring moduleName = L"PowerRename"; -const std::wstring internalPath = L""; -const wchar_t c_WindowClass[] = L"PowerRename"; -HINSTANCE g_hostHInst; - -int AppWindow::Show(HINSTANCE hInstance, std::vector files) -{ - auto window = AppWindow(hInstance, files); - window.CreateAndShowWindow(); - Logger::debug(L"PowerRename UI created. Starting the message loop."); - - return window.MessageLoop(window.m_accelerators.get()); -} - -LRESULT AppWindow::MessageHandler(UINT message, WPARAM wParam, LPARAM lParam) noexcept -{ - switch (message) - { - HANDLE_MSG(WindowHandle(), WM_CREATE, OnCreate); - HANDLE_MSG(WindowHandle(), WM_COMMAND, OnCommand); - HANDLE_MSG(WindowHandle(), WM_DESTROY, OnDestroy); - HANDLE_MSG(WindowHandle(), WM_SIZE, OnResize); - default: - return base_type::MessageHandler(message, wParam, lParam); - } - - return base_type::MessageHandler(message, wParam, lParam); -} - -AppWindow::AppWindow(HINSTANCE hInstance, std::vector files) noexcept : - m_instance{ hInstance }, m_managerEvents{ this } -{ - if (SUCCEEDED(CPowerRenameManager::s_CreateInstance(&m_prManager))) - { - // Create the factory for our items - CComPtr prItemFactory; - if (SUCCEEDED(CPowerRenameItem::s_CreateInstance(nullptr, IID_PPV_ARGS(&prItemFactory)))) - { - if(SUCCEEDED(m_prManager->PutRenameItemFactory(prItemFactory))) - { - if (SUCCEEDED(m_prManager->Advise(&m_managerEvents, &m_cookie))) - { - CComPtr shellItemArray; - // To test PowerRenameUIHost uncomment this line and update the path to - // your local (absolute or relative) path which you want to see in PowerRename - //files.push_back(L""); - - if (!files.empty()) - { - if (SUCCEEDED(CreateShellItemArrayFromPaths(files, &shellItemArray))) - { - CComPtr enumShellItems; - if (SUCCEEDED(shellItemArray->EnumItems(&enumShellItems))) - { - EnumerateShellItems(enumShellItems); - } - } - } - else - { - Logger::warn(L"No items selected to be renamed."); - } - } - } - } - else - { - Logger::error(L"Error creating PowerRenameItemFactory"); - } - } - else - { - Logger::error(L"Error creating PowerRenameManager"); - } -} - -void AppWindow::CreateAndShowWindow() -{ - _TRACER_; - - m_accelerators.reset(LoadAcceleratorsW(m_instance, MAKEINTRESOURCE(IDC_POWERRENAMEUIHOST))); - - WNDCLASSEXW wcex = { sizeof(wcex) }; - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = WndProc; - wcex.hInstance = m_instance; - wcex.hIcon = LoadIconW(m_instance, MAKEINTRESOURCE(IDC_POWERRENAMEUIHOST)); - wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW); - wcex.hbrBackground = reinterpret_cast(COLOR_WINDOW + 1); - wcex.lpszClassName = c_WindowClass; - wcex.hIconSm = LoadIconW(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); - RegisterClassExW(&wcex); // don't test result, handle error at CreateWindow - - wchar_t title[64]; - LoadStringW(m_instance, IDS_APP_TITLE, title, ARRAYSIZE(title)); - - // hardcoded width and height (1200 x 600) - with WinUI 3, it should auto-scale to the content - int windowWidth = 1200; - int windowHeight = 600; - m_window = CreateWindowW(c_WindowClass, title, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, windowWidth, windowHeight, nullptr, nullptr, m_instance, this); - THROW_LAST_ERROR_IF(!m_window); - - POINT cursorPosition{}; - if (GetCursorPos(&cursorPosition)) - { - HMONITOR hMonitor = MonitorFromPoint(cursorPosition, MONITOR_DEFAULTTOPRIMARY); - MONITORINFOEX monitorInfo; - monitorInfo.cbSize = sizeof(MONITORINFOEX); - GetMonitorInfo(hMonitor, &monitorInfo); - - SetWindowPos(m_window, - HWND_TOP, - monitorInfo.rcWork.left + (monitorInfo.rcWork.right - monitorInfo.rcWork.left - windowWidth) / 2, - monitorInfo.rcWork.top + (monitorInfo.rcWork.bottom - monitorInfo.rcWork.top - windowHeight) / 2, - 0, - 0, - SWP_NOSIZE); - } - - ShowWindow(m_window, SW_SHOWNORMAL); - UpdateWindow(m_window); - SetFocus(m_window); -} - -bool AppWindow::OnCreate(HWND, LPCREATESTRUCT) noexcept -{ - _TRACER_; - - m_mainUserControl = winrt::PowerRenameUILib::MainWindow(); - m_xamlIsland = CreateDesktopWindowsXamlSource(WS_TABSTOP, m_mainUserControl); - - try - { - PopulateExplorerItems(); - UpdateCounts(); - SetHandlers(); - ReadSettings(); - } - catch (std::exception e) - { - Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() }); - } - - m_mainUserControl.UIUpdatesItem().ButtonRenameEnabled(false); - InitAutoComplete(); - SearchReplaceChanged(); - return true; -} - -void AppWindow::OnCommand(HWND, int id, HWND hwndControl, UINT codeNotify) noexcept -{ - switch (id) - { - case IDM_ABOUT: - DialogBoxW(m_instance, MAKEINTRESOURCE(IDD_ABOUTBOX), WindowHandle(), [](HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -> INT_PTR { - switch (message) - { - case WM_INITDIALOG: - return TRUE; - - case WM_COMMAND: - if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) - { - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - break; - } - return FALSE; - }); - break; - - case IDM_EXIT: - PostQuitMessage(0); - break; - } -} - -void AppWindow::OnDestroy(HWND hwnd) noexcept -{ - _TRACER_; - - base_type::OnDestroy(hwnd); -} - -void AppWindow::OnResize(HWND, UINT state, int cx, int cy) noexcept -{ - _TRACER_; - - SetWindowPos(m_xamlIsland, NULL, 0, 0, cx, cy, SWP_SHOWWINDOW); -} - -HRESULT AppWindow::CreateShellItemArrayFromPaths( - std::vector files, - IShellItemArray** shellItemArray) -{ - _TRACER_; - - *shellItemArray = nullptr; - PIDLIST_ABSOLUTE* itemList = nullptr; - itemList = new (std::nothrow) PIDLIST_ABSOLUTE[files.size()]; - HRESULT hr = itemList ? S_OK : E_OUTOFMEMORY; - UINT itemsCnt = 0; - for (const auto& file : files) - { - const DWORD BUFSIZE = 4096; - TCHAR buffer[BUFSIZE] = TEXT(""); - auto retval = GetFullPathName(file.c_str(), BUFSIZE, buffer, NULL); - if (retval != 0 && PathFileExists(buffer)) - { - hr = SHParseDisplayName(buffer, nullptr, &itemList[itemsCnt], 0, nullptr); - ++itemsCnt; - } - } - if (SUCCEEDED(hr) && itemsCnt > 0) - { - hr = SHCreateShellItemArrayFromIDLists(itemsCnt, const_cast(itemList), shellItemArray); - if (SUCCEEDED(hr)) - { - for (UINT i = 0; i < itemsCnt; i++) - { - CoTaskMemFree(itemList[i]); - } - } - else - { - Logger::error(L"Creating ShellItemArray from path list failed."); - } - } - else - { - Logger::error(L"Parsing path list display names failed."); - hr = E_FAIL; - } - - delete[] itemList; - return hr; -} - -void AppWindow::PopulateExplorerItems() -{ - _TRACER_; - - UINT count = 0; - m_prManager->GetVisibleItemCount(&count); - Logger::debug(L"Number of visible items: {}", count); - - for (UINT i = 0; i < count; ++i) - { - CComPtr renameItem; - if (SUCCEEDED(m_prManager->GetVisibleItemByIndex(i, &renameItem))) - { - int id = 0; - renameItem->GetId(&id); - - PWSTR originalName = nullptr; - renameItem->GetOriginalName(&originalName); - PWSTR newName = nullptr; - renameItem->GetNewName(&newName); - - bool selected; - renameItem->GetSelected(&selected); - - UINT depth = 0; - renameItem->GetDepth(&depth); - - bool isFolder = false; - bool isSubFolderContent = false; - winrt::check_hresult(renameItem->GetIsFolder(&isFolder)); - - m_mainUserControl.AddExplorerItem( - id, originalName, newName == nullptr ? hstring{} : hstring{ newName }, isFolder ? 0 : 1, depth, selected); - } - } -} - -HRESULT AppWindow::InitAutoComplete() -{ - _TRACER_; - - HRESULT hr = S_OK; - if (CSettingsInstance().GetMRUEnabled()) - { - hr = CPowerRenameMRU::CPowerRenameMRUSearch_CreateInstance(&m_searchMRU); - if (SUCCEEDED(hr)) - { - for (const auto& item : m_searchMRU->GetMRUStrings()) - { - if (!item.empty()) - { - m_mainUserControl.AppendSearchMRU(item); - } - } - } - - if (SUCCEEDED(hr)) - { - hr = CPowerRenameMRU::CPowerRenameMRUReplace_CreateInstance(&m_replaceMRU); - if (SUCCEEDED(hr)) - { - for (const auto& item : m_replaceMRU->GetMRUStrings()) - { - if (!item.empty()) - { - m_mainUserControl.AppendReplaceMRU(item); - } - } - } - } - } - - return hr; -} - -HRESULT AppWindow::EnumerateShellItems(_In_ IEnumShellItems* enumShellItems) -{ - _TRACER_; - - HRESULT hr = S_OK; - // Enumerate the data object and populate the manager - if (m_prManager) - { - m_disableCountUpdate = true; - - // Ensure we re-create the enumerator - m_prEnum = nullptr; - hr = CPowerRenameEnum::s_CreateInstance(nullptr, m_prManager, IID_PPV_ARGS(&m_prEnum)); - if (SUCCEEDED(hr)) - { - hr = m_prEnum->Start(enumShellItems); - } - - m_disableCountUpdate = false; - } - - return hr; -} - -void AppWindow::SearchReplaceChanged(bool forceRenaming) -{ - _TRACER_; - - Logger::debug(L"Forced renaming - {}", forceRenaming); - // Pass updated search and replace terms to the IPowerRenameRegEx handler - CComPtr prRegEx; - if (m_prManager && SUCCEEDED(m_prManager->GetRenameRegEx(&prRegEx))) - { - winrt::hstring searchTerm = m_mainUserControl.AutoSuggestBoxSearch().Text(); - prRegEx->PutSearchTerm(searchTerm.c_str(), forceRenaming); - - winrt::hstring replaceTerm = m_mainUserControl.AutoSuggestBoxReplace().Text(); - prRegEx->PutReplaceTerm(replaceTerm.c_str(), forceRenaming); - } -} - -void AppWindow::ValidateFlags(PowerRenameFlags flag) -{ - if (flag == Uppercase) - { - if (m_mainUserControl.ToggleButtonUpperCase().IsChecked()) - { - m_mainUserControl.ToggleButtonLowerCase().IsChecked(false); - m_mainUserControl.ToggleButtonTitleCase().IsChecked(false); - m_mainUserControl.ToggleButtonCapitalize().IsChecked(false); - } - } - else if (flag == Lowercase) - { - if (m_mainUserControl.ToggleButtonLowerCase().IsChecked()) - { - m_mainUserControl.ToggleButtonUpperCase().IsChecked(false); - m_mainUserControl.ToggleButtonTitleCase().IsChecked(false); - m_mainUserControl.ToggleButtonCapitalize().IsChecked(false); - } - } - else if (flag == Titlecase) - { - if (m_mainUserControl.ToggleButtonTitleCase().IsChecked()) - { - m_mainUserControl.ToggleButtonUpperCase().IsChecked(false); - m_mainUserControl.ToggleButtonLowerCase().IsChecked(false); - m_mainUserControl.ToggleButtonCapitalize().IsChecked(false); - } - } - else if (flag == Capitalized) - { - if (m_mainUserControl.ToggleButtonCapitalize().IsChecked()) - { - m_mainUserControl.ToggleButtonUpperCase().IsChecked(false); - m_mainUserControl.ToggleButtonLowerCase().IsChecked(false); - m_mainUserControl.ToggleButtonTitleCase().IsChecked(false); - } - } - - m_flagValidationInProgress = true; -} - -void AppWindow::UpdateFlag(PowerRenameFlags flag, UpdateFlagCommand command) -{ - _TRACER_; - - DWORD flags{}; - m_prManager->GetFlags(&flags); - - if (command == UpdateFlagCommand::Set) - { - flags |= flag; - } - else if (command == UpdateFlagCommand::Reset) - { - flags &= ~flag; - } - - Logger::debug(L"Flag {} " + std::wstring{ command == UpdateFlagCommand::Set ? L"set" : L"reset" }, flag); - - // Ensure we update flags - if (m_prManager) - { - m_prManager->PutFlags(flags); - } -} - -void AppWindow::SetHandlers() -{ - _TRACER_; - - m_mainUserControl.UIUpdatesItem().PropertyChanged([&](winrt::Windows::Foundation::IInspectable const& sender, Data::PropertyChangedEventArgs const& e) { - std::wstring property{ e.PropertyName() }; - if (property == L"ShowAll") - { - SwitchView(); - } - else if (property == L"ChangedItemId") - { - ToggleItem(m_mainUserControl.UIUpdatesItem().ChangedExplorerItemId(), m_mainUserControl.UIUpdatesItem().Checked()); - } - else if (property == L"ToggleAll") - { - ToggleAll(); - } - else if (property == L"Rename") - { - Rename(m_mainUserControl.UIUpdatesItem().CloseUIWindow()); - } - }); - - // AutoSuggestBox Search - m_mainUserControl.AutoSuggestBoxSearch().TextChanged([&](winrt::Windows::Foundation::IInspectable const& sender, AutoSuggestBoxTextChangedEventArgs const&) { - SearchReplaceChanged(); - }); - - // AutoSuggestBox Replace - m_mainUserControl.AutoSuggestBoxReplace().TextChanged([&](winrt::Windows::Foundation::IInspectable const& sender, AutoSuggestBoxTextChangedEventArgs const&) { - SearchReplaceChanged(); - }); - - // ToggleButton UpperCase - m_mainUserControl.ToggleButtonUpperCase().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(Uppercase); - UpdateFlag(Uppercase, UpdateFlagCommand::Set); - }); - m_mainUserControl.ToggleButtonUpperCase().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(Uppercase, UpdateFlagCommand::Reset); - }); - - // ToggleButton LowerCase - m_mainUserControl.ToggleButtonLowerCase().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(Lowercase); - UpdateFlag(Lowercase, UpdateFlagCommand::Set); - }); - m_mainUserControl.ToggleButtonLowerCase().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(Lowercase, UpdateFlagCommand::Reset); - }); - - // ToggleButton TitleCase - m_mainUserControl.ToggleButtonTitleCase().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(Titlecase); - UpdateFlag(Titlecase, UpdateFlagCommand::Set); - }); - m_mainUserControl.ToggleButtonTitleCase().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(Titlecase, UpdateFlagCommand::Reset); - }); - - // ToggleButton Capitalize - m_mainUserControl.ToggleButtonCapitalize().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(Capitalized); - UpdateFlag(Capitalized, UpdateFlagCommand::Set); - }); - m_mainUserControl.ToggleButtonCapitalize().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(Capitalized, UpdateFlagCommand::Reset); - }); - - // CheckBox Regex - m_mainUserControl.CheckBoxRegex().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(UseRegularExpressions); - UpdateFlag(UseRegularExpressions, UpdateFlagCommand::Set); - }); - m_mainUserControl.CheckBoxRegex().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(UseRegularExpressions, UpdateFlagCommand::Reset); - }); - - // CheckBox CaseSensitive - m_mainUserControl.CheckBoxCaseSensitive().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(CaseSensitive); - UpdateFlag(CaseSensitive, UpdateFlagCommand::Set); - }); - m_mainUserControl.CheckBoxCaseSensitive().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(CaseSensitive, UpdateFlagCommand::Reset); - }); - - // ComboBox RenameParts - m_mainUserControl.ComboBoxRenameParts().SelectionChanged([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - if (m_mainUserControl.ComboBoxRenameParts().SelectedIndex() == 0) - { // Filename + extension - UpdateFlag(NameOnly, UpdateFlagCommand::Reset); - UpdateFlag(ExtensionOnly, UpdateFlagCommand::Reset); - } - else if (m_mainUserControl.ComboBoxRenameParts().SelectedIndex() == 1) // Filename Only - { - ValidateFlags(NameOnly); - UpdateFlag(ExtensionOnly, UpdateFlagCommand::Reset); - UpdateFlag(NameOnly, UpdateFlagCommand::Set); - } - else if (m_mainUserControl.ComboBoxRenameParts().SelectedIndex() == 2) // Extension Only - { - ValidateFlags(ExtensionOnly); - UpdateFlag(NameOnly, UpdateFlagCommand::Reset); - UpdateFlag(ExtensionOnly, UpdateFlagCommand::Set); - } - }); - - // CheckBox MatchAllOccurences - m_mainUserControl.CheckBoxMatchAll().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(MatchAllOccurences); - UpdateFlag(MatchAllOccurences, UpdateFlagCommand::Set); - }); - m_mainUserControl.CheckBoxMatchAll().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(MatchAllOccurences, UpdateFlagCommand::Reset); - }); - - // ToggleButton IncludeFiles - m_mainUserControl.ToggleButtonIncludeFiles().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(ExcludeFiles); - UpdateFlag(ExcludeFiles, UpdateFlagCommand::Reset); - }); - m_mainUserControl.ToggleButtonIncludeFiles().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(ExcludeFiles, UpdateFlagCommand::Set); - }); - - // ToggleButton IncludeFolders - m_mainUserControl.ToggleButtonIncludeFolders().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(ExcludeFolders); - UpdateFlag(ExcludeFolders, UpdateFlagCommand::Reset); - }); - m_mainUserControl.ToggleButtonIncludeFolders().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(ExcludeFolders, UpdateFlagCommand::Set); - }); - - // ToggleButton IncludeSubfolders - m_mainUserControl.ToggleButtonIncludeSubfolders().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(ExcludeSubfolders); - UpdateFlag(ExcludeSubfolders, UpdateFlagCommand::Reset); - }); - m_mainUserControl.ToggleButtonIncludeSubfolders().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(ExcludeSubfolders, UpdateFlagCommand::Set); - }); - - // CheckBox EnumerateItems - m_mainUserControl.ToggleButtonEnumerateItems().Checked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - ValidateFlags(EnumerateItems); - UpdateFlag(EnumerateItems, UpdateFlagCommand::Set); - }); - m_mainUserControl.ToggleButtonEnumerateItems().Unchecked([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - UpdateFlag(EnumerateItems, UpdateFlagCommand::Reset); - }); - - // ButtonSettings - m_mainUserControl.ButtonSettings().Click([&](winrt::Windows::Foundation::IInspectable const& sender, RoutedEventArgs const&) { - OpenSettingsApp(); - }); -} - -void AppWindow::ToggleItem(int32_t id, bool checked) -{ - _TRACER_; - Logger::debug(L"Toggling item with id = {}", id); - CComPtr spItem; - - if (SUCCEEDED(m_prManager->GetItemById(id, &spItem))) - { - spItem->PutSelected(checked); - } - UpdateCounts(); -} - -void AppWindow::ToggleAll() -{ - _TRACER_; - - UINT itemCount = 0; - m_prManager->GetItemCount(&itemCount); - bool selected = m_mainUserControl.CheckBoxSelectAll().IsChecked().GetBoolean(); - for (UINT i = 0; i < itemCount; i++) - { - CComPtr spItem; - if (SUCCEEDED(m_prManager->GetItemByIndex(i, &spItem))) - { - spItem->PutSelected(selected); - } - } - UpdateCounts(); -} - -void AppWindow::SwitchView() -{ - _TRACER_; - - m_prManager->SwitchFilter(0); - PopulateExplorerItems(); - UpdateCounts(); -} - -void AppWindow::Rename(bool closeWindow) -{ - _TRACER_; - - if (m_prManager) - { - m_prManager->Rename(m_window, closeWindow); - } - - // Persist the current settings. We only do this when - // a rename is actually performed. Not when the user - // closes/cancels the dialog. - WriteSettings(); -} - -HRESULT AppWindow::ReadSettings() -{ - _TRACER_; - - bool persistState{ CSettingsInstance().GetPersistState() }; - Logger::debug(L"ReadSettings with persistState = {}", persistState); - - // Check if we should read flags from settings - // or the defaults from the manager. - DWORD flags = 0; - if (persistState) - { - flags = CSettingsInstance().GetFlags(); - - m_mainUserControl.AutoSuggestBoxSearch().Text(CSettingsInstance().GetSearchText().c_str()); - m_mainUserControl.AutoSuggestBoxReplace().Text(CSettingsInstance().GetReplaceText().c_str()); - } - else - { - m_prManager->GetFlags(&flags); - } - - m_prManager->PutFlags(flags); - SetCheckboxesFromFlags(flags); - - return S_OK; -} - -HRESULT AppWindow::WriteSettings() -{ - _TRACER_; - - // Check if we should store our settings - if (CSettingsInstance().GetPersistState()) - { - DWORD flags = 0; - m_prManager->GetFlags(&flags); - CSettingsInstance().SetFlags(flags); - - winrt::hstring searchTerm = m_mainUserControl.AutoSuggestBoxSearch().Text(); - CSettingsInstance().SetSearchText(std::wstring{ searchTerm }); - - if (CSettingsInstance().GetMRUEnabled() && m_searchMRU) - { - CComPtr spSearchMRU; - if (SUCCEEDED(m_searchMRU->QueryInterface(IID_PPV_ARGS(&spSearchMRU)))) - { - spSearchMRU->AddMRUString(searchTerm.c_str()); - } - } - - winrt::hstring replaceTerm = m_mainUserControl.AutoSuggestBoxReplace().Text(); - CSettingsInstance().SetReplaceText(std::wstring{ replaceTerm }); - - if (CSettingsInstance().GetMRUEnabled() && m_replaceMRU) - { - CComPtr spReplaceMRU; - if (SUCCEEDED(m_replaceMRU->QueryInterface(IID_PPV_ARGS(&spReplaceMRU)))) - { - spReplaceMRU->AddMRUString(replaceTerm.c_str()); - } - } - - Trace::SettingsChanged(); - } - - return S_OK; -} - -HRESULT AppWindow::OpenSettingsApp() -{ - std::wstring path = get_module_folderpath(g_hostHInst); - path += L"\\..\\..\\PowerToys.exe"; - - std::wstring openSettings = L"--open-settings=PowerRename"; - - CString commandLine; - commandLine.Format(_T("\"%s\""), path.c_str()); - commandLine.AppendFormat(_T(" %s"), openSettings.c_str()); - - int nSize = commandLine.GetLength() + 1; - LPTSTR lpszCommandLine = new TCHAR[nSize]; - _tcscpy_s(lpszCommandLine, nSize, commandLine); - - STARTUPINFO startupInfo; - ZeroMemory(&startupInfo, sizeof(STARTUPINFO)); - startupInfo.cb = sizeof(STARTUPINFO); - startupInfo.wShowWindow = SW_SHOWNORMAL; - - PROCESS_INFORMATION processInformation; - - // Start the resizer - CreateProcess( - NULL, - lpszCommandLine, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &startupInfo, - &processInformation); - - delete[] lpszCommandLine; - - if (!CloseHandle(processInformation.hProcess)) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - if (!CloseHandle(processInformation.hThread)) - { - return HRESULT_FROM_WIN32(GetLastError()); - } - return S_OK; -} - -void AppWindow::SetCheckboxesFromFlags(DWORD flags) -{ - if (flags & CaseSensitive) - { - m_mainUserControl.CheckBoxCaseSensitive().IsChecked(true); - } - if (flags & MatchAllOccurences) - { - m_mainUserControl.CheckBoxMatchAll().IsChecked(true); - } - if (flags & UseRegularExpressions) - { - m_mainUserControl.CheckBoxRegex().IsChecked(true); - } - if (flags & EnumerateItems) - { - m_mainUserControl.ToggleButtonEnumerateItems().IsChecked(true); - } - if (flags & ExcludeFiles) - { - m_mainUserControl.ToggleButtonIncludeFiles().IsChecked(false); - } - if (flags & ExcludeFolders) - { - m_mainUserControl.ToggleButtonIncludeFolders().IsChecked(false); - } - if (flags & ExcludeSubfolders) - { - m_mainUserControl.ToggleButtonIncludeSubfolders().IsChecked(false); - } - if (flags & NameOnly) - { - m_mainUserControl.ComboBoxRenameParts().SelectedIndex(1); - } - else if (flags & ExtensionOnly) - { - m_mainUserControl.ComboBoxRenameParts().SelectedIndex(2); - } - if (flags & Uppercase) - { - m_mainUserControl.ToggleButtonUpperCase().IsChecked(true); - } - else if (flags & Lowercase) - { - m_mainUserControl.ToggleButtonLowerCase().IsChecked(true); - } - else if (flags & Titlecase) - { - m_mainUserControl.ToggleButtonTitleCase().IsChecked(true); - } - else if (flags & Capitalized) - { - m_mainUserControl.ToggleButtonCapitalize().IsChecked(true); - } -} - -void AppWindow::UpdateCounts() -{ - // This method is CPU intensive. We disable it during certain operations - // for performance reasons. - if (m_disableCountUpdate) - { - return; - } - - UINT selectedCount = 0; - UINT renamingCount = 0; - if (m_prManager) - { - m_prManager->GetSelectedItemCount(&selectedCount); - m_prManager->GetRenameItemCount(&renamingCount); - } - - if (m_selectedCount != selectedCount || - m_renamingCount != renamingCount) - { - m_selectedCount = selectedCount; - m_renamingCount = renamingCount; - - // Update Rename button state - m_mainUserControl.UIUpdatesItem().ButtonRenameEnabled(renamingCount > 0); - } - - m_mainUserControl.UIUpdatesItem().OriginalCount(std::to_wstring(m_mainUserControl.ExplorerItems().Size())); - m_mainUserControl.UIUpdatesItem().RenamedCount(std::to_wstring(m_renamingCount)); -} - -HRESULT AppWindow::OnItemAdded(_In_ IPowerRenameItem* renameItem) -{ - return S_OK; -} - -HRESULT AppWindow::OnUpdate(_In_ IPowerRenameItem* renameItem) -{ - int id; - HRESULT hr = renameItem->GetId(&id); - if (SUCCEEDED(hr)) - { - PWSTR newName = nullptr; - hr = renameItem->GetNewName(&newName); - if (SUCCEEDED(hr)) - { - hstring newNameStr = newName == nullptr ? hstring{} : newName; - m_mainUserControl.UpdateExplorerItem(id, newNameStr); - } - } - - return S_OK; -} - -HRESULT AppWindow::OnRename(_In_ IPowerRenameItem* renameItem) -{ - int id; - HRESULT hr = renameItem->GetId(&id); - if (SUCCEEDED(hr)) - { - PWSTR newName = nullptr; - hr = renameItem->GetOriginalName(&newName); - if (SUCCEEDED(hr)) - { - hstring newNameStr = newName == nullptr ? hstring{} : newName; - m_mainUserControl.UpdateRenamedExplorerItem(id, newNameStr); - } - } - - UpdateCounts(); - return S_OK; -} - -HRESULT AppWindow::OnError(_In_ IPowerRenameItem* renameItem) -{ - return S_OK; -} - -HRESULT AppWindow::OnRegExStarted(_In_ DWORD threadId) -{ - return S_OK; -} - -HRESULT AppWindow::OnRegExCanceled(_In_ DWORD threadId) -{ - return S_OK; -} - -HRESULT AppWindow::OnRegExCompleted(_In_ DWORD threadId) -{ - _TRACER_; - - if (m_flagValidationInProgress) - { - m_flagValidationInProgress = false; - } - else - { - DWORD filter = 0; - m_prManager->GetFilter(&filter); - if (filter == PowerRenameFilters::ShouldRename) - { - m_mainUserControl.ExplorerItems().Clear(); - PopulateExplorerItems(); - } - } - - UpdateCounts(); - return S_OK; -} - -HRESULT AppWindow::OnRenameStarted() -{ - return S_OK; -} - -HRESULT AppWindow::OnRenameCompleted(bool closeUIWindowAfterRenaming) -{ - _TRACER_; - - Logger::debug(L"Renaming completed. Close UI window - {}", closeUIWindowAfterRenaming); - if (closeUIWindowAfterRenaming) - { - // Close the window - PostMessage(m_window, WM_CLOSE, (WPARAM)0, (LPARAM)0); - } - else - { - // Force renaming work to start so newly renamed items are processed right away - SearchReplaceChanged(true); - } - return S_OK; -} - -int APIENTRY wWinMain(_In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, - _In_ LPWSTR lpCmdLine, - _In_ int nCmdShow) -{ - LoggerHelpers::init_logger(moduleName, internalPath, LogSettings::powerRenameLoggerName); - -#define BUFSIZE 4096 * 4 - - HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); - if (hStdin == INVALID_HANDLE_VALUE) - { - Logger::error(L"Invalid input handle."); - ExitProcess(1); - } - - BOOL bSuccess; - WCHAR chBuf[BUFSIZE]; - DWORD dwRead; - std::vector files; - for (;;) - { - // Read from standard input and stop on error or no data. - bSuccess = ReadFile(hStdin, chBuf, BUFSIZE * sizeof(wchar_t), &dwRead, NULL); - - if (!bSuccess || dwRead == 0) - break; - - std::wstring inputBatch{ chBuf, dwRead / sizeof(wchar_t) }; - - std::wstringstream ss(inputBatch); - std::wstring item; - wchar_t delimiter = '?'; - while (std::getline(ss, item, delimiter)) - { - files.push_back(item); - } - - if (!bSuccess) - break; - } - - Logger::debug(L"Starting PowerRename with {} files selected", files.size()); - - g_hostHInst = hInstance; - try - { - winrt::init_apartment(winrt::apartment_type::single_threaded); - - winrt::PowerRenameUILib::App app; - const auto result = AppWindow::Show(hInstance, files); - app.Close(); - } - catch (std::exception e) - { - Logger::error("Exception thrown during PowerRename UI initialization: {}", std::string{ e.what() }); - } -} diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.h b/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.h deleted file mode 100644 index 80b16cf6b6cd..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.h +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once -#include "pch.h" - -#include "resource.h" -#include "XamlBridge.h" - -#include -#include -#include -#include -#include - -#include -#include -#pragma push_macro("GetCurrentTime") -#undef GetCurrentTime -#include -#pragma pop_macro("GetCurrentTime") -#include -#include -#include -#include -#include -#include -#include - -using namespace winrt; -using namespace Windows::UI; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Composition; -using namespace Windows::UI::Xaml::Hosting; -using namespace Windows::Foundation::Numerics; -using namespace Windows::UI::Xaml::Controls; - -class AppWindow : public DesktopWindowT -{ -public: - // Proxy class to Advise() PRManager, as AppWindow can't implement IPowerRenameManagerEvents - class UIHostPowerRenameManagerEvents : public IPowerRenameManagerEvents - { - public: - UIHostPowerRenameManagerEvents(AppWindow* app) : - m_refCount{ 1 }, m_app{ app } - { - } - - IFACEMETHODIMP_(ULONG) - AddRef() - { - return InterlockedIncrement(&m_refCount); - } - - IFACEMETHODIMP_(ULONG) - Release() - { - long refCount = InterlockedDecrement(&m_refCount); - - if (refCount == 0) - { - delete this; - } - return refCount; - } - - IFACEMETHODIMP QueryInterface(_In_ REFIID riid, _Outptr_ void** ppv) - { - static const QITAB qit[] = { - QITABENT(UIHostPowerRenameManagerEvents, IPowerRenameManagerEvents), - { 0 } - }; - return QISearch(this, qit, riid, ppv); - } - - HRESULT OnItemAdded(_In_ IPowerRenameItem* renameItem) override { return m_app->OnItemAdded(renameItem); } - HRESULT OnUpdate(_In_ IPowerRenameItem* renameItem) override { return m_app->OnUpdate(renameItem); } - HRESULT OnRename(_In_ IPowerRenameItem* renameItem) override { return m_app->OnRename(renameItem); } - HRESULT OnError(_In_ IPowerRenameItem* renameItem) override { return m_app->OnError(renameItem); } - HRESULT OnRegExStarted(_In_ DWORD threadId) override { return m_app->OnRegExStarted(threadId); } - HRESULT OnRegExCanceled(_In_ DWORD threadId) override { return m_app->OnRegExCanceled(threadId); } - HRESULT OnRegExCompleted(_In_ DWORD threadId) override { return m_app->OnRegExCompleted(threadId); } - HRESULT OnRenameStarted() override { return m_app->OnRenameStarted(); } - HRESULT OnRenameCompleted(bool closeUIWindowAfterRenaming) override { return m_app->OnRenameCompleted(closeUIWindowAfterRenaming); } - - private: - long m_refCount; - - AppWindow* m_app; - }; - - static int Show(HINSTANCE hInstance, std::vector files); - LRESULT MessageHandler(UINT message, WPARAM wParam, LPARAM lParam) noexcept; - -private: - enum class UpdateFlagCommand - { - Set = 0, - Reset - }; - - AppWindow(HINSTANCE hInstance, std::vector files) noexcept; - void CreateAndShowWindow(); - bool OnCreate(HWND, LPCREATESTRUCT) noexcept; - void OnCommand(HWND, int id, HWND hwndControl, UINT codeNotify) noexcept; - void OnDestroy(HWND hwnd) noexcept; - void OnResize(HWND, UINT state, int cx, int cy) noexcept; - HRESULT CreateShellItemArrayFromPaths(std::vector files, IShellItemArray** shellItemArray); - - void PopulateExplorerItems(); - HRESULT InitAutoComplete(); - HRESULT EnumerateShellItems(_In_ IEnumShellItems* enumShellItems); - void SearchReplaceChanged(bool forceRenaming = false); - void ValidateFlags(PowerRenameFlags flag); - void UpdateFlag(PowerRenameFlags flag, UpdateFlagCommand command); - void SetHandlers(); - void ToggleItem(int32_t id, bool checked); - void ToggleAll(); - void SwitchView(); - void Rename(bool closeWindow); - HRESULT ReadSettings(); - HRESULT WriteSettings(); - HRESULT OpenSettingsApp(); - void SetCheckboxesFromFlags(DWORD flags); - void UpdateCounts(); - - HRESULT OnItemAdded(_In_ IPowerRenameItem* renameItem); - HRESULT OnUpdate(_In_ IPowerRenameItem* renameItem); - HRESULT OnRename(_In_ IPowerRenameItem* renameItem); - HRESULT OnError(_In_ IPowerRenameItem* renameItem); - HRESULT OnRegExStarted(_In_ DWORD threadId); - HRESULT OnRegExCanceled(_In_ DWORD threadId); - HRESULT OnRegExCompleted(_In_ DWORD threadId); - HRESULT OnRenameStarted(); - HRESULT OnRenameCompleted(bool closeUIWindowAfterRenaming); - - wil::unique_haccel m_accelerators; - const HINSTANCE m_instance; - HWND m_xamlIsland{}; - HWND m_window{}; - winrt::PowerRenameUILib::MainWindow m_mainUserControl{ nullptr }; - - bool m_disableCountUpdate = false; - CComPtr m_prManager; - CComPtr m_dataSource; - CComPtr m_prEnum; - UIHostPowerRenameManagerEvents m_managerEvents; - DWORD m_cookie = 0; - CComPtr m_searchMRU; - CComPtr m_replaceMRU; - UINT m_selectedCount = 0; - UINT m_renamingCount = 0; - - bool m_flagValidationInProgress = false; -}; diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.rc b/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.rc deleted file mode 100644 index a2a3383f192f..000000000000 Binary files a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.rc and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj b/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj deleted file mode 100644 index 38ce4413b707..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - Debug - x64 - - - Release - x64 - - - - 81010002 - - - 16.0 - Win32Proj - {f7ec4e6c-19ca-4fbd-9918-b8ac5fef4f63} - PowerRenameUIHost - 10.0.18362.0 - $(WindowsTargetPlatformVersion) - - - - Application - true - v143 - Unicode - false - - - Application - false - v143 - true - Unicode - false - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\modules\PowerRename\ - PowerToys.PowerRename - - - false - $(SolutionDir)$(Platform)\$(Configuration)\modules\PowerRename\ - PowerToys.PowerRename - - - - Level3 - true - _DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - $(ProjectDir)..\..\..\;$(ProjectDir)..\..\..\common\Telemetry;$(ProjectDir)..\lib;%(AdditionalIncludeDirectories) - - - Windows - true - - - PerMonitorHighDPIAware - - - - - Level3 - true - true - true - NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - true - $(ProjectDir)..\..\..\;$(ProjectDir)..\..\..\common\Telemetry;$(ProjectDir)..\lib;%(AdditionalIncludeDirectories) - - - Windows - true - true - true - - - PerMonitorHighDPIAware - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - PowerRenameUILib - - - $(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\;$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\Generated Files\; - - - - - {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} - - - {51920f1f-c28c-4adf-8660-4238766796c2} - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj.filters b/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj.filters deleted file mode 100644 index 8be01112e61e..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.vcxproj.filters +++ /dev/null @@ -1,67 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - - - Resource Files - - - - - Resource Files - - - Resource Files - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/Resource.h b/src/modules/powerrename/PowerRenameUIHost/Resource.h deleted file mode 100644 index 3f2ed88ba129..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/Resource.h +++ /dev/null @@ -1,30 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PowerRenameUIHost.rc - -#define IDS_APP_TITLE 103 - -#define IDR_MAINFRAME 128 -#define IDD_POWERRENAMEUIHOST_DIALOG 102 -#define IDD_ABOUTBOX 103 -#define IDM_ABOUT 104 -#define IDM_EXIT 105 -#define IDI_POWERRENAMEUIHOST 107 -#define IDI_SMALL 108 -#define IDC_POWERRENAMEUIHOST 109 -#define IDC_MYICON 2 -#ifndef IDC_STATIC -#define IDC_STATIC -1 -#endif -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS - -#define _APS_NO_MFC 130 -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/src/modules/powerrename/PowerRenameUIHost/XamlBridge.cpp b/src/modules/powerrename/PowerRenameUIHost/XamlBridge.cpp deleted file mode 100644 index bbe11a61ec61..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/XamlBridge.cpp +++ /dev/null @@ -1,246 +0,0 @@ -#include "pch.h" - -#include "XamlBridge.h" -#include "Resource.h" -#include - -bool DesktopWindow::FilterMessage(const MSG* msg) -{ - // When multiple child windows are present it is needed to pre dispatch messages to all - // DesktopWindowXamlSource instances so keyboard accelerators and - // keyboard focus work correctly. - for (auto& xamlSource : m_xamlSources) - { - BOOL xamlSourceProcessedMessage = FALSE; - winrt::check_hresult(xamlSource.as()->PreTranslateMessage(msg, &xamlSourceProcessedMessage)); - if (xamlSourceProcessedMessage != FALSE) - { - return true; - } - } - - return false; -} - -const auto static invalidReason = static_cast(-1); - -winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason GetReasonFromKey(WPARAM key) -{ - auto reason = invalidReason; - if (key == VK_TAB) - { - byte keyboardState[256] = {}; - WINRT_VERIFY(::GetKeyboardState(keyboardState)); - reason = (keyboardState[VK_SHIFT] & 0x80) ? - winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Last : - winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::First; - } - else if (key == VK_LEFT) - { - reason = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Left; - } - else if (key == VK_RIGHT) - { - reason = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Right; - } - else if (key == VK_UP) - { - reason = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Up; - } - else if (key == VK_DOWN) - { - reason = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Down; - } - return reason; -} - -winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource DesktopWindow::GetNextFocusedIsland(const MSG* msg) -{ - if (msg->message == WM_KEYDOWN) - { - const auto key = msg->wParam; - auto reason = GetReasonFromKey(key); - if (reason != invalidReason) - { - const BOOL previous = - (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::First || - reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Down || - reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Right) ? - false : - true; - - const auto currentFocusedWindow = ::GetFocus(); - const auto nextElement = ::GetNextDlgTabItem(m_window.get(), currentFocusedWindow, previous); - for (auto& xamlSource : m_xamlSources) - { - HWND islandWnd{}; - winrt::check_hresult(xamlSource.as()->get_WindowHandle(&islandWnd)); - if (nextElement == islandWnd) - { - return xamlSource; - } - } - } - } - - return nullptr; -} - -winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource DesktopWindow::GetFocusedIsland() -{ - for (auto& xamlSource : m_xamlSources) - { - if (xamlSource.HasFocus()) - { - return xamlSource; - } - } - return nullptr; -} - -bool DesktopWindow::NavigateFocus(MSG* msg) -{ - if (const auto nextFocusedIsland = GetNextFocusedIsland(msg)) - { - const auto previousFocusedWindow = ::GetFocus(); - RECT rect = {}; - WINRT_VERIFY(::GetWindowRect(previousFocusedWindow, &rect)); - const auto nativeIsland = nextFocusedIsland.as(); - HWND islandWnd = nullptr; - winrt::check_hresult(nativeIsland->get_WindowHandle(&islandWnd)); - POINT pt = { rect.left, rect.top }; - SIZE size = { rect.right - rect.left, rect.bottom - rect.top }; - ::ScreenToClient(islandWnd, &pt); - const auto hintRect = winrt::Windows::Foundation::Rect({ static_cast(pt.x), static_cast(pt.y), static_cast(size.cx), static_cast(size.cy) }); - const auto reason = GetReasonFromKey(msg->wParam); - const auto request = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest(reason, hintRect); - m_lastFocusRequestId = request.CorrelationId(); - const auto result = nextFocusedIsland.NavigateFocus(request); - return result.WasFocusMoved(); - } - else - { - const bool islandIsFocused = GetFocusedIsland() != nullptr; - if (islandIsFocused) - { - return false; - } - const bool isDialogMessage = !!IsDialogMessage(m_window.get(), msg); - return isDialogMessage; - } -} - -int DesktopWindow::MessageLoop(HACCEL accelerators) -{ - MSG msg = {}; - while (GetMessage(&msg, nullptr, 0, 0)) - { - const bool processedMessage = FilterMessage(&msg); - if (!processedMessage && !TranslateAcceleratorW(msg.hwnd, accelerators, &msg)) - { - if (!NavigateFocus(&msg)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return static_cast(msg.wParam); -} - -static const WPARAM invalidKey = (WPARAM)-1; - -WPARAM GetKeyFromReason(winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason reason) -{ - auto key = invalidKey; - if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Last || reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::First) - { - key = VK_TAB; - } - else if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Left) - { - key = VK_LEFT; - } - else if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Right) - { - key = VK_RIGHT; - } - else if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Up) - { - key = VK_UP; - } - else if (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Down) - { - key = VK_DOWN; - } - return key; -} - -void DesktopWindow::OnTakeFocusRequested(winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource const& sender, winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs const& args) -{ - if (args.Request().CorrelationId() != m_lastFocusRequestId) - { - const auto reason = args.Request().Reason(); - const BOOL previous = - (reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::First || - reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Down || - reason == winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Right) ? - false : - true; - - const auto nativeXamlSource = sender.as(); - HWND senderHwnd = nullptr; - winrt::check_hresult(nativeXamlSource->get_WindowHandle(&senderHwnd)); - - MSG msg = {}; - msg.hwnd = senderHwnd; - msg.message = WM_KEYDOWN; - msg.wParam = GetKeyFromReason(reason); - if (!NavigateFocus(&msg)) - { - const auto nextElement = ::GetNextDlgTabItem(m_window.get(), senderHwnd, previous); - ::SetFocus(nextElement); - } - } - else - { - const auto request = winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationRequest(winrt::Windows::UI::Xaml::Hosting::XamlSourceFocusNavigationReason::Restore); - m_lastFocusRequestId = request.CorrelationId(); - sender.NavigateFocus(request); - } -} - -HWND DesktopWindow::CreateDesktopWindowsXamlSource(DWORD extraWindowStyles, const winrt::Windows::UI::Xaml::UIElement& content) -{ - winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource desktopSource; - - auto interop = desktopSource.as(); - // Parent the DesktopWindowXamlSource object to current window - winrt::check_hresult(interop->AttachToWindow(m_window.get())); - HWND xamlSourceWindow{}; // Lifetime controlled desktopSource - winrt::check_hresult(interop->get_WindowHandle(&xamlSourceWindow)); - const DWORD style = GetWindowLongW(xamlSourceWindow, GWL_STYLE) | extraWindowStyles; - SetWindowLongW(xamlSourceWindow, GWL_STYLE, style); - - desktopSource.Content(content); - - m_takeFocusEventRevokers.push_back(desktopSource.TakeFocusRequested(winrt::auto_revoke, { this, &DesktopWindow::OnTakeFocusRequested })); - m_xamlSources.push_back(desktopSource); - - return xamlSourceWindow; -} - -void DesktopWindow::ClearXamlIslands() -{ - for (auto& takeFocusRevoker : m_takeFocusEventRevokers) - { - takeFocusRevoker.revoke(); - } - m_takeFocusEventRevokers.clear(); - - for (auto& xamlSource : m_xamlSources) - { - xamlSource.Close(); - } - m_xamlSources.clear(); -} diff --git a/src/modules/powerrename/PowerRenameUIHost/XamlBridge.h b/src/modules/powerrename/PowerRenameUIHost/XamlBridge.h deleted file mode 100644 index 24056ec28a97..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/XamlBridge.h +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once - -#include // To enable support for non-WinRT interfaces, unknwn.h must be included before any C++/WinRT headers. -#include -#include -#include -#pragma push_macro("GetCurrentTime") -#undef GetCurrentTime -#include -#pragma pop_macro("GetCurrentTime") -#include -#include -#include -#include - -class DesktopWindow -{ -protected: - int MessageLoop(HACCEL accelerators); - HWND CreateDesktopWindowsXamlSource(DWORD extraStyles, const winrt::Windows::UI::Xaml::UIElement& content); - void ClearXamlIslands(); - - HWND WindowHandle() const - { - return m_window.get(); - } - - static void OnNCCreate(HWND window, LPARAM lparam) noexcept - { - auto cs = reinterpret_cast(lparam); - auto that = static_cast(cs->lpCreateParams); - that->m_window.reset(window); // take ownership of the window - SetWindowLongPtrW(window, GWLP_USERDATA, reinterpret_cast(that)); - } - -private: - winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource GetFocusedIsland(); - bool FilterMessage(const MSG* msg); - void OnTakeFocusRequested(winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource const& sender, winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSourceTakeFocusRequestedEventArgs const& args); - winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource GetNextFocusedIsland(const MSG* msg); - bool NavigateFocus(MSG* msg); - - wil::unique_hwnd m_window; - winrt::guid m_lastFocusRequestId; - std::vector m_takeFocusEventRevokers; - std::vector m_xamlSources; -}; - -template -struct DesktopWindowT : public DesktopWindow -{ -protected: - using base_type = DesktopWindowT; - - static LRESULT __stdcall WndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) noexcept - { - if (message == WM_NCCREATE) - { - OnNCCreate(window, lparam); - } - else if (message == WM_NCDESTROY) - { - SetWindowLongPtrW(window, GWLP_USERDATA, 0); - } - else if (auto that = reinterpret_cast(GetWindowLongPtrW(window, GWLP_USERDATA))) - { - return that->MessageHandler(message, wparam, lparam); - } - - return DefWindowProcW(window, message, wparam, lparam); - } - - LRESULT MessageHandler(UINT message, WPARAM wParam, LPARAM lParam) noexcept - { - switch (message) - { - HANDLE_MSG(WindowHandle(), WM_DESTROY, OnDestroy); - HANDLE_MSG(WindowHandle(), WM_ACTIVATE, OnActivate); - HANDLE_MSG(WindowHandle(), WM_SETFOCUS, OnSetFocus); - } - return DefWindowProcW(WindowHandle(), message, wParam, lParam); - } - - void OnDestroy(HWND) - { - ClearXamlIslands(); - PostQuitMessage(0); - } - -private: - void OnActivate(HWND, UINT state, HWND hwndActDeact, BOOL fMinimized) - { - if (state == WA_INACTIVE) - { - m_hwndLastFocus = GetFocus(); - } - } - - void OnSetFocus(HWND, HWND hwndOldFocus) - { - if (m_hwndLastFocus) - { - SetFocus(m_hwndLastFocus); - } - } - - HWND m_hwndLastFocus = nullptr; -}; diff --git a/src/modules/powerrename/PowerRenameUIHost/app.manifest b/src/modules/powerrename/PowerRenameUIHost/app.manifest deleted file mode 100644 index 28e90ea052d1..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/app.manifest +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/framework.h b/src/modules/powerrename/PowerRenameUIHost/framework.h deleted file mode 100644 index ce362d71f878..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/framework.h +++ /dev/null @@ -1,15 +0,0 @@ -// header.h : include file for standard system include files, -// or project specific include files -// - -#pragma once - -#include "targetver.h" -// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files -#include -// C RunTime Header Files -#include -#include -#include -#include diff --git a/src/modules/powerrename/PowerRenameUIHost/packages.config b/src/modules/powerrename/PowerRenameUIHost/packages.config deleted file mode 100644 index cb4fc6898e71..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/packages.config +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/pch.cpp b/src/modules/powerrename/PowerRenameUIHost/pch.cpp deleted file mode 100644 index 17305716aacd..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUIHost/pch.h b/src/modules/powerrename/PowerRenameUIHost/pch.h deleted file mode 100644 index 61ca50ecd866..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/pch.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include "framework.h" -#include -#include diff --git a/src/modules/powerrename/PowerRenameUIHost/small.ico b/src/modules/powerrename/PowerRenameUIHost/small.ico deleted file mode 100644 index 4f111feaac04..000000000000 Binary files a/src/modules/powerrename/PowerRenameUIHost/small.ico and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUIHost/targetver.h b/src/modules/powerrename/PowerRenameUIHost/targetver.h deleted file mode 100644 index 87c0086de751..000000000000 --- a/src/modules/powerrename/PowerRenameUIHost/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/src/modules/powerrename/PowerRenameUILib/App.cpp b/src/modules/powerrename/PowerRenameUILib/App.cpp deleted file mode 100644 index f1840cbe192a..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/App.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "pch.h" -#include "App.h" -#include "App.g.cpp" -using namespace winrt; -using namespace Windows::UI::Xaml; -namespace winrt::PowerRenameUILib::implementation -{ - App::App() - { - Initialize(); - AddRef(); - m_inner.as<::IUnknown>()->Release(); - } - App::~App() - { - Close(); - } -} diff --git a/src/modules/powerrename/PowerRenameUILib/App.h b/src/modules/powerrename/PowerRenameUILib/App.h deleted file mode 100644 index 2ba215af18e5..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/App.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -#include "App.g.h" -#include "App.base.h" -namespace winrt::PowerRenameUILib::implementation -{ - class App : public AppT2 - { - public: - App(); - ~App(); - }; -} -namespace winrt::PowerRenameUILib::factory_implementation -{ - class App : public AppT - { - }; -} diff --git a/src/modules/powerrename/PowerRenameUILib/App.idl b/src/modules/powerrename/PowerRenameUILib/App.idl deleted file mode 100644 index 648b2544a49a..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/App.idl +++ /dev/null @@ -1,7 +0,0 @@ -namespace PowerRenameUILib -{ - [default_interface] runtimeclass App : Microsoft.Toolkit.Win32.UI.XamlHost.XamlApplication - { - App(); - } -} \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/LockScreenLogo.scale-200.png b/src/modules/powerrename/PowerRenameUILib/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57adb5df..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/SplashScreen.scale-200.png b/src/modules/powerrename/PowerRenameUILib/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1feda7..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/Square150x150Logo.scale-200.png b/src/modules/powerrename/PowerRenameUILib/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1a548..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.scale-200.png b/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2ec8a6..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce97e0a..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/StoreLogo.png b/src/modules/powerrename/PowerRenameUILib/Assets/StoreLogo.png deleted file mode 100644 index 7385b56c0e4d..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/StoreLogo.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/Wide310x150Logo.scale-200.png b/src/modules/powerrename/PowerRenameUILib/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b397fd..000000000000 Binary files a/src/modules/powerrename/PowerRenameUILib/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp b/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp deleted file mode 100644 index 866a60379c05..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.cpp +++ /dev/null @@ -1,288 +0,0 @@ -#include "pch.h" -#include "MainWindow.h" -#if __has_include("MainWindow.g.cpp") -#include "MainWindow.g.cpp" -#endif - -using namespace winrt; -using namespace Windows::UI::Xaml; - -namespace winrt::PowerRenameUILib::implementation -{ - MainWindow::MainWindow() : - m_allSelected{ true } - { - m_searchMRU = winrt::single_threaded_observable_vector(); - m_replaceMRU = winrt::single_threaded_observable_vector(); - - m_explorerItems = winrt::single_threaded_observable_vector(); - - m_searchRegExShortcuts = winrt::single_threaded_observable_vector(); - auto resourceLoader{ Windows::ApplicationModel::Resources::ResourceLoader::GetForCurrentView() }; - - m_searchRegExShortcuts.Append(winrt::make(L".", resourceLoader.GetString(L"RegExCheatSheet_MatchAny"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\d", resourceLoader.GetString(L"RegExCheatSheet_MatchDigit"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\D", resourceLoader.GetString(L"RegExCheatSheet_MatchNonDigit"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\w", resourceLoader.GetString(L"RegExCheatSheet_MatchNonWS"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\S", resourceLoader.GetString(L"RegExCheatSheet_MatchWordChar"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\S+", resourceLoader.GetString(L"RegExCheatSheet_MatchOneOrMoreWS"))); - m_searchRegExShortcuts.Append(winrt::make(L"\\b", resourceLoader.GetString(L"RegExCheatSheet_MatchWordBoundary"))); - - m_dateTimeShortcuts = winrt::single_threaded_observable_vector(); - m_dateTimeShortcuts.Append(winrt::make(L"$YYYY", resourceLoader.GetString(L"DateTimeCheatSheet_FullYear"))); - m_dateTimeShortcuts.Append(winrt::make(L"$YY", resourceLoader.GetString(L"DateTimeCheatSheet_YearLastTwoDigits"))); - m_dateTimeShortcuts.Append(winrt::make(L"$Y", resourceLoader.GetString(L"DateTimeCheatSheet_YearLastDigit"))); - m_dateTimeShortcuts.Append(winrt::make(L"$MMMM", resourceLoader.GetString(L"DateTimeCheatSheet_MonthName"))); - m_dateTimeShortcuts.Append(winrt::make(L"$MMM", resourceLoader.GetString(L"DateTimeCheatSheet_MonthNameAbbr"))); - m_dateTimeShortcuts.Append(winrt::make(L"$MM", resourceLoader.GetString(L"DateTimeCheatSheet_MonthDigitLZero"))); - m_dateTimeShortcuts.Append(winrt::make(L"$M", resourceLoader.GetString(L"DateTimeCheatSheet_MonthDigit"))); - m_dateTimeShortcuts.Append(winrt::make(L"$DDDD", resourceLoader.GetString(L"DateTimeCheatSheet_DayName"))); - m_dateTimeShortcuts.Append(winrt::make(L"$DDD", resourceLoader.GetString(L"DateTimeCheatSheet_DayNameAbbr"))); - m_dateTimeShortcuts.Append(winrt::make(L"$DD", resourceLoader.GetString(L"DateTimeCheatSheet_DayDigitLZero"))); - m_dateTimeShortcuts.Append(winrt::make(L"$D", resourceLoader.GetString(L"DateTimeCheatSheet_DayDigit"))); - m_dateTimeShortcuts.Append(winrt::make(L"$hh", resourceLoader.GetString(L"DateTimeCheatSheet_HoursLZero"))); - m_dateTimeShortcuts.Append(winrt::make(L"$h", resourceLoader.GetString(L"DateTimeCheatSheet_Hours"))); - m_dateTimeShortcuts.Append(winrt::make(L"$mm", resourceLoader.GetString(L"DateTimeCheatSheet_MinutesLZero"))); - m_dateTimeShortcuts.Append(winrt::make(L"$m", resourceLoader.GetString(L"DateTimeCheatSheet_Minutes"))); - m_dateTimeShortcuts.Append(winrt::make(L"$ss", resourceLoader.GetString(L"DateTimeCheatSheet_SecondsLZero"))); - m_dateTimeShortcuts.Append(winrt::make(L"$s", resourceLoader.GetString(L"DateTimeCheatSheet_Seconds"))); - m_dateTimeShortcuts.Append(winrt::make(L"$fff", resourceLoader.GetString(L"DateTimeCheatSheet_MilliSeconds3D"))); - m_dateTimeShortcuts.Append(winrt::make(L"$ff", resourceLoader.GetString(L"DateTimeCheatSheet_MilliSeconds2D"))); - m_dateTimeShortcuts.Append(winrt::make(L"$f", resourceLoader.GetString(L"DateTimeCheatSheet_MilliSeconds1D"))); - - InitializeComponent(); - } - - Windows::Foundation::Collections::IObservableVector MainWindow::SearchMRU() - { - return m_searchMRU; - } - - Windows::Foundation::Collections::IObservableVector MainWindow::ReplaceMRU() - { - return m_replaceMRU; - } - - winrt::Windows::Foundation::Collections::IObservableVector MainWindow::ExplorerItems() - { - return m_explorerItems; - } - - winrt::Windows::Foundation::Collections::IObservableVector MainWindow::SearchRegExShortcuts() - { - return m_searchRegExShortcuts; - } - - winrt::Windows::Foundation::Collections::IObservableVector MainWindow::DateTimeShortcuts() - { - return m_dateTimeShortcuts; - } - - Windows::UI::Xaml::Controls::AutoSuggestBox MainWindow::AutoSuggestBoxSearch() - { - return textBox_search(); - } - - Windows::UI::Xaml::Controls::AutoSuggestBox MainWindow::AutoSuggestBoxReplace() - { - return textBox_replace(); - } - - Windows::UI::Xaml::Controls::CheckBox MainWindow::CheckBoxRegex() - { - return checkBox_regex(); - } - - Windows::UI::Xaml::Controls::CheckBox MainWindow::CheckBoxCaseSensitive() - { - return checkBox_case(); - } - - Windows::UI::Xaml::Controls::CheckBox MainWindow::CheckBoxMatchAll() - { - return checkBox_matchAll(); - } - - Windows::UI::Xaml::Controls::ComboBox MainWindow::ComboBoxRenameParts() - { - return comboBox_renameParts(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonIncludeFiles() - { - return toggleButton_includeFiles(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonIncludeFolders() - { - return toggleButton_includeFolders(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonIncludeSubfolders() - { - return toggleButton_includeSubfolders(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonEnumerateItems() - { - return toggleButton_enumItems(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonUpperCase() - { - return toggleButton_upperCase(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonLowerCase() - { - return toggleButton_lowerCase(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonTitleCase() - { - return toggleButton_titleCase(); - } - - Windows::UI::Xaml::Controls::Primitives::ToggleButton MainWindow::ToggleButtonCapitalize() - { - return toggleButton_capitalize(); - } - - Windows::UI::Xaml::Controls::Button MainWindow::ButtonSettings() - { - return button_settings(); - } - - Windows::UI::Xaml::Controls::CheckBox MainWindow::CheckBoxSelectAll() - { - return checkBox_selectAll(); - } - - PowerRenameUILib::UIUpdates MainWindow::UIUpdatesItem() - { - return m_uiUpdatesItem; - } - - void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) - { - auto newItem = winrt::make(id, original, renamed, type, depth, checked); - m_explorerItems.Append(newItem); - m_explorerItemsMap[id] = newItem; - } - - void MainWindow::UpdateExplorerItem(int32_t id, hstring const& newName) - { - auto itemToUpdate = FindById(id); - if (itemToUpdate != NULL) - { - itemToUpdate.Renamed(newName); - } - } - - void MainWindow::UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName) - { - auto itemToUpdate = FindById(id); - if (itemToUpdate != NULL) - { - itemToUpdate.Original(newOriginalName); - itemToUpdate.Renamed(L""); - } - } - - void MainWindow::AppendSearchMRU(hstring const& value) - { - m_searchMRU.Append(value); - } - - void MainWindow::AppendReplaceMRU(hstring const& value) - { - m_replaceMRU.Append(value); - } - - PowerRenameUILib::ExplorerItem MainWindow::FindById(int32_t id) - { - return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL; - } - - void MainWindow::ToggleAll(bool checked) - { - std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); }); - } - - void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - auto checkbox = sender.as(); - auto id = std::stoi(std::wstring{ checkbox.Name() }); - auto item = FindById(id); - if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked()) - { - m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean()); - m_uiUpdatesItem.ChangedExplorerItemId(id); - } - } - - void MainWindow::SelectAll(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected) - { - ToggleAll(checkBox_selectAll().IsChecked().GetBoolean()); - m_uiUpdatesItem.ToggleAll(); - m_allSelected = !m_allSelected; - } - } - - void MainWindow::ShowAll(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - button_showAll().IsChecked(true); - button_showRenamed().IsChecked(false); - if (!m_uiUpdatesItem.ShowAll()) - { - m_explorerItems.Clear(); - m_explorerItemsMap.clear(); - m_uiUpdatesItem.ShowAll(true); - } - } - - void MainWindow::ShowRenamed(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - button_showRenamed().IsChecked(true); - button_showAll().IsChecked(false); - if (m_uiUpdatesItem.ShowAll()) - { - m_explorerItems.Clear(); - m_explorerItemsMap.clear(); - m_uiUpdatesItem.ShowAll(false); - } - } - - void MainWindow::RegExItemClick(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::Controls::ItemClickEventArgs const& e) - { - auto s = e.ClickedItem().try_as(); - RegExFlyout().Hide(); - textBox_search().Text(textBox_search().Text() + s->Code()); - } - - void MainWindow::DateTimeItemClick(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::Controls::ItemClickEventArgs const& e) - { - auto s = e.ClickedItem().try_as(); - DateTimeFlyout().Hide(); - textBox_replace().Text(textBox_replace().Text() + s->Code()); - } - - void MainWindow::button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const&, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const&) - { - m_uiUpdatesItem.CloseUIWindow(false); - m_uiUpdatesItem.Rename(); - } - - void MainWindow::MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - m_uiUpdatesItem.CloseUIWindow(true); - m_uiUpdatesItem.Rename(); - } - - void MainWindow::OpenDocs(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&) - { - Windows::System::Launcher::LaunchUriAsync(winrt::Windows::Foundation::Uri{ L"https://aka.ms/PowerToysOverview_PowerRename" }); - } -} diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.h b/src/modules/powerrename/PowerRenameUILib/MainWindow.h deleted file mode 100644 index 15e3bd05f21c..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include "winrt/Windows.UI.Xaml.h" -#include "winrt/Windows.UI.Xaml.Markup.h" -#include "winrt/Windows.UI.Xaml.Interop.h" -#include "winrt/Windows.UI.Xaml.Controls.Primitives.h" -#include "MainWindow.g.h" -#include "PatternSnippet.h" -#include "ExplorerItem.h" -#include - -namespace winrt::PowerRenameUILib::implementation -{ - struct MainWindow : MainWindowT - { - MainWindow(); - - Windows::Foundation::Collections::IObservableVector SearchMRU(); - Windows::Foundation::Collections::IObservableVector ReplaceMRU(); - winrt::Windows::Foundation::Collections::IObservableVector ExplorerItems(); - winrt::Windows::Foundation::Collections::IObservableVector SearchRegExShortcuts(); - winrt::Windows::Foundation::Collections::IObservableVector DateTimeShortcuts(); - - Windows::UI::Xaml::Controls::AutoSuggestBox AutoSuggestBoxSearch(); - Windows::UI::Xaml::Controls::AutoSuggestBox AutoSuggestBoxReplace(); - - Windows::UI::Xaml::Controls::CheckBox CheckBoxRegex(); - Windows::UI::Xaml::Controls::CheckBox CheckBoxCaseSensitive(); - Windows::UI::Xaml::Controls::CheckBox CheckBoxMatchAll(); - - Windows::UI::Xaml::Controls::ComboBox ComboBoxRenameParts(); - - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonIncludeFiles(); - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonIncludeFolders(); - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonIncludeSubfolders(); - - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonUpperCase(); - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonLowerCase(); - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonTitleCase(); - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonCapitalize(); - - Windows::UI::Xaml::Controls::Primitives::ToggleButton ToggleButtonEnumerateItems(); - - Windows::UI::Xaml::Controls::Button ButtonSettings(); - - Windows::UI::Xaml::Controls::CheckBox CheckBoxSelectAll(); - - PowerRenameUILib::UIUpdates UIUpdatesItem(); - - void AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked); - void UpdateExplorerItem(int32_t id, hstring const& newName); - void UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName); - void AppendSearchMRU(hstring const& value); - void AppendReplaceMRU(hstring const& value); - - void Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - void SelectAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - void ShowAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - void ShowRenamed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - - private: - bool m_allSelected; - PowerRenameUILib::UIUpdates m_uiUpdatesItem; - inline PowerRenameUILib::ExplorerItem FindById(int32_t id); - void ToggleAll(bool checked); - - winrt::Windows::Foundation::Collections::IObservableVector m_searchMRU; - winrt::Windows::Foundation::Collections::IObservableVector m_replaceMRU; - winrt::Windows::Foundation::Collections::IObservableVector m_explorerItems; - std::map m_explorerItemsMap; - winrt::Windows::Foundation::Collections::IObservableVector m_searchRegExShortcuts; - winrt::Windows::Foundation::Collections::IObservableVector m_dateTimeShortcuts; - - public: - void RegExItemClick(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::ItemClickEventArgs const& e); - void DateTimeItemClick(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::ItemClickEventArgs const& e); - void button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const& sender, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const& args); - void MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - void OpenDocs(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - }; -} - -namespace winrt::PowerRenameUILib::factory_implementation -{ - struct MainWindow : MainWindowT - { - }; -} diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.idl b/src/modules/powerrename/PowerRenameUILib/MainWindow.idl deleted file mode 100644 index 00c65a531ef0..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.idl +++ /dev/null @@ -1,63 +0,0 @@ -import "ExplorerItem.idl"; -import "PatternSnippet.idl"; - -namespace PowerRenameUILib -{ - runtimeclass UIUpdates : Windows.UI.Xaml.Data.INotifyPropertyChanged - { - UIUpdates(); - Boolean ShowAll; - Int32 ChangedExplorerItemId; - Boolean Checked; - void ToggleAll(); - Boolean CloseUIWindow(); - void CloseUIWindow(Boolean closeUIWindow); - Boolean ButtonRenameEnabled; - void Rename(); - String OriginalCount; - String RenamedCount; - } - - [default_interface] runtimeclass MainWindow : Windows.UI.Xaml.Controls.UserControl - { - MainWindow(); - - Windows.Foundation.Collections.IObservableVector SearchMRU { get; }; - Windows.Foundation.Collections.IObservableVector ReplaceMRU { get; }; - - Windows.Foundation.Collections.IObservableVector ExplorerItems { get; }; - Windows.Foundation.Collections.IObservableVector SearchRegExShortcuts { get; }; - Windows.Foundation.Collections.IObservableVector DateTimeShortcuts { get; }; - - Windows.UI.Xaml.Controls.AutoSuggestBox AutoSuggestBoxSearch { get; }; - Windows.UI.Xaml.Controls.AutoSuggestBox AutoSuggestBoxReplace { get; }; - - Windows.UI.Xaml.Controls.CheckBox CheckBoxRegex { get; }; - Windows.UI.Xaml.Controls.CheckBox CheckBoxCaseSensitive { get; }; - Windows.UI.Xaml.Controls.CheckBox CheckBoxMatchAll { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonEnumerateItems { get; }; - - Windows.UI.Xaml.Controls.ComboBox ComboBoxRenameParts { get; }; - - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonIncludeFiles { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonIncludeFolders { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonIncludeSubfolders { get; }; - - Windows.UI.Xaml.Controls.Button ButtonSettings { get; }; - - Windows.UI.Xaml.Controls.CheckBox CheckBoxSelectAll { get; }; - - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonUpperCase { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonLowerCase { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonTitleCase { get; }; - Windows.UI.Xaml.Controls.Primitives.ToggleButton ToggleButtonCapitalize { get; }; - - void AddExplorerItem(Int32 id, String original, String renamed, Int32 type, UInt32 depth, Boolean checked); - void UpdateExplorerItem(Int32 id, String newName); - void UpdateRenamedExplorerItem(Int32 id, String newOriginalName); - void AppendSearchMRU(String value); - void AppendReplaceMRU(String value); - - UIUpdates UIUpdatesItem { get; }; - } -} diff --git a/src/modules/powerrename/PowerRenameUILib/Package.appxmanifest b/src/modules/powerrename/PowerRenameUILib/Package.appxmanifest deleted file mode 100644 index ea55f633fe56..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/Package.appxmanifest +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - PowerRenameUILib - Microsoft Corporation - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.filters b/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.filters deleted file mode 100644 index 60d0472aaa9d..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.filters +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - - - - - - {e48dc53e-40b1-40cb-970a-f89935452892} - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.vcxproj b/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.vcxproj deleted file mode 100644 index 7374ad57afbf..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/PowerRenameUILib.vcxproj +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - true - true - true - true - {4642d596-723f-4bfc-894c-46811219ac4a} - PowerRenameUILib - PowerRenameUILib - en-US - 15.0 - true - Windows Store - 10.0 - 10.0.18362.0 - 10.0.18362.0 - normal - - - true - true - App - true - - - - - Debug - x64 - - - Release - x64 - - - - DynamicLibrary - v143 - v142 - v141 - v140 - Unicode - - - true - true - - - false - true - false - - - - - - - - - - - - - - - - - - - $(SolutionDir)$(Platform)\$(Configuration)\modules\$(ProjectName)\ - PowerToys.PowerRenameUILib - - - $(SolutionDir)$(Platform)\$(Configuration)\modules\$(ProjectName)\ - PowerToys.PowerRenameUILib - - - - Use - pch.h - $(IntDir)pch.pch - Level4 - %(AdditionalOptions) /bigobj - - /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) - WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions) - - - false - - - - - _DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - - - NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - true - true - - - - - - - MainWindow.xaml - Code - - - - App.xaml - - - - - - - Designer - - - Designer - - - - - Designer - - - - - - - - - - - - - - - - - MainWindow.xaml - Code - - - Create - - - App.xaml - - - - - - - - App.xaml - - - - MainWindow.xaml - Code - - - - - <_WildCardPRIResource Include="Strings\*\Resources.resw" /> - - - - - true - - - - false - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/PropertySheet.props b/src/modules/powerrename/PowerRenameUILib/PropertySheet.props deleted file mode 100644 index e34141b019cc..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/PropertySheet.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/app.base.h b/src/modules/powerrename/PowerRenameUILib/app.base.h deleted file mode 100644 index 1fe87fb61c1a..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/app.base.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -namespace winrt::PowerRenameUILib::implementation -{ - template - struct App_baseWithProvider : public App_base - { - using IXamlType = ::winrt::Windows::UI::Xaml::Markup::IXamlType; - IXamlType GetXamlType(::winrt::Windows::UI::Xaml::Interop::TypeName const& type) - { - return AppProvider()->GetXamlType(type); - } - IXamlType GetXamlType(::winrt::hstring const& fullName) - { - return AppProvider()->GetXamlType(fullName); - } - ::winrt::com_array<::winrt::Windows::UI::Xaml::Markup::XmlnsDefinition> GetXmlnsDefinitions() - { - return AppProvider()->GetXmlnsDefinitions(); - } - - private: - bool _contentLoaded{ false }; - winrt::com_ptr _appProvider; - winrt::com_ptr AppProvider() - { - if (!_appProvider) - { - _appProvider = winrt::make_self(); - } - return _appProvider; - } - }; - template - using AppT2 = App_baseWithProvider; -} diff --git a/src/modules/powerrename/PowerRenameUILib/packages.config b/src/modules/powerrename/PowerRenameUILib/packages.config deleted file mode 100644 index eaa2143ee521..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/pch.h b/src/modules/powerrename/PowerRenameUILib/pch.h deleted file mode 100644 index a8ce8a54e297..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/pch.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "winrt/Microsoft.UI.Xaml.Automation.Peers.h" -#include "winrt/Microsoft.UI.Xaml.Controls.Primitives.h" -#include "winrt/Microsoft.UI.Xaml.Controls.AnimatedVisuals.h" -#include "winrt/Microsoft.UI.Xaml.Media.h" -#include "winrt/Microsoft.UI.Xaml.XamlTypeInfo.h" diff --git a/src/modules/powerrename/PowerRenameUILib/placeholder.exe b/src/modules/powerrename/PowerRenameUILib/placeholder.exe deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/src/modules/powerrename/PowerRenameUILib/readme.txt b/src/modules/powerrename/PowerRenameUILib/readme.txt deleted file mode 100644 index 89043935e1d3..000000000000 --- a/src/modules/powerrename/PowerRenameUILib/readme.txt +++ /dev/null @@ -1,23 +0,0 @@ -======================================================================== - C++/WinRT PowerRenameUILib Project Overview -======================================================================== - -This project demonstrates how to get started writing XAML apps directly -with standard C++, using the C++/WinRT SDK component and XAML compiler -support to generate implementation headers from interface (IDL) files. -These headers can then be used to implement the local Windows Runtime -classes referenced in the app's XAML pages. - -Steps: -1. Create an interface (IDL) file to define any local Windows Runtime - classes referenced in the app's XAML pages. -2. Build the project once to generate implementation templates under - the "Generated Files" folder, as well as skeleton class definitions - under "Generated Files\sources". -3. Use the skeleton class definitions for reference to implement your - Windows Runtime classes. - -======================================================================== -Learn more about C++/WinRT here: -http://aka.ms/cppwinrt/ -======================================================================== diff --git a/src/modules/powerrename/dll/PowerRenameExt.base.rc b/src/modules/powerrename/dll/PowerRenameExt.base.rc index 5f99345c17c4..0b938242ea0c 100644 Binary files a/src/modules/powerrename/dll/PowerRenameExt.base.rc and b/src/modules/powerrename/dll/PowerRenameExt.base.rc differ diff --git a/src/modules/powerrename/dll/PowerRenameExt.vcxproj b/src/modules/powerrename/dll/PowerRenameExt.vcxproj index f75888727640..fb32bb2aa50b 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.vcxproj +++ b/src/modules/powerrename/dll/PowerRenameExt.vcxproj @@ -1,6 +1,6 @@  - + @@ -77,17 +77,17 @@ - - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + \ No newline at end of file diff --git a/src/modules/powerrename/dll/packages.config b/src/modules/powerrename/dll/packages.config index f93921797a45..fe730c73f988 100644 --- a/src/modules/powerrename/dll/packages.config +++ b/src/modules/powerrename/dll/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/src/modules/powerrename/lib/PowerRenameLib.vcxproj b/src/modules/powerrename/lib/PowerRenameLib.vcxproj index 519c368c07e3..13bca03ade3b 100644 --- a/src/modules/powerrename/lib/PowerRenameLib.vcxproj +++ b/src/modules/powerrename/lib/PowerRenameLib.vcxproj @@ -1,6 +1,6 @@  - + {51920F1F-C28C-4ADF-8660-4238766796C2} Win32Proj @@ -86,17 +86,17 @@ - - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + \ No newline at end of file diff --git a/src/modules/powerrename/lib/packages.config b/src/modules/powerrename/lib/packages.config index f93921797a45..fe730c73f988 100644 --- a/src/modules/powerrename/lib/packages.config +++ b/src/modules/powerrename/lib/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/src/modules/powerrename/testapp/PowerRenameTest.vcxproj b/src/modules/powerrename/testapp/PowerRenameTest.vcxproj index e488429d7e2e..d31c405fe699 100644 --- a/src/modules/powerrename/testapp/PowerRenameTest.vcxproj +++ b/src/modules/powerrename/testapp/PowerRenameTest.vcxproj @@ -1,6 +1,6 @@ - + 15.0 {A3935CF4-46C5-4A88-84D3-6B12E16E6BA2} @@ -78,17 +78,17 @@ - - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + \ No newline at end of file diff --git a/src/modules/powerrename/testapp/packages.config b/src/modules/powerrename/testapp/packages.config index f93921797a45..fe730c73f988 100644 --- a/src/modules/powerrename/testapp/packages.config +++ b/src/modules/powerrename/testapp/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/src/modules/powerrename/ui/App.idl b/src/modules/powerrename/ui/App.idl new file mode 100644 index 000000000000..c24fb0f13cad --- /dev/null +++ b/src/modules/powerrename/ui/App.idl @@ -0,0 +1,3 @@ +namespace PowerRenameUI +{ +} diff --git a/src/modules/powerrename/PowerRenameUILib/App.xaml b/src/modules/powerrename/ui/App.xaml similarity index 99% rename from src/modules/powerrename/PowerRenameUILib/App.xaml rename to src/modules/powerrename/ui/App.xaml index 1f569f296c26..d5e4cc81c6f4 100644 --- a/src/modules/powerrename/PowerRenameUILib/App.xaml +++ b/src/modules/powerrename/ui/App.xaml @@ -1,28 +1,27 @@ - + xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"> - - + - + diff --git a/src/modules/powerrename/ui/App.xaml.cpp b/src/modules/powerrename/ui/App.xaml.cpp new file mode 100644 index 000000000000..247a577d07b7 --- /dev/null +++ b/src/modules/powerrename/ui/App.xaml.cpp @@ -0,0 +1,86 @@ +#include "pch.h" + +#include "App.xaml.h" +#include "MainWindow.xaml.h" + +#include +#include + +using namespace winrt; +using namespace winrt::Microsoft::UI::Xaml; +using namespace winrt::Microsoft::UI::Xaml::Controls; +using namespace winrt::Microsoft::UI::Xaml::Navigation; +using namespace PowerRenameUI; +using namespace PowerRenameUI::implementation; + +// To learn more about WinUI, the WinUI project structure, +// and more about our project templates, see: http://aka.ms/winui-project-info. + +std::vector g_files; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + +#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION + UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e) + { + if (IsDebuggerPresent()) + { + auto errorMessage = e.Message(); + __debugbreak(); + } + }); +#endif +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs const&) +{ +#define BUFSIZE 4096 * 4 + + HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE); + if (hStdin == INVALID_HANDLE_VALUE) + { + // Logger::error(L"Invalid input handle."); + ExitProcess(1); + } + + BOOL bSuccess; + WCHAR chBuf[BUFSIZE]; + DWORD dwRead; + for (;;) + { + // Read from standard input and stop on error or no data. + bSuccess = ReadFile(hStdin, chBuf, BUFSIZE * sizeof(wchar_t), &dwRead, NULL); + + if (!bSuccess || dwRead == 0) + break; + + std::wstring inputBatch{ chBuf, dwRead / sizeof(wchar_t) }; + + std::wstringstream ss(inputBatch); + std::wstring item; + wchar_t delimiter = '?'; + while (std::getline(ss, item, delimiter)) + { + g_files.push_back(item); + } + + if (!bSuccess) + break; + } + + //Logger::debug(L"Starting PowerRename with {} files selected", files.size()); + + window = make(); + window.Activate(); +} \ No newline at end of file diff --git a/src/modules/powerrename/ui/App.xaml.h b/src/modules/powerrename/ui/App.xaml.h new file mode 100644 index 000000000000..4711abcd3541 --- /dev/null +++ b/src/modules/powerrename/ui/App.xaml.h @@ -0,0 +1,16 @@ +#pragma once + +#include "App.xaml.g.h" + +namespace winrt::PowerRenameUI::implementation +{ + struct App : AppT + { + App(); + + void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&); + + private: + winrt::Microsoft::UI::Xaml::Window window{ nullptr }; + }; +} diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/file.png b/src/modules/powerrename/ui/Assets/file.png similarity index 100% rename from src/modules/powerrename/PowerRenameUILib/Assets/file.png rename to src/modules/powerrename/ui/Assets/file.png diff --git a/src/modules/powerrename/PowerRenameUILib/Assets/folder.png b/src/modules/powerrename/ui/Assets/folder.png similarity index 100% rename from src/modules/powerrename/PowerRenameUILib/Assets/folder.png rename to src/modules/powerrename/ui/Assets/folder.png diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp b/src/modules/powerrename/ui/ExplorerItem.cpp similarity index 66% rename from src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp rename to src/modules/powerrename/ui/ExplorerItem.cpp index 1edb980375b2..7dff982e7567 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.cpp +++ b/src/modules/powerrename/ui/ExplorerItem.cpp @@ -7,13 +7,13 @@ namespace { const wchar_t folderImagePath[] = L"ms-appx:///Assets/folder.png"; } -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { ExplorerItem::ExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) : m_id{ id }, m_idStr{ std::to_wstring(id) }, m_original{ original }, m_renamed{ renamed }, m_type{ type }, m_depth{ depth }, m_checked{ checked } { m_imagePath = (m_type == static_cast(ExplorerItemType::Folder)) ? folderImagePath : fileImagePath; - m_highlight = m_checked && !m_renamed.empty() ? Windows::UI::Xaml::Visibility::Visible : Windows::UI::Xaml::Visibility::Collapsed; + m_highlight = m_checked && !m_renamed.empty() ? Microsoft::UI::Xaml::Visibility::Visible : Microsoft::UI::Xaml::Visibility::Collapsed; } int32_t ExplorerItem::Id() @@ -36,7 +36,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_original != value) { m_original = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Original" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Original" }); } } @@ -50,13 +50,13 @@ namespace winrt::PowerRenameUILib::implementation if (m_renamed != value) { m_renamed = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Renamed" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Renamed" }); - auto visibility = m_checked && !m_renamed.empty() ? Windows::UI::Xaml::Visibility::Visible : Windows::UI::Xaml::Visibility::Collapsed; + auto visibility = m_checked && !m_renamed.empty() ? Microsoft::UI::Xaml::Visibility::Visible : Microsoft::UI::Xaml::Visibility::Collapsed; if (m_highlight != visibility) { m_highlight = visibility; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Highlight" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Highlight" }); } } } @@ -80,7 +80,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_type != value) { m_type = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Type" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Type" }); } } @@ -94,23 +94,23 @@ namespace winrt::PowerRenameUILib::implementation if (m_checked != value) { m_checked = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Checked" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Checked" }); - auto visibility = m_checked && !m_renamed.empty() ? Windows::UI::Xaml::Visibility::Visible : Windows::UI::Xaml::Visibility::Collapsed; + auto visibility = m_checked && !m_renamed.empty() ? Microsoft::UI::Xaml::Visibility::Visible : Microsoft::UI::Xaml::Visibility::Collapsed; if (m_highlight != visibility) { m_highlight = visibility; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Highlight" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Highlight" }); } } } - winrt::Windows::UI::Xaml::Visibility ExplorerItem::Highlight() + Microsoft::UI::Xaml::Visibility ExplorerItem::Highlight() { return m_highlight; } - winrt::event_token ExplorerItem::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler) + winrt::event_token ExplorerItem::PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler) { return m_propertyChanged.add(handler); } diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h b/src/modules/powerrename/ui/ExplorerItem.h similarity index 63% rename from src/modules/powerrename/PowerRenameUILib/ExplorerItem.h rename to src/modules/powerrename/ui/ExplorerItem.h index 7480c228dab5..fdd3fbe93130 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.h +++ b/src/modules/powerrename/ui/ExplorerItem.h @@ -1,7 +1,7 @@ #pragma once #include "ExplorerItem.g.h" -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { struct ExplorerItem : ExplorerItemT { @@ -26,10 +26,9 @@ namespace winrt::PowerRenameUILib::implementation void Type(int32_t value); bool Checked(); void Checked(bool value); - winrt::Windows::UI::Xaml::Visibility Highlight(); - Windows::Foundation::Collections::IObservableVector Children(); - void Children(Windows::Foundation::Collections::IObservableVector const& value); - winrt::event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); + Microsoft::UI::Xaml::Visibility Highlight(); + Windows::Foundation::Collections::IObservableVector Children(); + winrt::event_token PropertyChanged(Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler); void PropertyChanged(winrt::event_token const& token) noexcept; private: @@ -39,14 +38,13 @@ namespace winrt::PowerRenameUILib::implementation winrt::hstring m_renamed; uint32_t m_depth; hstring m_imagePath; - winrt::Windows::Foundation::Collections::IObservableVector m_children; int32_t m_type; bool m_checked; - winrt::Windows::UI::Xaml::Visibility m_highlight; - winrt::event m_propertyChanged; + Microsoft::UI::Xaml::Visibility m_highlight; + winrt::event m_propertyChanged; }; } -namespace winrt::PowerRenameUILib::factory_implementation +namespace winrt::PowerRenameUI::factory_implementation { struct ExplorerItem : ExplorerItemT { diff --git a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl b/src/modules/powerrename/ui/ExplorerItem.idl similarity index 70% rename from src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl rename to src/modules/powerrename/ui/ExplorerItem.idl index cc13b8280dc3..88c4d47c3493 100644 --- a/src/modules/powerrename/PowerRenameUILib/ExplorerItem.idl +++ b/src/modules/powerrename/ui/ExplorerItem.idl @@ -1,6 +1,6 @@ -namespace PowerRenameUILib +namespace PowerRenameUI { - runtimeclass ExplorerItem : Windows.UI.Xaml.Data.INotifyPropertyChanged + runtimeclass ExplorerItem : Microsoft.UI.Xaml.Data.INotifyPropertyChanged { ExplorerItem(); ExplorerItem(Int32 id, String original, String renamed, Int32 type, UInt32 depth, Boolean checked); @@ -12,6 +12,6 @@ namespace PowerRenameUILib String ImagePath { get; }; Int32 Type; Boolean Checked; - Windows.UI.Xaml.Visibility Highlight { get; }; + Microsoft.UI.Xaml.Visibility Highlight { get; }; } } diff --git a/src/modules/powerrename/ui/MainWindow.idl b/src/modules/powerrename/ui/MainWindow.idl new file mode 100644 index 000000000000..c5eeb5756cb3 --- /dev/null +++ b/src/modules/powerrename/ui/MainWindow.idl @@ -0,0 +1,27 @@ +import "ExplorerItem.idl"; +import "PatternSnippet.idl"; +import "UIUpdates.idl"; + +namespace PowerRenameUI +{ + [default_interface] runtimeclass MainWindow : Microsoft.UI.Xaml.Window + { + MainWindow(); + + Windows.Foundation.Collections.IObservableVector SearchMRU { get; }; + Windows.Foundation.Collections.IObservableVector ReplaceMRU { get; }; + + Windows.Foundation.Collections.IObservableVector ExplorerItems { get; }; + Windows.Foundation.Collections.IObservableVector SearchRegExShortcuts { get; }; + Windows.Foundation.Collections.IObservableVector DateTimeShortcuts { get; }; + + UIUpdates UIUpdatesItem { get; }; + + void AddExplorerItem(Int32 id, String original, String renamed, Int32 type, UInt32 depth, Boolean checked); + void UpdateExplorerItem(Int32 id, String newName); + void UpdateRenamedExplorerItem(Int32 id, String newOriginalName); + void AppendSearchMRU(String value); + void AppendReplaceMRU(String value); + + } +} diff --git a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml b/src/modules/powerrename/ui/MainWindow.xaml similarity index 58% rename from src/modules/powerrename/PowerRenameUILib/MainWindow.xaml rename to src/modules/powerrename/ui/MainWindow.xaml index a8e00be8a023..7ac4de7da00a 100644 --- a/src/modules/powerrename/PowerRenameUILib/MainWindow.xaml +++ b/src/modules/powerrename/ui/MainWindow.xaml @@ -1,8 +1,19 @@ - + - + + @@ -40,14 +51,14 @@ - + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - Filename + extension - Filename only - Extension only - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Filename + extension + Filename only + Extension only + + + + + - + + + + + + + + + + + + + + + + - + - - + + @@ -367,4 +378,4 @@ --> - \ No newline at end of file + diff --git a/src/modules/powerrename/ui/MainWindow.xaml.cpp b/src/modules/powerrename/ui/MainWindow.xaml.cpp new file mode 100644 index 000000000000..a5e91f1c349e --- /dev/null +++ b/src/modules/powerrename/ui/MainWindow.xaml.cpp @@ -0,0 +1,1029 @@ +#include "pch.h" +#include "MainWindow.xaml.h" +#if __has_include("MainWindow.g.cpp") +#include "MainWindow.g.cpp" +#endif + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "microsoft.ui.xaml.window.h" +#include +#include + +using namespace winrt; +using namespace Windows::UI::Xaml; +using namespace winrt::Microsoft::Windows::ApplicationModel::Resources; + +#define MAX_LOADSTRING 100 + +// Non-localizable +const std::wstring moduleName = L"PowerRename"; +const std::wstring PowerRenameUIIco = L"PowerRenameUI.ico"; +const std::wstring internalPath = L""; +const wchar_t c_WindowClass[] = L"PowerRename"; +HINSTANCE g_hostHInst; + +extern std::vector g_files; + +namespace winrt::PowerRenameUI::implementation +{ + MainWindow::MainWindow() : + m_instance{ nullptr }, m_allSelected{ true }, m_managerEvents{ this } + { + + auto windowNative{ this->try_as<::IWindowNative>() }; + winrt::check_bool(windowNative); + windowNative->get_WindowHandle(&m_window); + Microsoft::UI::WindowId windowId = + Microsoft::UI::GetWindowIdFromWindow(m_window); + + Microsoft::UI::Windowing::AppWindow appWindow = + Microsoft::UI::Windowing::AppWindow::GetFromWindowId(windowId); + appWindow.SetIcon(PowerRenameUIIco); + + Title(hstring{ moduleName }); + + m_searchMRUList = winrt::single_threaded_observable_vector(); + m_replaceMRUList = winrt::single_threaded_observable_vector(); + + m_explorerItems = winrt::single_threaded_observable_vector(); + + m_searchRegExShortcuts = winrt::single_threaded_observable_vector(); + auto factory = winrt::get_activation_factory(); + ResourceManager manager = factory.CreateInstance(L"resources.pri"); + + m_searchRegExShortcuts.Append(winrt::make(L".", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchAny").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\d", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchDigit").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\D", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchNonDigit").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\w", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchNonWS").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\S", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchWordChar").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\S+", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchOneOrMoreWS").ValueAsString())); + m_searchRegExShortcuts.Append(winrt::make(L"\\b", manager.MainResourceMap().GetValue(L"Resources/RegExCheatSheet_MatchWordBoundary").ValueAsString())); + + m_dateTimeShortcuts = winrt::single_threaded_observable_vector(); + m_dateTimeShortcuts.Append(winrt::make(L"$YYYY", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_FullYear").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$YY", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_YearLastTwoDigits").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$Y", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_YearLastDigit").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$MMMM", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MonthName").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$MMM", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MonthNameAbbr").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$MM", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MonthDigitLZero").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$M", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MonthDigit").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$DDDD", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_DayName").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$DDD", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_DayNameAbbr").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$DD", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_DayDigitLZero").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$D", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_DayDigit").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$hh", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_HoursLZero").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$h", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_Hours").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$mm", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MinutesLZero").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$m", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_Minutes").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$ss", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_SecondsLZero").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$s", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_Seconds").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$fff", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MilliSeconds3D").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$ff", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MilliSeconds2D").ValueAsString())); + m_dateTimeShortcuts.Append(winrt::make(L"$f", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MilliSeconds1D").ValueAsString())); + + InitializeComponent(); + + if (SUCCEEDED(CPowerRenameManager::s_CreateInstance(&m_prManager))) + { + // Create the factory for our items + CComPtr prItemFactory; + if (SUCCEEDED(CPowerRenameItem::s_CreateInstance(nullptr, IID_PPV_ARGS(&prItemFactory)))) + { + if (SUCCEEDED(m_prManager->PutRenameItemFactory(prItemFactory))) + { + if (SUCCEEDED(m_prManager->Advise(&m_managerEvents, &m_cookie))) + { + CComPtr shellItemArray; + // To test PowerRename uncomment this line and update the path to + // your local (absolute or relative) path which you want to see in PowerRename + // files.push_back(); + + if (!g_files.empty()) + { + if (SUCCEEDED(CreateShellItemArrayFromPaths(g_files, &shellItemArray))) + { + CComPtr enumShellItems; + if (SUCCEEDED(shellItemArray->EnumItems(&enumShellItems))) + { + EnumerateShellItems(enumShellItems); + } + } + } + else + { + Logger::warn(L"No items selected to be renamed."); + } + } + } + } + else + { + Logger::error(L"Error creating PowerRenameItemFactory"); + } + } + else + { + Logger::error(L"Error creating PowerRenameManager"); + } + try + { + PopulateExplorerItems(); + UpdateCounts(); + SetHandlers(); + ReadSettings(); + } + catch (std::exception e) + { + Logger::error("Exception thrown during explorer items population: {}", std::string{ e.what() }); + } + + m_uiUpdatesItem.ButtonRenameEnabled(false); + InitAutoComplete(); + SearchReplaceChanged(); + } + + void MainWindow::AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked) + { + auto newItem = winrt::make(id, original, renamed, type, depth, checked); + m_explorerItems.Append(newItem); + m_explorerItemsMap[id] = newItem; + } + + void MainWindow::UpdateExplorerItem(int32_t id, hstring const& newName) + { + auto itemToUpdate = FindById(id); + if (itemToUpdate != NULL) + { + itemToUpdate.Renamed(newName); + } + } + + void MainWindow::UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName) + { + auto itemToUpdate = FindById(id); + if (itemToUpdate != NULL) + { + itemToUpdate.Original(newOriginalName); + itemToUpdate.Renamed(L""); + } + } + + void MainWindow::AppendSearchMRU(hstring const& value) + { + m_searchMRUList.Append(value); + } + + void MainWindow::AppendReplaceMRU(hstring const& value) + { + m_replaceMRUList.Append(value); + } + + PowerRenameUI::ExplorerItem MainWindow::FindById(int32_t id) + { + return m_explorerItemsMap.contains(id) ? m_explorerItemsMap[id] : NULL; + } + + void MainWindow::ToggleAll(bool checked) + { + std::for_each(m_explorerItems.begin(), m_explorerItems.end(), [checked](auto item) { item.Checked(checked); }); + } + + void MainWindow::Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + auto checkbox = sender.as(); + auto id = std::stoi(std::wstring{ checkbox.Name() }); + auto item = FindById(id); + if (item != NULL && checkbox.IsChecked().GetBoolean() != item.Checked()) + { + m_uiUpdatesItem.Checked(checkbox.IsChecked().GetBoolean()); + m_uiUpdatesItem.ChangedExplorerItemId(id); + } + } + + void MainWindow::SelectAll(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + if (checkBox_selectAll().IsChecked().GetBoolean() != m_allSelected) + { + ToggleAll(checkBox_selectAll().IsChecked().GetBoolean()); + m_uiUpdatesItem.ToggleAll(); + m_allSelected = !m_allSelected; + } + } + + void MainWindow::ShowAll(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + button_showAll().IsChecked(true); + button_showRenamed().IsChecked(false); + if (!m_uiUpdatesItem.ShowAll()) + { + m_explorerItems.Clear(); + m_explorerItemsMap.clear(); + m_uiUpdatesItem.ShowAll(true); + } + } + + void MainWindow::ShowRenamed(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + button_showRenamed().IsChecked(true); + button_showAll().IsChecked(false); + if (m_uiUpdatesItem.ShowAll()) + { + m_explorerItems.Clear(); + m_explorerItemsMap.clear(); + m_uiUpdatesItem.ShowAll(false); + } + } + + void MainWindow::RegExItemClick(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::Controls::ItemClickEventArgs const& e) + { + auto s = e.ClickedItem().try_as(); + } + + void MainWindow::DateTimeItemClick(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::Controls::ItemClickEventArgs const& e) + { + auto s = e.ClickedItem().try_as(); + } + + void MainWindow::button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const&, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const&) + { + m_uiUpdatesItem.CloseUIWindow(false); + m_uiUpdatesItem.Rename(); + } + + void MainWindow::MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + m_uiUpdatesItem.CloseUIWindow(true); + m_uiUpdatesItem.Rename(); + } + + void MainWindow::OpenDocs(winrt::Windows::Foundation::IInspectable const&, winrt::Microsoft::UI::Xaml::RoutedEventArgs const&) + { + Windows::System::Launcher::LaunchUriAsync(winrt::Windows::Foundation::Uri{ L"https://aka.ms/PowerToysOverview_PowerRename" }); + } + + HRESULT MainWindow::CreateShellItemArrayFromPaths( + std::vector files, + IShellItemArray** shellItemArray) + { + _TRACER_; + + *shellItemArray = nullptr; + PIDLIST_ABSOLUTE* itemList = nullptr; + itemList = new (std::nothrow) PIDLIST_ABSOLUTE[files.size()]; + HRESULT hr = itemList ? S_OK : E_OUTOFMEMORY; + UINT itemsCnt = 0; + for (const auto& file : files) + { + const DWORD BUFSIZE = 4096; + TCHAR buffer[BUFSIZE] = TEXT(""); + auto retval = GetFullPathName(file.c_str(), BUFSIZE, buffer, NULL); + if (retval != 0 && PathFileExists(buffer)) + { + hr = SHParseDisplayName(buffer, nullptr, &itemList[itemsCnt], 0, nullptr); + ++itemsCnt; + } + } + if (SUCCEEDED(hr) && itemsCnt > 0) + { + hr = SHCreateShellItemArrayFromIDLists(itemsCnt, const_cast(itemList), shellItemArray); + if (SUCCEEDED(hr)) + { + for (UINT i = 0; i < itemsCnt; i++) + { + CoTaskMemFree(itemList[i]); + } + } + else + { + Logger::error(L"Creating ShellItemArray from path list failed."); + } + } + else + { + Logger::error(L"Parsing path list display names failed."); + hr = E_FAIL; + } + + delete[] itemList; + return hr; + } + + void MainWindow::PopulateExplorerItems() + { + _TRACER_; + + UINT count = 0; + m_prManager->GetVisibleItemCount(&count); + Logger::debug(L"Number of visible items: {}", count); + + for (UINT i = 0; i < count; ++i) + { + CComPtr renameItem; + if (SUCCEEDED(m_prManager->GetVisibleItemByIndex(i, &renameItem))) + { + int id = 0; + renameItem->GetId(&id); + + PWSTR originalName = nullptr; + renameItem->GetOriginalName(&originalName); + PWSTR newName = nullptr; + renameItem->GetNewName(&newName); + + bool selected; + renameItem->GetSelected(&selected); + + UINT depth = 0; + renameItem->GetDepth(&depth); + + bool isFolder = false; + winrt::check_hresult(renameItem->GetIsFolder(&isFolder)); + + AddExplorerItem( + id, originalName, newName == nullptr ? hstring{} : hstring{ newName }, isFolder ? 0 : 1, depth, selected); + } + } + } + + HRESULT MainWindow::InitAutoComplete() + { + _TRACER_; + + HRESULT hr = S_OK; + if (CSettingsInstance().GetMRUEnabled()) + { + hr = CPowerRenameMRU::CPowerRenameMRUSearch_CreateInstance(&m_searchMRU); + if (SUCCEEDED(hr)) + { + for (const auto& item : m_searchMRU->GetMRUStrings()) + { + if (!item.empty()) + { + AppendSearchMRU(hstring{ item }); + } + } + } + + if (SUCCEEDED(hr)) + { + hr = CPowerRenameMRU::CPowerRenameMRUReplace_CreateInstance(&m_replaceMRU); + if (SUCCEEDED(hr)) + { + for (const auto& item : m_replaceMRU->GetMRUStrings()) + { + if (!item.empty()) + { + AppendReplaceMRU(hstring{ item }); + } + } + } + } + } + + return hr; + } + + HRESULT MainWindow::EnumerateShellItems(_In_ IEnumShellItems* enumShellItems) + { + _TRACER_; + + HRESULT hr = S_OK; + // Enumerate the data object and populate the manager + if (m_prManager) + { + m_disableCountUpdate = true; + + // Ensure we re-create the enumerator + m_prEnum = nullptr; + hr = CPowerRenameEnum::s_CreateInstance(nullptr, m_prManager, IID_PPV_ARGS(&m_prEnum)); + if (SUCCEEDED(hr)) + { + hr = m_prEnum->Start(enumShellItems); + } + + m_disableCountUpdate = false; + } + + return hr; + } + + void MainWindow::SearchReplaceChanged(bool forceRenaming) + { + _TRACER_; + + Logger::debug(L"Forced renaming - {}", forceRenaming); + // Pass updated search and replace terms to the IPowerRenameRegEx handler + CComPtr prRegEx; + if (m_prManager && SUCCEEDED(m_prManager->GetRenameRegEx(&prRegEx))) + { + winrt::hstring searchTerm = textBox_search().Text(); + prRegEx->PutSearchTerm(searchTerm.c_str(), forceRenaming); + + winrt::hstring replaceTerm = textBox_replace().Text(); + prRegEx->PutReplaceTerm(replaceTerm.c_str(), forceRenaming); + } + } + + void MainWindow::ValidateFlags(PowerRenameFlags flag) + { + if (flag == Uppercase) + { + if (toggleButton_upperCase().IsChecked()) + { + toggleButton_lowerCase().IsChecked(false); + toggleButton_titleCase().IsChecked(false); + toggleButton_capitalize().IsChecked(false); + } + } + else if (flag == Lowercase) + { + if (toggleButton_lowerCase().IsChecked()) + { + toggleButton_upperCase().IsChecked(false); + toggleButton_titleCase().IsChecked(false); + toggleButton_capitalize().IsChecked(false); + } + } + else if (flag == Titlecase) + { + if (toggleButton_titleCase().IsChecked()) + { + toggleButton_upperCase().IsChecked(false); + toggleButton_lowerCase().IsChecked(false); + toggleButton_capitalize().IsChecked(false); + } + } + else if (flag == Capitalized) + { + if (toggleButton_capitalize().IsChecked()) + { + toggleButton_upperCase().IsChecked(false); + toggleButton_lowerCase().IsChecked(false); + toggleButton_titleCase().IsChecked(false); + } + } + + m_flagValidationInProgress = true; + } + + void MainWindow::UpdateFlag(PowerRenameFlags flag, UpdateFlagCommand command) + { + _TRACER_; + + DWORD flags{}; + m_prManager->GetFlags(&flags); + + if (command == UpdateFlagCommand::Set) + { + flags |= flag; + } + else if (command == UpdateFlagCommand::Reset) + { + flags &= ~flag; + } + + Logger::debug(L"Flag {} " + std::wstring{ command == UpdateFlagCommand::Set ? L"set" : L"reset" }, flag); + + // Ensure we update flags + if (m_prManager) + { + m_prManager->PutFlags(flags); + } + } + + void MainWindow::SetHandlers() + { + _TRACER_; + + m_uiUpdatesItem.PropertyChanged([&](auto const&, auto const& e) { + std::wstring property{ e.PropertyName() }; + if (property == L"ShowAll") + { + SwitchView(); + } + else if (property == L"ChangedItemId") + { + ToggleItem(m_uiUpdatesItem.ChangedExplorerItemId(), m_uiUpdatesItem.Checked()); + } + else if (property == L"ToggleAll") + { + ToggleAll(); + } + else if (property == L"Rename") + { + Rename(m_uiUpdatesItem.CloseUIWindow()); + } + }); + + // AutoSuggestBox Search + textBox_search().TextChanged([&](auto const&, auto const&) { + SearchReplaceChanged(); + }); + + // AutoSuggestBox Replace + textBox_replace().TextChanged([&](auto const&, auto const&) { + SearchReplaceChanged(); + }); + + // ToggleButton UpperCase + toggleButton_upperCase().Checked([&](auto const&, auto const&) { + ValidateFlags(Uppercase); + UpdateFlag(Uppercase, UpdateFlagCommand::Set); + }); + toggleButton_upperCase().Unchecked([&](auto const&, auto const&) { + UpdateFlag(Uppercase, UpdateFlagCommand::Reset); + }); + + // ToggleButton LowerCase + toggleButton_lowerCase().Checked([&](auto const&, auto const&) { + ValidateFlags(Lowercase); + UpdateFlag(Lowercase, UpdateFlagCommand::Set); + }); + toggleButton_lowerCase().Unchecked([&](auto const&, auto const&) { + UpdateFlag(Lowercase, UpdateFlagCommand::Reset); + }); + + // ToggleButton TitleCase + toggleButton_titleCase().Checked([&](auto const&, auto const&) { + ValidateFlags(Titlecase); + UpdateFlag(Titlecase, UpdateFlagCommand::Set); + }); + toggleButton_titleCase().Unchecked([&](auto const&, auto const&) { + UpdateFlag(Titlecase, UpdateFlagCommand::Reset); + }); + + // ToggleButton Capitalize + toggleButton_capitalize().Checked([&](auto const&, auto const&) { + ValidateFlags(Capitalized); + UpdateFlag(Capitalized, UpdateFlagCommand::Set); + }); + toggleButton_capitalize().Unchecked([&](auto const&, auto const&) { + UpdateFlag(Capitalized, UpdateFlagCommand::Reset); + }); + + // CheckBox Regex + checkBox_regex().Checked([&](auto const&, auto const&) { + ValidateFlags(UseRegularExpressions); + UpdateFlag(UseRegularExpressions, UpdateFlagCommand::Set); + }); + checkBox_regex().Unchecked([&](auto const&, auto const&) { + UpdateFlag(UseRegularExpressions, UpdateFlagCommand::Reset); + }); + + // CheckBox CaseSensitive + checkBox_case().Checked([&](auto const&, auto const&) { + ValidateFlags(CaseSensitive); + UpdateFlag(CaseSensitive, UpdateFlagCommand::Set); + }); + checkBox_case().Unchecked([&](auto const&, auto const&) { + UpdateFlag(CaseSensitive, UpdateFlagCommand::Reset); + }); + + // ComboBox RenameParts + comboBox_renameParts().SelectionChanged([&](auto const&, auto const&) { + int selectedIndex = comboBox_renameParts().SelectedIndex(); + if (selectedIndex == 0) + { // Filename + extension + UpdateFlag(NameOnly, UpdateFlagCommand::Reset); + UpdateFlag(ExtensionOnly, UpdateFlagCommand::Reset); + } + else if (selectedIndex == 1) // Filename Only + { + ValidateFlags(NameOnly); + UpdateFlag(ExtensionOnly, UpdateFlagCommand::Reset); + UpdateFlag(NameOnly, UpdateFlagCommand::Set); + } + else if (selectedIndex == 2) // Extension Only + { + ValidateFlags(ExtensionOnly); + UpdateFlag(NameOnly, UpdateFlagCommand::Reset); + UpdateFlag(ExtensionOnly, UpdateFlagCommand::Set); + } + }); + + // CheckBox MatchAllOccurences + checkBox_matchAll().Checked([&](auto const&, auto const&) { + ValidateFlags(MatchAllOccurences); + UpdateFlag(MatchAllOccurences, UpdateFlagCommand::Set); + }); + checkBox_matchAll().Unchecked([&](auto const&, auto const&) { + UpdateFlag(MatchAllOccurences, UpdateFlagCommand::Reset); + }); + + // ToggleButton IncludeFiles + toggleButton_includeFiles().Checked([&](auto const&, auto const&) { + ValidateFlags(ExcludeFiles); + UpdateFlag(ExcludeFiles, UpdateFlagCommand::Reset); + }); + toggleButton_includeFiles().Unchecked([&](auto const&, auto const&) { + UpdateFlag(ExcludeFiles, UpdateFlagCommand::Set); + }); + + // ToggleButton IncludeFolders + toggleButton_includeFolders().Checked([&](auto const&, auto const&) { + ValidateFlags(ExcludeFolders); + UpdateFlag(ExcludeFolders, UpdateFlagCommand::Reset); + }); + toggleButton_includeFolders().Unchecked([&](auto const&, auto const&) { + UpdateFlag(ExcludeFolders, UpdateFlagCommand::Set); + }); + + // ToggleButton IncludeSubfolders + toggleButton_includeSubfolders().Checked([&](auto const&, auto const&) { + ValidateFlags(ExcludeSubfolders); + UpdateFlag(ExcludeSubfolders, UpdateFlagCommand::Reset); + }); + toggleButton_includeSubfolders().Unchecked([&](auto const&, auto const&) { + UpdateFlag(ExcludeSubfolders, UpdateFlagCommand::Set); + }); + + // CheckBox EnumerateItems + toggleButton_enumItems().Checked([&](auto const&, auto const&) { + ValidateFlags(EnumerateItems); + UpdateFlag(EnumerateItems, UpdateFlagCommand::Set); + }); + toggleButton_enumItems().Unchecked([&](auto const&, auto const&) { + UpdateFlag(EnumerateItems, UpdateFlagCommand::Reset); + }); + + // ButtonSettings + button_settings().Click([&](auto const&, auto const&) { + OpenSettingsApp(); + }); + } + + void MainWindow::ToggleItem(int32_t id, bool checked) + { + _TRACER_; + Logger::debug(L"Toggling item with id = {}", id); + CComPtr spItem; + + if (SUCCEEDED(m_prManager->GetItemById(id, &spItem))) + { + spItem->PutSelected(checked); + } + UpdateCounts(); + } + + void MainWindow::ToggleAll() + { + _TRACER_; + + UINT itemCount = 0; + m_prManager->GetItemCount(&itemCount); + bool selected = checkBox_selectAll().IsChecked().GetBoolean(); + for (UINT i = 0; i < itemCount; i++) + { + CComPtr spItem; + if (SUCCEEDED(m_prManager->GetItemByIndex(i, &spItem))) + { + spItem->PutSelected(selected); + } + } + UpdateCounts(); + } + + void MainWindow::SwitchView() + { + _TRACER_; + + m_prManager->SwitchFilter(0); + PopulateExplorerItems(); + UpdateCounts(); + } + + void MainWindow::Rename(bool closeWindow) + { + _TRACER_; + + if (m_prManager) + { + m_prManager->Rename(m_window, closeWindow); + } + + // Persist the current settings. We only do this when + // a rename is actually performed. Not when the user + // closes/cancels the dialog. + WriteSettings(); + } + + HRESULT MainWindow::ReadSettings() + { + _TRACER_; + + bool persistState{ CSettingsInstance().GetPersistState() }; + Logger::debug(L"ReadSettings with persistState = {}", persistState); + + // Check if we should read flags from settings + // or the defaults from the manager. + DWORD flags = 0; + if (persistState) + { + flags = CSettingsInstance().GetFlags(); + + textBox_search().Text(CSettingsInstance().GetSearchText().c_str()); + textBox_replace().Text(CSettingsInstance().GetReplaceText().c_str()); + } + else + { + m_prManager->GetFlags(&flags); + } + + m_prManager->PutFlags(flags); + SetCheckboxesFromFlags(flags); + + return S_OK; + } + + HRESULT MainWindow::WriteSettings() + { + _TRACER_; + + // Check if we should store our settings + if (CSettingsInstance().GetPersistState()) + { + DWORD flags = 0; + m_prManager->GetFlags(&flags); + CSettingsInstance().SetFlags(flags); + + winrt::hstring searchTerm = textBox_search().Text(); + CSettingsInstance().SetSearchText(std::wstring{ searchTerm }); + + if (CSettingsInstance().GetMRUEnabled() && m_searchMRU) + { + CComPtr spSearchMRU; + if (SUCCEEDED(m_searchMRU->QueryInterface(IID_PPV_ARGS(&spSearchMRU)))) + { + spSearchMRU->AddMRUString(searchTerm.c_str()); + } + } + + winrt::hstring replaceTerm = textBox_replace().Text(); + CSettingsInstance().SetReplaceText(std::wstring{ replaceTerm }); + + if (CSettingsInstance().GetMRUEnabled() && m_replaceMRU) + { + CComPtr spReplaceMRU; + if (SUCCEEDED(m_replaceMRU->QueryInterface(IID_PPV_ARGS(&spReplaceMRU)))) + { + spReplaceMRU->AddMRUString(replaceTerm.c_str()); + } + } + + Trace::SettingsChanged(); + } + + return S_OK; + } + + HRESULT MainWindow::OpenSettingsApp() + { + std::wstring path = get_module_folderpath(g_hostHInst); + path += L"\\..\\..\\PowerToys.exe"; + + std::wstring openSettings = L"--open-settings=PowerRename"; + + CString commandLine; + commandLine.Format(_T("\"%s\""), path.c_str()); + commandLine.AppendFormat(_T(" %s"), openSettings.c_str()); + + int nSize = commandLine.GetLength() + 1; + LPTSTR lpszCommandLine = new TCHAR[nSize]; + _tcscpy_s(lpszCommandLine, nSize, commandLine); + + STARTUPINFO startupInfo; + ZeroMemory(&startupInfo, sizeof(STARTUPINFO)); + startupInfo.cb = sizeof(STARTUPINFO); + startupInfo.wShowWindow = SW_SHOWNORMAL; + + PROCESS_INFORMATION processInformation; + + // Start the resizer + CreateProcess( + NULL, + lpszCommandLine, + NULL, + NULL, + TRUE, + 0, + NULL, + NULL, + &startupInfo, + &processInformation); + + delete[] lpszCommandLine; + + if (!CloseHandle(processInformation.hProcess)) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + if (!CloseHandle(processInformation.hThread)) + { + return HRESULT_FROM_WIN32(GetLastError()); + } + return S_OK; + } + + void MainWindow::SetCheckboxesFromFlags(DWORD flags) + { + if (flags & CaseSensitive) + { + checkBox_case().IsChecked(true); + } + if (flags & MatchAllOccurences) + { + checkBox_matchAll().IsChecked(true); + } + if (flags & UseRegularExpressions) + { + checkBox_regex().IsChecked(true); + } + if (flags & EnumerateItems) + { + toggleButton_enumItems().IsChecked(true); + } + if (flags & ExcludeFiles) + { + toggleButton_includeFiles().IsChecked(false); + } + if (flags & ExcludeFolders) + { + toggleButton_includeFolders().IsChecked(false); + } + if (flags & ExcludeSubfolders) + { + toggleButton_includeSubfolders().IsChecked(false); + } + if (flags & NameOnly) + { + comboBox_renameParts().SelectedIndex(1); + } + else if (flags & ExtensionOnly) + { + comboBox_renameParts().SelectedIndex(2); + } + if (flags & Uppercase) + { + toggleButton_upperCase().IsChecked(true); + } + else if (flags & Lowercase) + { + toggleButton_lowerCase().IsChecked(true); + } + else if (flags & Titlecase) + { + toggleButton_titleCase().IsChecked(true); + } + else if (flags & Capitalized) + { + toggleButton_capitalize().IsChecked(true); + } + } + + void MainWindow::UpdateCounts() + { + // This method is CPU intensive. We disable it during certain operations + // for performance reasons. + if (m_disableCountUpdate) + { + return; + } + + UINT selectedCount = 0; + UINT renamingCount = 0; + if (m_prManager) + { + m_prManager->GetSelectedItemCount(&selectedCount); + m_prManager->GetRenameItemCount(&renamingCount); + } + + if (m_selectedCount != selectedCount || + m_renamingCount != renamingCount) + { + m_selectedCount = selectedCount; + m_renamingCount = renamingCount; + + // Update Rename button state + m_uiUpdatesItem.ButtonRenameEnabled(renamingCount > 0); + } + + m_uiUpdatesItem.OriginalCount(std::to_wstring(m_explorerItems.Size())); + m_uiUpdatesItem.RenamedCount(std::to_wstring(m_renamingCount)); + } + + HRESULT MainWindow::OnItemAdded(_In_ IPowerRenameItem*) + { + return S_OK; + } + + HRESULT MainWindow::OnUpdate(_In_ IPowerRenameItem* renameItem) + { + int id; + HRESULT hr = renameItem->GetId(&id); + if (SUCCEEDED(hr)) + { + PWSTR newName = nullptr; + hr = renameItem->GetNewName(&newName); + if (SUCCEEDED(hr)) + { + hstring newNameStr = newName == nullptr ? hstring{} : newName; + UpdateExplorerItem(id, newNameStr); + } + } + + return S_OK; + } + + HRESULT MainWindow::OnRename(_In_ IPowerRenameItem* renameItem) + { + int id; + HRESULT hr = renameItem->GetId(&id); + if (SUCCEEDED(hr)) + { + PWSTR newName = nullptr; + hr = renameItem->GetOriginalName(&newName); + if (SUCCEEDED(hr)) + { + hstring newNameStr = newName == nullptr ? hstring{} : newName; + UpdateRenamedExplorerItem(id, newNameStr); + } + } + + UpdateCounts(); + return S_OK; + } + + HRESULT MainWindow::OnError(_In_ IPowerRenameItem*) + { + return S_OK; + } + + HRESULT MainWindow::OnRegExStarted(_In_ DWORD) + { + return S_OK; + } + + HRESULT MainWindow::OnRegExCanceled(_In_ DWORD) + { + return S_OK; + } + + HRESULT MainWindow::OnRegExCompleted(_In_ DWORD) + { + _TRACER_; + + if (m_flagValidationInProgress) + { + m_flagValidationInProgress = false; + } + else + { + DWORD filter = 0; + m_prManager->GetFilter(&filter); + if (filter == PowerRenameFilters::ShouldRename) + { + m_explorerItems.Clear(); + PopulateExplorerItems(); + } + } + + UpdateCounts(); + return S_OK; + } + + HRESULT MainWindow::OnRenameStarted() + { + return S_OK; + } + + HRESULT MainWindow::OnRenameCompleted(bool closeUIWindowAfterRenaming) + { + _TRACER_; + + Logger::debug(L"Renaming completed. Close UI window - {}", closeUIWindowAfterRenaming); + if (closeUIWindowAfterRenaming) + { + // Close the window + PostMessage(m_window, WM_CLOSE, (WPARAM)0, (LPARAM)0); + } + else + { + // Force renaming work to start so newly renamed items are processed right away + SearchReplaceChanged(true); + } + return S_OK; + } +} + diff --git a/src/modules/powerrename/ui/MainWindow.xaml.h b/src/modules/powerrename/ui/MainWindow.xaml.h new file mode 100644 index 000000000000..94abb17d9982 --- /dev/null +++ b/src/modules/powerrename/ui/MainWindow.xaml.h @@ -0,0 +1,176 @@ +#pragma once + +#include "winrt/Windows.UI.Xaml.h" +#include "winrt/Windows.UI.Xaml.Markup.h" +#include "winrt/Windows.UI.Xaml.Interop.h" +#include "winrt/Windows.UI.Xaml.Controls.Primitives.h" + +#include "MainWindow.g.h" +#include "PatternSnippet.h" +#include "ExplorerItem.h" + +#include +#include + +#include +#include +#include +#include +#include + +namespace winrt::PowerRenameUI::implementation +{ + struct MainWindow : MainWindowT + { + // Proxy class to Advise() PRManager, as MainWindow can't implement IPowerRenameManagerEvents + class PowerRenameManagerEvents : public IPowerRenameManagerEvents + { + public: + PowerRenameManagerEvents(MainWindow* app) : + m_refCount{ 1 }, m_app{ app } + { + } + + IFACEMETHODIMP_(ULONG) + AddRef() + { + return InterlockedIncrement(&m_refCount); + } + + IFACEMETHODIMP_(ULONG) + Release() + { + long refCount = InterlockedDecrement(&m_refCount); + + if (refCount == 0) + { + delete this; + } + return refCount; + } + + IFACEMETHODIMP QueryInterface(_In_ REFIID riid, _Outptr_ void** ppv) + { + static const QITAB qit[] = { + QITABENT(PowerRenameManagerEvents, IPowerRenameManagerEvents), + { 0 } + }; + return QISearch(this, qit, riid, ppv); + } + + HRESULT OnItemAdded(_In_ IPowerRenameItem* renameItem) override { return m_app->OnItemAdded(renameItem); } + HRESULT OnUpdate(_In_ IPowerRenameItem* renameItem) override { return m_app->OnUpdate(renameItem); } + HRESULT OnRename(_In_ IPowerRenameItem* renameItem) override { return m_app->OnRename(renameItem); } + HRESULT OnError(_In_ IPowerRenameItem* renameItem) override { return m_app->OnError(renameItem); } + HRESULT OnRegExStarted(_In_ DWORD threadId) override { return m_app->OnRegExStarted(threadId); } + HRESULT OnRegExCanceled(_In_ DWORD threadId) override { return m_app->OnRegExCanceled(threadId); } + HRESULT OnRegExCompleted(_In_ DWORD threadId) override { return m_app->OnRegExCompleted(threadId); } + HRESULT OnRenameStarted() override { return m_app->OnRenameStarted(); } + HRESULT OnRenameCompleted(bool closeUIWindowAfterRenaming) override { return m_app->OnRenameCompleted(closeUIWindowAfterRenaming); } + + private: + long m_refCount; + MainWindow* m_app; + }; + + MainWindow(); + + Windows::Foundation::Collections::IObservableVector SearchMRU() { return m_searchMRUList; } + Windows::Foundation::Collections::IObservableVector ReplaceMRU() { return m_replaceMRUList; } + winrt::Windows::Foundation::Collections::IObservableVector ExplorerItems() { return m_explorerItems; } + winrt::Windows::Foundation::Collections::IObservableVector SearchRegExShortcuts() { return m_searchRegExShortcuts; } + winrt::Windows::Foundation::Collections::IObservableVector DateTimeShortcuts() { return m_dateTimeShortcuts; } + PowerRenameUI::UIUpdates UIUpdatesItem() { return m_uiUpdatesItem; } + + void AddExplorerItem(int32_t id, hstring const& original, hstring const& renamed, int32_t type, uint32_t depth, bool checked); + void UpdateExplorerItem(int32_t id, hstring const& newName); + void UpdateRenamedExplorerItem(int32_t id, hstring const& newOriginalName); + void AppendSearchMRU(hstring const& value); + void AppendReplaceMRU(hstring const& value); + + void Checked_ids(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + void SelectAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + void ShowAll(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + void ShowRenamed(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + + private: + bool m_allSelected; + PowerRenameUI::UIUpdates m_uiUpdatesItem; + inline PowerRenameUI::ExplorerItem FindById(int32_t id); + void ToggleAll(bool checked); + + winrt::Windows::Foundation::Collections::IObservableVector m_searchMRUList; + winrt::Windows::Foundation::Collections::IObservableVector m_replaceMRUList; + winrt::Windows::Foundation::Collections::IObservableVector m_explorerItems; + std::map m_explorerItemsMap; + winrt::Windows::Foundation::Collections::IObservableVector m_searchRegExShortcuts; + winrt::Windows::Foundation::Collections::IObservableVector m_dateTimeShortcuts; + + // Used by PowerRenameManagerEvents + HRESULT OnItemAdded(_In_ IPowerRenameItem* renameItem); + HRESULT OnUpdate(_In_ IPowerRenameItem* renameItem); + HRESULT OnRename(_In_ IPowerRenameItem* renameItem); + HRESULT OnError(_In_ IPowerRenameItem* renameItem); + HRESULT OnRegExStarted(_In_ DWORD threadId); + HRESULT OnRegExCanceled(_In_ DWORD threadId); + HRESULT OnRegExCompleted(_In_ DWORD threadId); + HRESULT OnRenameStarted(); + HRESULT OnRenameCompleted(bool closeUIWindowAfterRenaming); + + enum class UpdateFlagCommand + { + Set = 0, + Reset + }; + + HRESULT CreateShellItemArrayFromPaths(std::vector files, IShellItemArray** shellItemArray); + + void PopulateExplorerItems(); + HRESULT InitAutoComplete(); + HRESULT EnumerateShellItems(_In_ IEnumShellItems* enumShellItems); + void SearchReplaceChanged(bool forceRenaming = false); + void ValidateFlags(PowerRenameFlags flag); + void UpdateFlag(PowerRenameFlags flag, UpdateFlagCommand command); + void SetHandlers(); + void ToggleItem(int32_t id, bool checked); + void ToggleAll(); + void SwitchView(); + void Rename(bool closeWindow); + HRESULT ReadSettings(); + HRESULT WriteSettings(); + HRESULT OpenSettingsApp(); + void SetCheckboxesFromFlags(DWORD flags); + void UpdateCounts(); + + wil::unique_haccel m_accelerators; + const HINSTANCE m_instance; + HWND m_xamlIsland{}; + HWND m_window{}; + + bool m_disableCountUpdate = false; + CComPtr m_prManager; + CComPtr<::IUnknown> m_dataSource; + CComPtr m_prEnum; + PowerRenameManagerEvents m_managerEvents; + DWORD m_cookie = 0; + CComPtr m_searchMRU; + CComPtr m_replaceMRU; + UINT m_selectedCount = 0; + UINT m_renamingCount = 0; + + bool m_flagValidationInProgress = false; + public: + void RegExItemClick(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::Controls::ItemClickEventArgs const& e); + void DateTimeItemClick(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::Controls::ItemClickEventArgs const& e); + void button_rename_Click(winrt::Microsoft::UI::Xaml::Controls::SplitButton const& sender, winrt::Microsoft::UI::Xaml::Controls::SplitButtonClickEventArgs const& args); + void MenuFlyoutItem_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + void OpenDocs(winrt::Windows::Foundation::IInspectable const& sender, winrt::Microsoft::UI::Xaml::RoutedEventArgs const& e); + }; +} + +namespace winrt::PowerRenameUI::factory_implementation +{ + struct MainWindow : MainWindowT + { + }; +} diff --git a/src/modules/powerrename/ui/Package.appxmanifest b/src/modules/powerrename/ui/Package.appxmanifest new file mode 100644 index 000000000000..5d617978a7bc --- /dev/null +++ b/src/modules/powerrename/ui/Package.appxmanifest @@ -0,0 +1,48 @@ + + + + + + + + PowerRenameUI + Microsoft Corporation + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.cpp b/src/modules/powerrename/ui/PatternSnippet.cpp similarity index 69% rename from src/modules/powerrename/PowerRenameUILib/PatternSnippet.cpp rename to src/modules/powerrename/ui/PatternSnippet.cpp index 3dbc54a45b7b..b5dac80f5a24 100644 --- a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.cpp +++ b/src/modules/powerrename/ui/PatternSnippet.cpp @@ -2,7 +2,7 @@ #include "PatternSnippet.h" #include "PatternSnippet.g.cpp" -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { PatternSnippet::PatternSnippet(hstring const& code, hstring const& description) : m_code{ code }, m_description{ description } @@ -19,7 +19,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_code != value) { m_code = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Code" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Code" }); } } @@ -33,11 +33,11 @@ namespace winrt::PowerRenameUILib::implementation if (m_description != value) { m_description = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Description" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Description" }); } } - winrt::event_token PatternSnippet::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler) + winrt::event_token PatternSnippet::PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler) { return m_propertyChanged.add(handler); } diff --git a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.h b/src/modules/powerrename/ui/PatternSnippet.h similarity index 66% rename from src/modules/powerrename/PowerRenameUILib/PatternSnippet.h rename to src/modules/powerrename/ui/PatternSnippet.h index 812f9fc2a4a5..d3eb89427400 100644 --- a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.h +++ b/src/modules/powerrename/ui/PatternSnippet.h @@ -1,7 +1,7 @@ #pragma once #include "PatternSnippet.g.h" -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { struct PatternSnippet : PatternSnippetT { @@ -12,16 +12,16 @@ namespace winrt::PowerRenameUILib::implementation void Code(hstring const& value); hstring Description(); void Description(hstring const& value); - winrt::event_token PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); + winrt::event_token PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler); void PropertyChanged(winrt::event_token const& token) noexcept; private: winrt::hstring m_code; winrt::hstring m_description; - winrt::event m_propertyChanged; + winrt::event m_propertyChanged; }; } -namespace winrt::PowerRenameUILib::factory_implementation +namespace winrt::PowerRenameUI::factory_implementation { struct PatternSnippet : PatternSnippetT { diff --git a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.idl b/src/modules/powerrename/ui/PatternSnippet.idl similarity index 53% rename from src/modules/powerrename/PowerRenameUILib/PatternSnippet.idl rename to src/modules/powerrename/ui/PatternSnippet.idl index 86aff46bd16d..20835ec7d621 100644 --- a/src/modules/powerrename/PowerRenameUILib/PatternSnippet.idl +++ b/src/modules/powerrename/ui/PatternSnippet.idl @@ -1,6 +1,6 @@ -namespace PowerRenameUILib +namespace PowerRenameUI { - runtimeclass PatternSnippet : Windows.UI.Xaml.Data.INotifyPropertyChanged + runtimeclass PatternSnippet : Microsoft.UI.Xaml.Data.INotifyPropertyChanged { PatternSnippet(String code, String description); String Code; diff --git a/src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.ico b/src/modules/powerrename/ui/PowerRenameUI.ico similarity index 100% rename from src/modules/powerrename/PowerRenameUIHost/PowerRenameUIHost.ico rename to src/modules/powerrename/ui/PowerRenameUI.ico diff --git a/src/modules/powerrename/ui/PowerRenameUI.vcxproj b/src/modules/powerrename/ui/PowerRenameUI.vcxproj new file mode 100644 index 000000000000..2a8b4a1323df --- /dev/null +++ b/src/modules/powerrename/ui/PowerRenameUI.vcxproj @@ -0,0 +1,217 @@ + + + + + + + true + true + true + {27718999-c175-450a-861c-89f911e16a88} + PowerRenameUI + PowerRenameUI + + PowerToys.PowerRename + en-US + 16.0 + false + false + None + Windows Store + 10.0 + 10.0.18362.0 + 10.0.17763.0 + true + true + + + + + + Debug + Win32 + + + Debug + x64 + + + Debug + arm64 + + + Release + Win32 + + + Release + x64 + + + Release + arm64 + + + + Application + v142 + Unicode + true + + + true + true + + + false + true + false + + + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\modules\PowerRename\ + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + $(ProjectDir)..\..\..\common\Telemetry;$(ProjectDir)..\..\..\;$(ProjectDir)..\lib;%(AdditionalIncludeDirectories) + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + true + true + + + + + + + + ExplorerItem.idl + + + PatternSnippet.idl + + + + App.xaml + + + MainWindow.xaml + + + UIUpdates.idl + + + + + + + + + ExplorerItem.idl + + + PatternSnippet.idl + + + Create + + + App.xaml + + + MainWindow.xaml + + + + UIUpdates.idl + + + + + Code + App.xaml + + + + Code + MainWindow.xaml + + + + + + + + + + + + + + + + Always + + + + + + + + + {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} + + + {51920f1f-c28c-4adf-8660-4238766796c2} + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + \ No newline at end of file diff --git a/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters b/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters new file mode 100644 index 000000000000..2ce9e8ea5496 --- /dev/null +++ b/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {27718999-c175-450a-861c-89f911e16a88} + + + + + + + + + + + Assets + + + Assets + + + + + + + \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/Strings/en-us/Resources.resw b/src/modules/powerrename/ui/Resources.resw similarity index 79% rename from src/modules/powerrename/PowerRenameUILib/Strings/en-us/Resources.resw rename to src/modules/powerrename/ui/Resources.resw index fd5bb59c72e9..2b6e405e6cee 100644 --- a/src/modules/powerrename/PowerRenameUILib/Strings/en-us/Resources.resw +++ b/src/modules/powerrename/ui/Resources.resw @@ -225,70 +225,70 @@ Apply to - + Documentation - + Documentation - + Include files - + Include files - + Include folders - + Include folders - + Include subfolders - + Include subfolders Text formatting - + lowercase - + Lowercase - + UPPERCASE - + Uppercase - + Title case - + Title case - + Capitalize Each Word - + Capitalize each word - + Enumerate items - + Enumerate items - + Select or deselect all - + Filter - + Filter @@ -303,31 +303,31 @@ Renamed - + Settings - + Settings Apply - + Apply Apply and close - + RegEx help - + RegEx help - + File creation date and time help - + File creation date and time help diff --git a/src/modules/powerrename/PowerRenameUILib/UIUpdates.cpp b/src/modules/powerrename/ui/UIUpdates.cpp similarity index 68% rename from src/modules/powerrename/PowerRenameUILib/UIUpdates.cpp rename to src/modules/powerrename/ui/UIUpdates.cpp index b0fb8eef9168..47db70ff6f4c 100644 --- a/src/modules/powerrename/PowerRenameUILib/UIUpdates.cpp +++ b/src/modules/powerrename/ui/UIUpdates.cpp @@ -2,7 +2,7 @@ #include "UIUpdates.h" #include "UIUpdates.g.cpp" -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { UIUpdates::UIUpdates() : m_showAll{ true }, m_changedItemId{ -1 }, m_checked{ true }, m_closeUIWindow{ false }, m_buttonRenameEnabled{ false } @@ -19,7 +19,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_showAll != value) { m_showAll = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ShowAll" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ShowAll" }); } } @@ -31,7 +31,7 @@ namespace winrt::PowerRenameUILib::implementation void UIUpdates::ChangedExplorerItemId(int32_t value) { m_changedItemId = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ChangedItemId" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ChangedItemId" }); } bool UIUpdates::Checked() @@ -44,7 +44,7 @@ namespace winrt::PowerRenameUILib::implementation m_checked = value; } - winrt::event_token UIUpdates::PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler) + winrt::event_token UIUpdates::PropertyChanged(Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler) { return m_propertyChanged.add(handler); } @@ -56,12 +56,12 @@ namespace winrt::PowerRenameUILib::implementation void UIUpdates::ToggleAll() { - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ToggleAll" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ToggleAll" }); } void UIUpdates::Rename() { - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"Rename" }); } hstring UIUpdates::OriginalCount() @@ -74,7 +74,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_originalCount != value) { m_originalCount = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"OriginalCount" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"OriginalCount" }); } } @@ -88,7 +88,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_renamedCount != value) { m_renamedCount = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"RenamedCount" }); } } @@ -112,7 +112,7 @@ namespace winrt::PowerRenameUILib::implementation if (m_buttonRenameEnabled != value) { m_buttonRenameEnabled = value; - m_propertyChanged(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"ButtonRenameEnabled" }); + m_propertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ L"ButtonRenameEnabled" }); } } } diff --git a/src/modules/powerrename/PowerRenameUILib/UIUpdates.h b/src/modules/powerrename/ui/UIUpdates.h similarity index 76% rename from src/modules/powerrename/PowerRenameUILib/UIUpdates.h rename to src/modules/powerrename/ui/UIUpdates.h index 7a221d37c12d..558ca940eb08 100644 --- a/src/modules/powerrename/PowerRenameUILib/UIUpdates.h +++ b/src/modules/powerrename/ui/UIUpdates.h @@ -1,7 +1,7 @@ #pragma once #include "UIUpdates.g.h" -namespace winrt::PowerRenameUILib::implementation +namespace winrt::PowerRenameUI::implementation { struct UIUpdates : UIUpdatesT { @@ -13,7 +13,7 @@ namespace winrt::PowerRenameUILib::implementation void ChangedExplorerItemId(int32_t value); bool Checked(); void Checked(bool value); - winrt::event_token PropertyChanged(winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler const& handler); + winrt::event_token PropertyChanged(winrt::Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const& handler); void PropertyChanged(winrt::event_token const& token) noexcept; void ToggleAll(); bool CloseUIWindow(); @@ -34,10 +34,10 @@ namespace winrt::PowerRenameUILib::implementation bool m_buttonRenameEnabled; hstring m_originalCount; hstring m_renamedCount; - winrt::event m_propertyChanged; + winrt::event m_propertyChanged; }; } -namespace winrt::PowerRenameUILib::factory_implementation +namespace winrt::PowerRenameUI::factory_implementation { struct UIUpdates : UIUpdatesT { diff --git a/src/modules/powerrename/ui/UIUpdates.idl b/src/modules/powerrename/ui/UIUpdates.idl new file mode 100644 index 000000000000..1477dd265cd9 --- /dev/null +++ b/src/modules/powerrename/ui/UIUpdates.idl @@ -0,0 +1,17 @@ +namespace PowerRenameUI +{ + runtimeclass UIUpdates : Microsoft.UI.Xaml.Data.INotifyPropertyChanged + { + UIUpdates(); + Boolean ShowAll; + Int32 ChangedExplorerItemId; + Boolean Checked; + void ToggleAll(); + Boolean CloseUIWindow(); + void CloseUIWindow(Boolean closeUIWindow); + Boolean ButtonRenameEnabled; + void Rename(); + String OriginalCount; + String RenamedCount; + } +} diff --git a/src/modules/powerrename/ui/app.manifest b/src/modules/powerrename/ui/app.manifest new file mode 100644 index 000000000000..006689499645 --- /dev/null +++ b/src/modules/powerrename/ui/app.manifest @@ -0,0 +1,15 @@ + + + + + + + + true/PM + PerMonitorV2, PerMonitor + + + diff --git a/src/modules/powerrename/ui/packages.config b/src/modules/powerrename/ui/packages.config new file mode 100644 index 000000000000..6fb85308201f --- /dev/null +++ b/src/modules/powerrename/ui/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/modules/powerrename/PowerRenameUILib/pch.cpp b/src/modules/powerrename/ui/pch.cpp similarity index 100% rename from src/modules/powerrename/PowerRenameUILib/pch.cpp rename to src/modules/powerrename/ui/pch.cpp diff --git a/src/modules/powerrename/ui/pch.h b/src/modules/powerrename/ui/pch.h new file mode 100644 index 000000000000..a5ed89774f74 --- /dev/null +++ b/src/modules/powerrename/ui/pch.h @@ -0,0 +1,31 @@ +#pragma once +#include +#include +#include +#include +#include + +// Undefine GetCurrentTime macro to prevent +// conflict with Storyboard::GetCurrentTime +#undef GetCurrentTime + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/modules/powerrename/unittests/PowerRenameLibUnitTests.vcxproj b/src/modules/powerrename/unittests/PowerRenameLibUnitTests.vcxproj index 8a8395c051ca..28b571c600e1 100644 --- a/src/modules/powerrename/unittests/PowerRenameLibUnitTests.vcxproj +++ b/src/modules/powerrename/unittests/PowerRenameLibUnitTests.vcxproj @@ -1,6 +1,6 @@ - + {2151F984-E006-4A9F-92EF-C6DDE3DC8413} Win32Proj @@ -86,17 +86,17 @@ - - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - + + + + \ No newline at end of file diff --git a/src/modules/powerrename/unittests/packages.config b/src/modules/powerrename/unittests/packages.config index f93921797a45..fe730c73f988 100644 --- a/src/modules/powerrename/unittests/packages.config +++ b/src/modules/powerrename/unittests/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/src/modules/previewpane/powerpreview/packages.config b/src/modules/previewpane/powerpreview/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/previewpane/powerpreview/packages.config +++ b/src/modules/previewpane/powerpreview/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/previewpane/powerpreview/powerpreview.vcxproj b/src/modules/previewpane/powerpreview/powerpreview.vcxproj index c43c21f646ca..1a8203031b71 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.vcxproj +++ b/src/modules/previewpane/powerpreview/powerpreview.vcxproj @@ -1,6 +1,6 @@ - + @@ -101,14 +101,14 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/modules/videoconference/VideoConferenceModule/Video Conference.filters b/src/modules/videoconference/VideoConferenceModule/VideoConference.filters similarity index 100% rename from src/modules/videoconference/VideoConferenceModule/Video Conference.filters rename to src/modules/videoconference/VideoConferenceModule/VideoConference.filters diff --git a/src/modules/videoconference/VideoConferenceModule/Video Conference.vcxproj b/src/modules/videoconference/VideoConferenceModule/VideoConference.vcxproj similarity index 94% rename from src/modules/videoconference/VideoConferenceModule/Video Conference.vcxproj rename to src/modules/videoconference/VideoConferenceModule/VideoConference.vcxproj index ab9562f8c641..d0f43a56a0d5 100644 --- a/src/modules/videoconference/VideoConferenceModule/Video Conference.vcxproj +++ b/src/modules/videoconference/VideoConferenceModule/VideoConference.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -38,8 +38,6 @@ - - @@ -165,13 +163,17 @@ xcopy /y /I "$(ProjectDir)black.bmp*" "$(OutDir)" + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + diff --git a/src/modules/videoconference/VideoConferenceModule/Video Conference.vcxproj.filters b/src/modules/videoconference/VideoConferenceModule/VideoConference.vcxproj.filters similarity index 100% rename from src/modules/videoconference/VideoConferenceModule/Video Conference.vcxproj.filters rename to src/modules/videoconference/VideoConferenceModule/VideoConference.vcxproj.filters diff --git a/src/modules/videoconference/VideoConferenceModule/packages.config b/src/modules/videoconference/VideoConferenceModule/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/videoconference/VideoConferenceModule/packages.config +++ b/src/modules/videoconference/VideoConferenceModule/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/modules/videoconference/VideoConferenceShared/VideoConferenceShared.vcxproj b/src/modules/videoconference/VideoConferenceShared/VideoConferenceShared.vcxproj index 461d6996197c..7efa30f2d153 100644 --- a/src/modules/videoconference/VideoConferenceShared/VideoConferenceShared.vcxproj +++ b/src/modules/videoconference/VideoConferenceShared/VideoConferenceShared.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -130,13 +130,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + \ No newline at end of file diff --git a/src/modules/videoconference/VideoConferenceShared/packages.config b/src/modules/videoconference/VideoConferenceShared/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/modules/videoconference/VideoConferenceShared/packages.config +++ b/src/modules/videoconference/VideoConferenceShared/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/runner/packages.config b/src/runner/packages.config index d758b61ef1de..3b0b048f0bd3 100644 --- a/src/runner/packages.config +++ b/src/runner/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/runner/runner.vcxproj b/src/runner/runner.vcxproj index 9ce2efdd8e2b..a214fa0c63cd 100644 --- a/src/runner/runner.vcxproj +++ b/src/runner/runner.vcxproj @@ -1,6 +1,6 @@  - + @@ -121,15 +121,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj index db8e01a96fa0..0fc6a6602355 100644 --- a/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj +++ b/tools/BugReportTool/BugReportTool/BugReportTool.vcxproj @@ -1,6 +1,6 @@ - + 16.0 Win32Proj @@ -79,15 +79,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/tools/BugReportTool/BugReportTool/packages.config b/tools/BugReportTool/BugReportTool/packages.config index fda08e21c1e2..86a435da1c5c 100644 --- a/tools/BugReportTool/BugReportTool/packages.config +++ b/tools/BugReportTool/BugReportTool/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/tools/WebcamReportTool/WebcamReportTool.vcxproj b/tools/WebcamReportTool/WebcamReportTool.vcxproj index 1b5354d9dfba..53c567c844d1 100644 --- a/tools/WebcamReportTool/WebcamReportTool.vcxproj +++ b/tools/WebcamReportTool/WebcamReportTool.vcxproj @@ -1,6 +1,6 @@  - + v143 @@ -61,15 +61,15 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/tools/WebcamReportTool/packages.config b/tools/WebcamReportTool/packages.config index fda08e21c1e2..86a435da1c5c 100644 --- a/tools/WebcamReportTool/packages.config +++ b/tools/WebcamReportTool/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/tools/project_template/ModuleTemplate/ModuleTemplateCompileTest.vcxproj b/tools/project_template/ModuleTemplate/ModuleTemplateCompileTest.vcxproj index 20e52475e804..f4bff6c25fe2 100644 --- a/tools/project_template/ModuleTemplate/ModuleTemplateCompileTest.vcxproj +++ b/tools/project_template/ModuleTemplate/ModuleTemplateCompileTest.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -128,13 +128,13 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/tools/project_template/ModuleTemplate/packages.config b/tools/project_template/ModuleTemplate/packages.config index 81f107b8bcab..fa024c0634de 100644 --- a/tools/project_template/ModuleTemplate/packages.config +++ b/tools/project_template/ModuleTemplate/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file