mirror of
https://github.com/BluePointLilac/ContextMenuManager.git
synced 2026-01-14 06:04:00 +08:00
添加杀软保护提示
This commit is contained in:
@@ -34,13 +34,13 @@ namespace BulePointLilac.Methods
|
||||
public static void MoveTo(this RegistryKey srcKey, RegistryKey dstKey)
|
||||
{
|
||||
CopyTo(srcKey, dstKey);
|
||||
DeleteKeyTree(srcKey.Name);
|
||||
DeleteKeyTree(srcKey.Name, true);
|
||||
}
|
||||
|
||||
public static void MoveTo(string srcPath, string dstPath)
|
||||
{
|
||||
CopyTo(srcPath, dstPath);
|
||||
DeleteKeyTree(srcPath);
|
||||
DeleteKeyTree(srcPath, true);
|
||||
}
|
||||
|
||||
public static RegistryKey CreateSubKey(this RegistryKey key, string subKeyName, bool writable)
|
||||
|
||||
@@ -77,7 +77,15 @@ namespace ContextMenuManager.Controls
|
||||
set
|
||||
{
|
||||
if(!value && TryProtectOpenItem) return;
|
||||
RegistryEx.MoveTo(RegPath, BackupPath);
|
||||
try
|
||||
{
|
||||
RegistryEx.MoveTo(RegPath, BackupPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.AuthorityProtection);
|
||||
return;
|
||||
}
|
||||
RegPath = BackupPath;
|
||||
}
|
||||
}
|
||||
@@ -234,8 +242,16 @@ namespace ContextMenuManager.Controls
|
||||
|
||||
public void DeleteMe()
|
||||
{
|
||||
RegistryEx.DeleteKeyTree(this.RegPath);
|
||||
RegistryEx.DeleteKeyTree(this.BackupPath);
|
||||
try
|
||||
{
|
||||
RegistryEx.DeleteKeyTree(this.RegPath, true);
|
||||
RegistryEx.DeleteKeyTree(this.BackupPath, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.AuthorityProtection);
|
||||
return;
|
||||
}
|
||||
this.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,30 +222,37 @@ namespace ContextMenuManager.Controls
|
||||
}
|
||||
set
|
||||
{
|
||||
if(value)
|
||||
try
|
||||
{
|
||||
RegistryEx.DeleteValue(RegPath, "CommandFlags");
|
||||
RegistryEx.DeleteValue(RegPath, "HideBasedOnVelocityId");
|
||||
RegistryEx.DeleteValue(RegPath, "LegacyDisable");
|
||||
RegistryEx.DeleteValue(RegPath, "ProgrammaticAccessOnly");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(TryProtectOpenItem) return;
|
||||
if(!IsSubItem)
|
||||
if(value)
|
||||
{
|
||||
Registry.SetValue(RegPath, "LegacyDisable", string.Empty);
|
||||
Registry.SetValue(RegPath, "ProgrammaticAccessOnly", string.Empty);
|
||||
}
|
||||
else if(WindowsOsVersion.IsAfterOrEqualWin10_1703)
|
||||
{
|
||||
Registry.SetValue(RegPath, "HideBasedOnVelocityId", 0x639bc8);
|
||||
RegistryEx.DeleteValue(RegPath, "CommandFlags");
|
||||
RegistryEx.DeleteValue(RegPath, "HideBasedOnVelocityId");
|
||||
RegistryEx.DeleteValue(RegPath, "LegacyDisable");
|
||||
RegistryEx.DeleteValue(RegPath, "ProgrammaticAccessOnly");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.CannotHideSubItem);
|
||||
if(TryProtectOpenItem) return;
|
||||
if(!IsSubItem)
|
||||
{
|
||||
Registry.SetValue(RegPath, "LegacyDisable", string.Empty);
|
||||
Registry.SetValue(RegPath, "ProgrammaticAccessOnly", string.Empty);
|
||||
}
|
||||
else if(WindowsOsVersion.IsAfterOrEqualWin10_1703)
|
||||
{
|
||||
Registry.SetValue(RegPath, "HideBasedOnVelocityId", 0x639bc8);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.CannotHideSubItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.AuthorityProtection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +512,15 @@ namespace ContextMenuManager.Controls
|
||||
|
||||
public virtual void DeleteMe()
|
||||
{
|
||||
RegistryEx.DeleteKeyTree(this.RegPath);
|
||||
try
|
||||
{
|
||||
RegistryEx.DeleteKeyTree(this.RegPath, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBoxEx.Show(AppString.MessageBox.AuthorityProtection);
|
||||
return;
|
||||
}
|
||||
this.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user