mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Added check for null when removing registry keys
This commit is contained in:
parent
898427b26a
commit
1eac6001ab
1 changed files with 16 additions and 12 deletions
|
|
@ -1,6 +1,8 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
|
@ -100,14 +102,15 @@ private static void DissociateExtension(string applicationExecutablePath, string
|
|||
{
|
||||
try
|
||||
{
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Classes", true);
|
||||
key.DeleteSubKeyTree(extension + "_auto_file");
|
||||
key.DeleteSubKeyTree("." + extension);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes", true);
|
||||
RegistryKey subKeyTree = Registry.CurrentUser.OpenSubKey(@"Software\Classes\" + extension + "_auto_file", true);
|
||||
if (subKeyTree != null)
|
||||
{
|
||||
key.DeleteSubKeyTree(extension + "_auto_file");
|
||||
key.DeleteSubKeyTree("." + extension);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static void MenuIntegrate(string action)
|
||||
|
|
@ -132,13 +135,14 @@ private static void MenuIntegrate(string action)
|
|||
if (action == "disable")
|
||||
{
|
||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\", true);
|
||||
key.DeleteSubKeyTree("Crypto Notepad");
|
||||
RegistryKey subKeyTree = Registry.CurrentUser.OpenSubKey(@"Software\Classes\*\shell\Crypto Notepad", true);
|
||||
if (subKeyTree != null)
|
||||
{
|
||||
key.DeleteSubKeyTree("Crypto Notepad");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
/*Functions*/
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue