From 31403c37f647d9b047a4ae6e470f4a5899b27be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E6=80=A1=E9=A3=9E?= <363301617@qq.com> Date: Tue, 10 Dec 2024 22:18:09 +0800 Subject: [PATCH] Finish develop ContextMenuManager page 1.Finish develop ContextMenuManager page 2.Fix Loopbackmanager page search filter error 3.Update readme.md 4.Publish 3.4.1210.0 version --- Description/README_EN-US.md | 2 +- Description/README_ZH-CN.md | 2 +- README.md | 2 +- .../DataType/Enums/BlockedClsidType.cs | 5 +- .../DataType/Enums/OperationKind.cs | 3 +- WindowsTools/Models/ContextMenuItemModel.cs | 3 + WindowsTools/Models/ContextMenuModel.cs | 5 +- WindowsTools/Properties/AssemblyInfo.cs | 6 +- .../Strings/ContextMenuManager.en-us.restext | 14 +- .../Strings/ContextMenuManager.restext | 14 +- .../ContextMenuManager.zh-hans.restext | 12 +- WindowsTools/Strings/Dialog.en-us.restext | 1 - WindowsTools/Strings/Dialog.restext | 1 - WindowsTools/Strings/Dialog.zh-hans.restext | 3 +- .../Strings/Notification.en-us.restext | 2 + WindowsTools/Strings/Notification.restext | 2 + .../Strings/Notification.zh-hans.restext | 2 + .../UI/Dialogs/AppInformationDialog.xaml.cs | 14 +- .../TeachingTips/OperationResultTip.xaml.cs | 15 + .../Views/Pages/ContextMenuManager.xaml | 74 ++- .../Views/Pages/ContextMenuManager.xaml.cs | 474 +++++++++++++++++- .../Views/Pages/DownloadManagerPage.xaml | 4 +- WindowsTools/Views/Pages/FileUnlockPage.xaml | 4 +- .../Views/Pages/LoopbackManagerPage.xaml | 8 +- .../Views/Pages/LoopbackManagerPage.xaml.cs | 35 +- .../PInvoke/Kernel32/Kernel32Library.cs | 12 +- WindowsToolsPackage/Package.appxmanifest | 11 +- 27 files changed, 651 insertions(+), 79 deletions(-) diff --git a/Description/README_EN-US.md b/Description/README_EN-US.md index 929dbb35..0b26722b 100644 --- a/Description/README_EN-US.md +++ b/Description/README_EN-US.md @@ -67,7 +67,7 @@ A toolbox that integrates multiple gadgets. | Extract the package resource index(.pri) file conten | Finished | | Color picker | Unfinished | | Customize the right-click menu | Finished | -| Right-click menu items manager | Unfinished | +| Right-click menu items manager | Finished | | System information | Unfinished | | Driver manager | Unfinished | | Update manager | Unfinished | diff --git a/Description/README_ZH-CN.md b/Description/README_ZH-CN.md index 9ce11c08..7eb9da49 100644 --- a/Description/README_ZH-CN.md +++ b/Description/README_ZH-CN.md @@ -67,7 +67,7 @@ | 提取包资源文件索引内容 | 已完成 | | 颜色选择器 | 未完成 | | 自定义右键菜单 | 已完成 | -| 右键菜单项管理 | 未完成 | +| 右键菜单项管理 | 已完成 | | 系统信息 | 未完成 | | 驱动管理 | 未完成 | | 更新管理 | 未完成 | diff --git a/README.md b/README.md index 444075c8..0301909f 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ | 提取包资源文件索引内容 | 已完成 | | 颜色选择器 | 未完成 | | 自定义右键菜单 | 已完成 | -| 右键菜单项管理 | 未完成 | +| 右键菜单项管理 | 已完成 | | 系统信息 | 未完成 | | 驱动管理 | 未完成 | | 更新管理 | 未完成 | diff --git a/WindowsTools/Extensions/DataType/Enums/BlockedClsidType.cs b/WindowsTools/Extensions/DataType/Enums/BlockedClsidType.cs index 430529f8..a5e45133 100644 --- a/WindowsTools/Extensions/DataType/Enums/BlockedClsidType.cs +++ b/WindowsTools/Extensions/DataType/Enums/BlockedClsidType.cs @@ -2,7 +2,8 @@ { public enum BlockedClsidType { - CurrentUser, - LocalMachine + Unknown = 0, + CurrentUser = 1, + LocalMachine = 2 } } diff --git a/WindowsTools/Extensions/DataType/Enums/OperationKind.cs b/WindowsTools/Extensions/DataType/Enums/OperationKind.cs index 5ee94962..4ef47794 100644 --- a/WindowsTools/Extensions/DataType/Enums/OperationKind.cs +++ b/WindowsTools/Extensions/DataType/Enums/OperationKind.cs @@ -24,6 +24,7 @@ public enum OperationKind MenuDarkThemeIconPathEmpty = 19, MenuProgramPathEmpty = 20, MenuMatchRuleEmpty = 21, - ShellMenuNeedToRefreshData = 22 + ShellMenuNeedToRefreshData = 22, + ContextMenuUpdate = 23 } } diff --git a/WindowsTools/Models/ContextMenuItemModel.cs b/WindowsTools/Models/ContextMenuItemModel.cs index 93279034..33659e68 100644 --- a/WindowsTools/Models/ContextMenuItemModel.cs +++ b/WindowsTools/Models/ContextMenuItemModel.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel; using System.Threading; +using WindowsTools.Extensions.DataType.Enums; namespace WindowsTools.Models { @@ -31,6 +32,8 @@ public bool IsEnabled public ApartmentState ThreadingMode { get; set; } + public BlockedClsidType BlockedClsidType { get; set; } + public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/WindowsTools/Models/ContextMenuModel.cs b/WindowsTools/Models/ContextMenuModel.cs index 7d5c50d0..409835d1 100644 --- a/WindowsTools/Models/ContextMenuModel.cs +++ b/WindowsTools/Models/ContextMenuModel.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.ComponentModel; using Windows.UI.Xaml; using Windows.UI.Xaml.Media; @@ -28,6 +29,8 @@ public Visibility IsVisible public ImageSource PackageIcon { get; set; } + public Uri PackageIconUri { get; set; } + public string PackageDisplayName { get; set; } public string PackageFullName { get; set; } diff --git a/WindowsTools/Properties/AssemblyInfo.cs b/WindowsTools/Properties/AssemblyInfo.cs index 71cfbfe3..f8f00532 100644 --- a/WindowsTools/Properties/AssemblyInfo.cs +++ b/WindowsTools/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ [assembly: AssemblyCompany("高怡飞")] [assembly: AssemblyCopyright("Copyright ©2024 高怡飞, All Rights Reserved.")] [assembly: AssemblyDescription("Windows 工具箱")] -[assembly: AssemblyFileVersion("3.3.1208.0")] -[assembly: AssemblyInformationalVersion("3.3.1208.0")] +[assembly: AssemblyFileVersion("3.4.1210.0")] +[assembly: AssemblyInformationalVersion("3.4.1210.0")] [assembly: AssemblyProduct("Windows 工具箱")] [assembly: AssemblyTitle("Windows 工具箱")] -[assembly: AssemblyVersion("3.3.1208.0")] +[assembly: AssemblyVersion("3.4.1210.0")] // 应用程序默认区域性的资源控制器设置 [assembly: NeutralResourcesLanguage("en-us")] diff --git a/WindowsTools/Strings/ContextMenuManager.en-us.restext b/WindowsTools/Strings/ContextMenuManager.en-us.restext index cff24d47..985dd120 100644 --- a/WindowsTools/Strings/ContextMenuManager.en-us.restext +++ b/WindowsTools/Strings/ContextMenuManager.en-us.restext @@ -1,13 +1,21 @@ Title=Context menu manager EmptyDescription=The device does not have any new right-click menu items ExplainTitle=Menu management instructions -ExplanContent=Manage the display status of Windows new-click right-click menu items +ExplanContent1=1.Manage the display status of Windows new-click right-click menu items +ExplanContent2=2.Context menu item information is saved under registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package +ExplanContent3=3.The right-click menu item display status blacklist is saved in the registry under HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked (no Blocked entries need to be created manually) +ExplanContent4=4.You can manually navigate to the corresponding registry key and add the key value of the right-click menu item to change the display status of the menu item +ExplanContent5=5.If you're not clear about the specific menu item you've changed, you can try reverting to the default settings, or removing the Blocked item +ExplanContent6=6.This app's right-click menu displays status options is in the settings page LearnContextMenuManager=Learn right-click menu management -LearnCustomRightClickMenu=Learn about customizing the right-click menu +LearnCustomRightClickMenu=Learn to custom right-click menu LoadingContextMenuInformation=Loading right-click menu information, please wait... OpenPackagePathToolTip=Open the app installation folder +OpenSettings=Open settings Refresh=Refresh -SearchAppNamePHText=Search app name +RestoreDefault=Restore default +SearchAppNamePHText=Search app name or package full name SearchEmptyDescription=No matching right-click menu item found SelectedToolTip=Selected +Unknown=Unknown UnSelectedToolTip=Unselected \ No newline at end of file diff --git a/WindowsTools/Strings/ContextMenuManager.restext b/WindowsTools/Strings/ContextMenuManager.restext index a1267e75..2967caed 100644 --- a/WindowsTools/Strings/ContextMenuManager.restext +++ b/WindowsTools/Strings/ContextMenuManager.restext @@ -1,13 +1,21 @@ Title=Context menu manager EmptyDescription=The device does not have any new right-click menu items ExplainTitle=Menu management instructions -ExplanContent=Manage the display status of Windows new-click right-click menu items +ExplanContent1=1.Manage the display status of Windows new-click right-click menu items +ExplanContent2=2.Context menu item information is saved under registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package +ExplanContent3=3.The right-click menu item display status blacklist is saved in the registry under HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked (no Blocked entries need to be created manually) +ExplanContent4=4.You can manually navigate to the corresponding registry key and add the key value of the right-click menu item to change the display status of the menu item +ExplanContent5=5.If you're not clear about the specific menu item you've changed, you can try reverting to the default settings, or removing the Blocked item +ExplanContent6=6.This app's right-click menu displays status options is in the settings page LearnContextMenuManager=Learn right-click menu management -LearnCustomRightClickMenu=Learn about customizing the right-click menu +LearnCustomRightClickMenu=Learn to custom right-click menu LoadingContextMenuInformation=Loading right-click menu information, please wait... OpenPackagePathToolTip=Open the app installation folder +OpenSettings=Open settings Refresh=Refresh -SearchAppNamePHText=Search app name +RestoreDefault=Restore default +SearchAppNamePHText=Search app name or package full name SearchEmptyDescription=No matching right-click menu item found SelectedToolTip=Selected +Unknown=Unknown UnSelectedToolTip=Unselected diff --git a/WindowsTools/Strings/ContextMenuManager.zh-hans.restext b/WindowsTools/Strings/ContextMenuManager.zh-hans.restext index f1a364bd..5ddb8884 100644 --- a/WindowsTools/Strings/ContextMenuManager.zh-hans.restext +++ b/WindowsTools/Strings/ContextMenuManager.zh-hans.restext @@ -1,13 +1,21 @@ Title=右键菜单管理 EmptyDescription=该设备没有任何新版的右键菜单项 ExplainTitle=菜单管理说明 -ExplanContent=管理 Windows 新版右键菜单项的显示状态 +ExplanContent1=1.管理 Windows 新版右键菜单项的显示状态 +ExplanContent2=2.右键菜单项信息保存在注册表 HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package 下 +ExplanContent3=3.右键菜单项显示状态黑名单保存在注册表 HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Blocked 下(没有 Blocked 项需要手动创建) +ExplanContent4=4.您可以手动定位到所对应的注册表项,添加对应右键菜单项的键值以更改菜单项的显示状态 +ExplanContent5=5.如果您不清楚您更改的具体菜单项,您可以尝试恢复默认设置,或删除 Blocked 项 +ExplanContent6=6.本应用的右键菜单显示状态选项在设置页面 LearnContextMenuManager=了解右键菜单管理 LearnCustomRightClickMenu=了解自定义右键菜单 LoadingContextMenuInformation=正在加载右键菜单信息中,请稍候... OpenPackagePathToolTip=打开应用安装目录 +OpenSettings=打开设置 Refresh=刷新 -SearchAppNamePHText=搜索应用名称 +RestoreDefault=恢复默认 +SearchAppNamePHText=搜索应用名称或包全名 SearchEmptyDescription=没有搜索到复合的右键菜单项 SelectedToolTip=已选择 +Unknown=未知 UnSelectedToolTip=未选择 \ No newline at end of file diff --git a/WindowsTools/Strings/Dialog.en-us.restext b/WindowsTools/Strings/Dialog.en-us.restext index ef41e296..41a44ed3 100644 --- a/WindowsTools/Strings/Dialog.en-us.restext +++ b/WindowsTools/Strings/Dialog.en-us.restext @@ -24,6 +24,5 @@ Operation=Operation OperationFailed=Error message list Restart=Application restart RestartContent=The app is about to restart, after the restart the app's data will be lost, make sure that your work has been saved in its entirety -WindowsAppSDKVersion=Windows App SDK version: WindowsUIVersion=Windows UI version: WinUI2Version=WinUI 2 Version: diff --git a/WindowsTools/Strings/Dialog.restext b/WindowsTools/Strings/Dialog.restext index ef41e296..41a44ed3 100644 --- a/WindowsTools/Strings/Dialog.restext +++ b/WindowsTools/Strings/Dialog.restext @@ -24,6 +24,5 @@ Operation=Operation OperationFailed=Error message list Restart=Application restart RestartContent=The app is about to restart, after the restart the app's data will be lost, make sure that your work has been saved in its entirety -WindowsAppSDKVersion=Windows App SDK version: WindowsUIVersion=Windows UI version: WinUI2Version=WinUI 2 Version: diff --git a/WindowsTools/Strings/Dialog.zh-hans.restext b/WindowsTools/Strings/Dialog.zh-hans.restext index 7eab23b3..f33d0e90 100644 --- a/WindowsTools/Strings/Dialog.zh-hans.restext +++ b/WindowsTools/Strings/Dialog.zh-hans.restext @@ -23,7 +23,6 @@ OpenFolder=打开文件夹 Operation=操作 OperationFailed=错误信息列表 Restart=重启应用 -RestartContent=应用即将重启,重启后应用的数据将会丢失,请确保您的工作内容已经全部保存。 -WindowsAppSDKVersion=Windows 应用 SDK 版本: +RestartContent=应用即将重启,重启后应用的数据将会丢失,请确保您的工作内容已经全部保存 WindowsUIVersion=Windows UI 版本: WinUI2Version=WinUI 2 版本: diff --git a/WindowsTools/Strings/Notification.en-us.restext b/WindowsTools/Strings/Notification.en-us.restext index 69a4defb..62914951 100644 --- a/WindowsTools/Strings/Notification.en-us.restext +++ b/WindowsTools/Strings/Notification.en-us.restext @@ -1,4 +1,6 @@ AppInformationCopy=The app information was successfully copied to the clipboard +ContextMenuUpdateFailed=Right-click menu item status update failed, please manually update the value +ContextMenuUpdateSuccessfully=Right-click menu item status update successfully CopyToClipboardFailed=Failed to copy the content to the clipboard. Please check the access permission of the clipboard DesktopShortcutSuccessfully=The desktop shortcut for the app was created successfully DesktopShortFailed=The app's desktop shortcut failed to create, please create it manually diff --git a/WindowsTools/Strings/Notification.restext b/WindowsTools/Strings/Notification.restext index 69a4defb..62914951 100644 --- a/WindowsTools/Strings/Notification.restext +++ b/WindowsTools/Strings/Notification.restext @@ -1,4 +1,6 @@ AppInformationCopy=The app information was successfully copied to the clipboard +ContextMenuUpdateFailed=Right-click menu item status update failed, please manually update the value +ContextMenuUpdateSuccessfully=Right-click menu item status update successfully CopyToClipboardFailed=Failed to copy the content to the clipboard. Please check the access permission of the clipboard DesktopShortcutSuccessfully=The desktop shortcut for the app was created successfully DesktopShortFailed=The app's desktop shortcut failed to create, please create it manually diff --git a/WindowsTools/Strings/Notification.zh-hans.restext b/WindowsTools/Strings/Notification.zh-hans.restext index 12d3603c..affd0208 100644 --- a/WindowsTools/Strings/Notification.zh-hans.restext +++ b/WindowsTools/Strings/Notification.zh-hans.restext @@ -1,4 +1,6 @@ AppInformationCopy=应用信息信息已成功复制到剪贴板 +ContextMenuUpdateFailed=右键菜单项显示状态更新失败,请手动更新值 +ContextMenuUpdateSuccessfully=右键菜单项显示状态更新成功 CopyToClipboardFailed=复制内容到剪贴板失败,请检查剪贴板的访问权限 DesktopShortcutSuccessfully=应用的桌面快捷方式已成功创建 DesktopShortFailed=应用的桌面快捷方式创建失败,请手动创建 diff --git a/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs b/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs index 58bb38b1..a7bf3ff7 100644 --- a/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs +++ b/WindowsTools/UI/Dialogs/AppInformationDialog.xaml.cs @@ -51,11 +51,11 @@ await Task.Run(() => byte[] buffer = new byte[bufferLength]; KernelAppCoreLibrary.GetCurrentPackageInfo2(PACKAGE_FLAGS.PACKAGE_PROPERTY_STATIC, PackagePathType.PackagePathType_Install, ref bufferLength, buffer, out count); - for (int i = 0; i < count; i++) + for (int index = 0; index < count; index++) { int packageInfoSize = Marshal.SizeOf(); IntPtr packageInfoPtr = Marshal.AllocHGlobal(packageInfoSize); - Marshal.Copy(buffer, i * packageInfoSize, packageInfoPtr, packageInfoSize); + Marshal.Copy(buffer, index * packageInfoSize, packageInfoPtr, packageInfoSize); PACKAGE_INFO packageInfo = Marshal.PtrToStructure(packageInfoPtr); packageInfoList.Add(packageInfo); Marshal.FreeHGlobal(packageInfoPtr); @@ -63,16 +63,6 @@ await Task.Run(() => foreach (PACKAGE_INFO packageInfo in packageInfoList) { - if (packageInfo.packageFullName.Contains("WindowsAppRuntime")) - { - // Windows 应用 SDK 版本信息 - dependencyInformationList.Add(new KeyValuePair(ResourceService.DialogResource.GetString("WindowsAppSDKVersion"), new Version( - packageInfo.packageId.version.Parts.Major, - packageInfo.packageId.version.Parts.Minor, - packageInfo.packageId.version.Parts.Build, - packageInfo.packageId.version.Parts.Revision))); - } - // WinUI 2 版本信息 if (packageInfo.packageFullName.Contains("Microsoft.UI.Xaml")) { diff --git a/WindowsTools/UI/TeachingTips/OperationResultTip.xaml.cs b/WindowsTools/UI/TeachingTips/OperationResultTip.xaml.cs index 0da7eec1..15f4e7d1 100644 --- a/WindowsTools/UI/TeachingTips/OperationResultTip.xaml.cs +++ b/WindowsTools/UI/TeachingTips/OperationResultTip.xaml.cs @@ -182,6 +182,21 @@ public OperationResultTip(OperationKind operationKind, bool operationResult) OperationResultFailed.Visibility = Visibility.Visible; } } + else if (operationKind is OperationKind.ContextMenuUpdate) + { + if (operationResult) + { + OperationResultSuccess.Text = ResourceService.NotificationResource.GetString("ContextMenuUpdateSuccessfully"); + OperationResultSuccess.Visibility = Visibility.Visible; + OperationResultFailed.Visibility = Visibility.Collapsed; + } + else + { + OperationResultFailed.Text = ResourceService.NotificationResource.GetString("ContextMenuUpdateFailed"); + OperationResultSuccess.Visibility = Visibility.Collapsed; + OperationResultFailed.Visibility = Visibility.Visible; + } + } } public OperationResultTip(OperationKind operationKind, int successItems, int failedItems) diff --git a/WindowsTools/Views/Pages/ContextMenuManager.xaml b/WindowsTools/Views/Pages/ContextMenuManager.xaml index 17b2c462..0eda9480 100644 --- a/WindowsTools/Views/Pages/ContextMenuManager.xaml +++ b/WindowsTools/Views/Pages/ContextMenuManager.xaml @@ -13,7 +13,7 @@ mc:Ignorable="d"> - + @@ -47,11 +47,12 @@ @@ -69,15 +70,42 @@ + + + + + +