Skip to content

Commit

Permalink
Fixed registry issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaex committed Aug 8, 2024
1 parent 6ddb37f commit 9df562f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
11 changes: 2 additions & 9 deletions ShareX.HelpersLib/Helpers/RegistryHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 63,13 @@ public static void CreateRegistry(string path, string name, int value, RegistryH
}
}

public static void RemoveRegistry(string path, bool recursive = false, RegistryHive root = RegistryHive.CurrentUser)
public static void RemoveRegistry(string path, RegistryHive root = RegistryHive.CurrentUser)
{
if (!string.IsNullOrEmpty(path))
{
using (RegistryKey rk = RegistryKey.OpenBaseKey(root, RegistryView.Default))
{
if (recursive)
{
rk.DeleteSubKeyTree(path, false);
}
else
{
rk.DeleteSubKey(path, false);
}
rk.DeleteSubKeyTree(path, false);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions ShareX/IntegrationHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 122,8 @@ private static void RegisterShellContextMenuButton()

private static void UnregisterShellContextMenuButton()
{
RegistryHelpers.RemoveRegistry(ShellExtMenuFiles, true);
RegistryHelpers.RemoveRegistry(ShellExtMenuDirectory, true);
RegistryHelpers.RemoveRegistry(ShellExtMenuFiles);
RegistryHelpers.RemoveRegistry(ShellExtMenuDirectory);
}

public static bool CheckEditShellContextMenuButton()
Expand Down Expand Up @@ -169,7 169,7 @@ private static void RegisterEditShellContextMenuButton()

private static void UnregisterEditShellContextMenuButton()
{
RegistryHelpers.RemoveRegistry(ShellExtEditImage, true);
RegistryHelpers.RemoveRegistry(ShellExtEditImage);
}

public static bool CheckCustomUploaderExtension()
Expand Down Expand Up @@ -220,7 220,7 @@ private static void RegisterCustomUploaderExtension()
private static void UnregisterCustomUploaderExtension()
{
RegistryHelpers.RemoveRegistry(ShellCustomUploaderExtensionPath);
RegistryHelpers.RemoveRegistry(ShellCustomUploaderAssociatePath, true);
RegistryHelpers.RemoveRegistry(ShellCustomUploaderAssociatePath);
}

public static bool CheckImageEffectExtension()
Expand Down Expand Up @@ -271,7 271,7 @@ private static void RegisterImageEffectExtension()
private static void UnregisterImageEffectExtension()
{
RegistryHelpers.RemoveRegistry(ShellImageEffectExtensionPath);
RegistryHelpers.RemoveRegistry(ShellImageEffectAssociatePath, true);
RegistryHelpers.RemoveRegistry(ShellImageEffectAssociatePath);
}

public static bool CheckChromeExtensionSupport()
Expand Down

0 comments on commit 9df562f

Please sign in to comment.