1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Move update/install logic into helper

This commit is contained in:
Susko3 2024-02-07 22:06:09 +01:00
parent 0563507295
commit 6bdb076027

View File

@ -55,18 +55,7 @@ namespace osu.Desktop.Windows
{ {
try try
{ {
using (var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, writable: true)) updateAssociations();
{
if (classes == null)
return;
foreach (var association in file_associations)
association.Install(classes, EXE_PATH, PROGRAM_ID_PREFIX);
foreach (var association in uri_associations)
association.Install(classes, EXE_PATH);
}
updateDescriptions(localisation); updateDescriptions(localisation);
NotifyShellUpdate(); NotifyShellUpdate();
} }
@ -76,6 +65,24 @@ namespace osu.Desktop.Windows
} }
} }
/// <summary>
/// Installs or updates associations.
/// </summary>
private static void updateAssociations()
{
using (var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, writable: true))
{
if (classes == null)
return;
foreach (var association in file_associations)
association.Install(classes, EXE_PATH, PROGRAM_ID_PREFIX);
foreach (var association in uri_associations)
association.Install(classes, EXE_PATH);
}
}
private static void updateDescriptions(LocalisationManager? localisation) private static void updateDescriptions(LocalisationManager? localisation)
{ {
using var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, true); using var classes = Registry.CurrentUser.OpenSubKey(SOFTWARE_CLASSES, true);