mirror of
https://github.com/BluePointLilac/ContextMenuManager.git
synced 2026-01-15 06:03:50 +08:00
添加WinX命令提示符替换为PowerShell规则
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<configuration>
|
||||
<startup>
|
||||
|
||||
<supportedRuntime version="v2.0.50727"/></startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
|
||||
<runtime>
|
||||
<legacyCorruptedStateExceptionsPolicy enabled="true"/>
|
||||
<EnableWindowsFormsHighDpiAutoResizing enabled="true"/>
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace ContextMenuManager
|
||||
public static readonly Image Shield = ResourceIcon.GetIcon("imageres.dll", 73).ToBitmap();
|
||||
///<summary>资源管理器图标</summary>
|
||||
public static readonly Image Explorer = ResourceIcon.GetIcon("explorer.exe", 0).ToBitmap();
|
||||
///<summary>命令提示符图标</summary>
|
||||
public static readonly Image Cmd= ResourceIcon.GetIcon("cmd.exe", 0).ToBitmap();
|
||||
///<summary>刷新图标</summary>
|
||||
public static readonly Image Refresh = ResourceIcon.GetIcon("shell32.dll", 238).ToBitmap();
|
||||
///<summary>自定义文件夹图标</summary>
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>ContextMenuManager</RootNamespace>
|
||||
<AssemblyName>ContextMenuManager</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ RecycleBinProperties = 属性(&R)
|
||||
RemovableDrive = 可移动磁盘
|
||||
BuildSendtoMenu = 快速构建发送到子菜单
|
||||
UseStoreOpenWith = 在Microsoft Store中查找应用
|
||||
WinXPowerShell = Win+X菜单命令提示符替换为PowerShell
|
||||
NewItem = 新建一个菜单项目
|
||||
AddGuidBlockedItem = 添加GUID锁定项目
|
||||
CurrentExtension = 你当前选择的文件格式为
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--每个程序为一个Group,Text为Group项显示文本,Guid用于判断用户是否安装此程序并决定是否显示该Group,常驻菜单时须添加属性Common,RegPath为程序相关注册表主路径;
|
||||
<!--每个程序为一个Group,Text为Group项显示文本,Guid用于判断用户是否安装此程序并决定是否显示该Group,不设置Guid则为常驻菜单,RegPath为程序相关注册表主路径;
|
||||
其相关菜单项目设置作为一个Item子元素,Item的Text为该Item项显示文本,Tip属性为鼠标悬浮在开关上时的提示信息,需要重启资源管理器生效则添加属性RestartExplorer;
|
||||
Item的子元素Rule为相关注册表内容,RegPath省略则默认为Group主路径,以\开头则为Group主路径的子项路径;ValueName为相关键名,On为启用键值,Off为禁用键值;
|
||||
每个Item可能受多个注册表Rule影响,按照顺序进行键值判定;程序优先判定为On,即只要所有Rule不匹配Off键值就判定为On,键值类型不符时也判定为On;
|
||||
ValueKind为键值类型,默认键值类型ValueKind为REG_DWORD,为默认值时可省略,目前仅支持REG_SZ、REG_DWORD、REG_EXPAND_SZ的键值类型-->
|
||||
<Data>
|
||||
<Group Text="System" Common="">
|
||||
<Group Text="System">
|
||||
<Item Text="目录背景 自定义文件夹" RestartExplorer="" Tip="禁用此项将会同时禁用文件系统
对象属性面板中的自定义选项卡">
|
||||
<Rule RegPath="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" ValueName="NoCustomizeThisFolder" On="0" Off="1"/>
|
||||
<Rule RegPath="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" ValueName="NoCustomizeWebView" On="0" Off="1"/>
|
||||
@@ -36,6 +36,9 @@ ValueKind为键值类型,默认键值类型ValueKind为REG_DWORD,为默认
|
||||
<Rule RegPath="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer" ValueName="NoUninstallFromStart" On="0" Off="1"/>
|
||||
<Rule RegPath="HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer" ValueName="NoUninstallFromStart" On="0" Off="1"/>
|
||||
</Item>
|
||||
<Item Text="Win10 WinX菜单命令提示符替换为PowerShell" RestartExplorer="">
|
||||
<Rule RegPath="HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ValueName="DontUsePowerShellOnWinX" On="0" Off="1"/>
|
||||
</Item>
|
||||
</Group>
|
||||
|
||||
<Group Text="Bandizip" Guid="5b69a6b4-393b-459c-8ebb-214237a9e7ac" RegPath="HKEY_CURRENT_USER\SOFTWARE\Bandizip">
|
||||
|
||||
@@ -129,6 +129,7 @@ RecycleBinProperties = 属性(&R)
|
||||
RemovableDrive = 可移动磁盘
|
||||
BuildSendtoMenu = 快速构建发送到子菜单
|
||||
UseStoreOpenWith = 在Microsoft Store中查找应用
|
||||
WinXPowerShell = Win+X菜单命令提示符替换为PowerShell
|
||||
NewItem = 新建一个菜单项目
|
||||
AddGuidBlockedItem = 添加GUID锁定项目
|
||||
CurrentExtension = 你当前选择的文件格式为
|
||||
|
||||
Reference in New Issue
Block a user