diff --git a/src/ui/Logic/FileTypeAssociations.cs b/src/ui/Logic/FileTypeAssociations.cs index 4e3431e74..34dbde3a8 100644 --- a/src/ui/Logic/FileTypeAssociations.cs +++ b/src/ui/Logic/FileTypeAssociations.cs @@ -97,13 +97,25 @@ namespace Nikse.SubtitleEdit.Logic internal static void DeleteFileAssociationViaRegistry(string ext, string appName) { + var appExtensionRegKey = $"{appName}{ext}"; using (var registryKey = Registry.CurrentUser.OpenSubKey(@"Software\Classes\", true)) { - if (registryKey?.OpenSubKey($"{appName}{ext}") != null) + if (registryKey?.OpenSubKey(appExtensionRegKey) != null) { registryKey.DeleteSubKeyTree($"{appName}{ext}"); } } + + // (Default) + const string defaultRegValueName = ""; + using (var registryKey = Registry.CurrentUser.OpenSubKey("Software\\Classes\\" + ext, true)) + { + var registryValue = registryKey?.GetValue(defaultRegValueName); + if (appExtensionRegKey.Equals((string)registryValue, StringComparison.Ordinal)) + { + registryKey.DeleteValue(defaultRegValueName); + } + } } internal static void Refresh() @@ -112,4 +124,4 @@ namespace Nikse.SubtitleEdit.Logic SHChangeNotify(0x08000000, 0x2000, IntPtr.Zero, IntPtr.Zero); } } -} +} \ No newline at end of file