Move public methods closer together

This commit is contained in:
Susko3 2024-02-07 22:18:12 +01:00
parent 738c28755c
commit ffdefbc742
1 changed files with 22 additions and 22 deletions

View File

@ -103,6 +103,28 @@ public static void UpdateDescriptions(LocalisationManager localisationManager)
} }
} }
public static void UninstallAssociations()
{
try
{
using var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, true);
if (classes == null)
return;
foreach (var association in file_associations)
association.Uninstall(classes, PROGRAM_ID_PREFIX);
foreach (var association in uri_associations)
association.Uninstall(classes);
NotifyShellUpdate();
}
catch (Exception e)
{
Logger.Log($@"Failed to uninstall file and URI associations: {e.Message}");
}
}
/// <summary> /// <summary>
/// Installs or updates associations. /// Installs or updates associations.
/// </summary> /// </summary>
@ -144,28 +166,6 @@ string getLocalisedString(LocalisableString s)
} }
} }
public static void UninstallAssociations()
{
try
{
using var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, true);
if (classes == null)
return;
foreach (var association in file_associations)
association.Uninstall(classes, PROGRAM_ID_PREFIX);
foreach (var association in uri_associations)
association.Uninstall(classes);
NotifyShellUpdate();
}
catch (Exception e)
{
Logger.Log($@"Failed to uninstall file and URI associations: {e.Message}");
}
}
internal static void NotifyShellUpdate() => SHChangeNotify(EventId.SHCNE_ASSOCCHANGED, Flags.SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero); internal static void NotifyShellUpdate() => SHChangeNotify(EventId.SHCNE_ASSOCCHANGED, Flags.SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
#region Native interop #region Native interop