1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Move public methods closer together

This commit is contained in:
Susko3 2024-02-07 22:18:12 +01:00
parent 738c28755c
commit ffdefbc742

View File

@ -103,6 +103,28 @@ namespace osu.Desktop.Windows
}
}
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>
/// Installs or updates associations.
/// </summary>
@ -144,28 +166,6 @@ namespace osu.Desktop.Windows
}
}
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);
#region Native interop