diff --git a/ContextMenuManager/App.config b/ContextMenuManager/App.config index cfd720a..e55d23b 100644 --- a/ContextMenuManager/App.config +++ b/ContextMenuManager/App.config @@ -2,7 +2,7 @@ - + diff --git a/ContextMenuManager/AppImage.cs b/ContextMenuManager/AppImage.cs index 2c3d886..76d00cf 100644 --- a/ContextMenuManager/AppImage.cs +++ b/ContextMenuManager/AppImage.cs @@ -57,6 +57,8 @@ namespace ContextMenuManager public static readonly Image Shield = ResourceIcon.GetIcon("imageres.dll", 73).ToBitmap(); ///资源管理器图标 public static readonly Image Explorer = ResourceIcon.GetIcon("explorer.exe", 0).ToBitmap(); + ///命令提示符图标 + public static readonly Image Cmd= ResourceIcon.GetIcon("cmd.exe", 0).ToBitmap(); ///刷新图标 public static readonly Image Refresh = ResourceIcon.GetIcon("shell32.dll", 238).ToBitmap(); ///自定义文件夹图标 diff --git a/ContextMenuManager/AppString.cs b/ContextMenuManager/AppString.cs index 62bce76..8d55596 100644 --- a/ContextMenuManager/AppString.cs +++ b/ContextMenuManager/AppString.cs @@ -159,6 +159,7 @@ namespace ContextMenuManager public static string RemovableDrive => GetValue("RemovableDrive"); public static string BuildSendtoMenu => GetValue("BuildSendtoMenu"); public static string UseStoreOpenWith => GetValue("UseStoreOpenWith"); + public static string WinXPowerShell => GetValue("WinXPowerShell"); public static string NewItem => GetValue("NewItem"); public static string AddGuidBlockedItem => GetValue("AddGuidBlockedItem"); public static string CurrentExtension => GetValue("CurrentExtension"); diff --git a/ContextMenuManager/ContextMenuManager.csproj b/ContextMenuManager/ContextMenuManager.csproj index 6dc0397..d11d61e 100644 --- a/ContextMenuManager/ContextMenuManager.csproj +++ b/ContextMenuManager/ContextMenuManager.csproj @@ -8,7 +8,7 @@ WinExe ContextMenuManager ContextMenuManager - v3.5 + v4.5 512 false true diff --git a/ContextMenuManager/Controls/RegRuleItem.cs b/ContextMenuManager/Controls/RegRuleItem.cs index 2fe25ff..ebb889b 100644 --- a/ContextMenuManager/Controls/RegRuleItem.cs +++ b/ContextMenuManager/Controls/RegRuleItem.cs @@ -112,6 +112,7 @@ namespace ContextMenuManager.Controls public IFoldGroupItem FoldGroupItem { get; set; } + const string CU_SMWCEA = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced"; const string LM_SMWCPE = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"; const string CU_SMWCPE = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"; const string LM_SMWCE = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"; @@ -126,7 +127,7 @@ namespace ContextMenuManager.Controls new RegRule(LM_SMWCPE, "NoCustomizeWebView", 0, 1), new RegRule(CU_SMWCPE, "NoCustomizeThisFolder", 0, 1), new RegRule(CU_SMWCPE, "NoCustomizeWebView", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = AppString.Item.CustomFolder, @@ -141,7 +142,7 @@ namespace ContextMenuManager.Controls Rules = new[] { new RegRule(LM_SMWCPE, "NoNetConnectDisconnect", 0, 1), new RegRule(CU_SMWCPE, "NoNetConnectDisconnect", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = $"{AppString.Item.MapNetworkDrive} && {AppString.Item.DisconnectNetworkDrive}", @@ -155,7 +156,7 @@ namespace ContextMenuManager.Controls Rules = new[] { new RegRule(LM_SMWCPE, "NoPropertiesRecycleBin", 0, 1), new RegRule(CU_SMWCPE, "NoPropertiesRecycleBin", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = AppString.Item.RecycleBinProperties, @@ -169,7 +170,7 @@ namespace ContextMenuManager.Controls Rules = new[] { new RegRule(LM_SMWCPE, "NoDrivesInSendToMenu", 0, 1), new RegRule(CU_SMWCPE, "NoDrivesInSendToMenu", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = AppString.Item.RemovableDrive, @@ -184,7 +185,7 @@ namespace ContextMenuManager.Controls Rules = new[] { new RegRule(LM_SMWCE, "DelaySendToMenuBuild", 0, 1), new RegRule(CU_SMWCE, "DelaySendToMenuBuild", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = AppString.Item.BuildSendtoMenu, @@ -198,12 +199,26 @@ namespace ContextMenuManager.Controls Rules = new[] { new RegRule(LM_SPMWE, "NoUseStoreOpenWith", 0, 1), new RegRule(CU_SPMWE, "NoUseStoreOpenWith", 0, 1) - }, + }, ItemInfo = new ItemInfo { Text = AppString.Item.UseStoreOpenWith, Image = AppImage.MicrosoftStore } }; + + public static RuleAndInfo WinXPowerShell = new RuleAndInfo + { + Rules = new[] + { + new RegRule(CU_SMWCEA, "DontUsePowerShellOnWinX", 0, 1) + }, + ItemInfo = new ItemInfo + { + Text = AppString.Item.WinXPowerShell, + Image = AppImage.Cmd, + RestartExplorer = true + } + }; } } \ No newline at end of file diff --git a/ContextMenuManager/Controls/ThirdRulesList.cs b/ContextMenuManager/Controls/ThirdRulesList.cs index 0468ec3..894a2cf 100644 --- a/ContextMenuManager/Controls/ThirdRulesList.cs +++ b/ContextMenuManager/Controls/ThirdRulesList.cs @@ -32,8 +32,8 @@ namespace ContextMenuManager.Controls } foreach(XmlElement groupXE in doc1.DocumentElement.ChildNodes) { - if(!GuidInfo.TryGetGuid(groupXE.GetAttribute("Guid"), out Guid guid) - && !groupXE.HasAttribute("Common")) continue; + Guid guid = Guid.Empty; + if(groupXE.HasAttribute("Guid") && !GuidInfo.TryGetGuid(groupXE.GetAttribute("Guid"), out guid)) continue; GroupPathItem groupItem = new GroupPathItem { diff --git a/ContextMenuManager/Controls/WinXList.cs b/ContextMenuManager/Controls/WinXList.cs index a414081..df945c7 100644 --- a/ContextMenuManager/Controls/WinXList.cs +++ b/ContextMenuManager/Controls/WinXList.cs @@ -28,11 +28,14 @@ namespace ContextMenuManager.Controls public void LoadItems() { Version ver = Environment.OSVersion.Version; - if((ver.Major == 10) || (ver.Major == 6 && ver.Minor >= 2)) + bool isWin10= ver.Major == 10; + bool isWin8 = (ver.Major == 6) && (ver.Minor >= 2); + if(isWin10 || isWin8) { this.ClearItems(); DesktopIniReaders.Clear(); Array.ForEach(new DirectoryInfo(WinXPath).GetDirectories(), di => LoadSubDirItems(di)); + if(isWin10) this.AddItem(new RegRuleItem(RegRuleItem.WinXPowerShell) { MarginRight = RegRuleItem.SysMarginRignt }); } } diff --git a/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini b/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini index 485138d..a74b020 100644 --- a/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini +++ b/ContextMenuManager/Properties/Resources/Texts/AppLanguageDic.ini @@ -129,6 +129,7 @@ RecycleBinProperties = 属性(&R) RemovableDrive = 可移动磁盘 BuildSendtoMenu = 快速构建发送到子菜单 UseStoreOpenWith = 在Microsoft Store中查找应用 +WinXPowerShell = Win+X菜单命令提示符替换为PowerShell NewItem = 新建一个菜单项目 AddGuidBlockedItem = 添加GUID锁定项目 CurrentExtension = 你当前选择的文件格式为 diff --git a/ContextMenuManager/Properties/Resources/Texts/ThirdRulesDic.xml b/ContextMenuManager/Properties/Resources/Texts/ThirdRulesDic.xml index 6ee4841..5f85297 100644 --- a/ContextMenuManager/Properties/Resources/Texts/ThirdRulesDic.xml +++ b/ContextMenuManager/Properties/Resources/Texts/ThirdRulesDic.xml @@ -1,11 +1,11 @@ - - + @@ -36,6 +36,9 @@ ValueKind为键值类型,默认键值类型ValueKind为REG_DWORD,为默认 + + + diff --git a/languages/zh-CN.ini b/languages/zh-CN.ini index 485138d..a74b020 100644 --- a/languages/zh-CN.ini +++ b/languages/zh-CN.ini @@ -129,6 +129,7 @@ RecycleBinProperties = 属性(&R) RemovableDrive = 可移动磁盘 BuildSendtoMenu = 快速构建发送到子菜单 UseStoreOpenWith = 在Microsoft Store中查找应用 +WinXPowerShell = Win+X菜单命令提示符替换为PowerShell NewItem = 新建一个菜单项目 AddGuidBlockedItem = 添加GUID锁定项目 CurrentExtension = 你当前选择的文件格式为