mirror of
https://github.com/ppy/osu
synced 2025-03-01 17:11:12 +00:00
Refactor public methods
This commit is contained in:
parent
6bdb076027
commit
738c28755c
@ -174,10 +174,11 @@ namespace osu.Desktop
|
|||||||
{
|
{
|
||||||
tools.CreateShortcutForThisExe();
|
tools.CreateShortcutForThisExe();
|
||||||
tools.CreateUninstallerRegistryEntry();
|
tools.CreateUninstallerRegistryEntry();
|
||||||
WindowsAssociationManager.InstallAssociations(null);
|
WindowsAssociationManager.InstallAssociations();
|
||||||
}, onAppUpdate: (_, tools) =>
|
}, onAppUpdate: (_, tools) =>
|
||||||
{
|
{
|
||||||
tools.CreateUninstallerRegistryEntry();
|
tools.CreateUninstallerRegistryEntry();
|
||||||
|
WindowsAssociationManager.UpdateAssociations();
|
||||||
}, onAppUninstall: (_, tools) =>
|
}, onAppUninstall: (_, tools) =>
|
||||||
{
|
{
|
||||||
tools.RemoveShortcutForThisExe();
|
tools.RemoveShortcutForThisExe();
|
||||||
|
@ -51,12 +51,18 @@ namespace osu.Desktop.Windows
|
|||||||
new UriAssociation(@"osump", WindowsAssociationManagerStrings.OsuMultiplayer, Icons.Lazer),
|
new UriAssociation(@"osump", WindowsAssociationManagerStrings.OsuMultiplayer, Icons.Lazer),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void InstallAssociations(LocalisationManager? localisation)
|
/// <summary>
|
||||||
|
/// Installs file and URI associations.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Call <see cref="UpdateDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||||
|
/// </remarks>
|
||||||
|
public static void InstallAssociations()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
updateAssociations();
|
updateAssociations();
|
||||||
updateDescriptions(localisation);
|
updateDescriptions(null); // write default descriptions in case `UpdateDescriptions()` is not called.
|
||||||
NotifyShellUpdate();
|
NotifyShellUpdate();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -65,6 +71,38 @@ namespace osu.Desktop.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates associations with latest definitions.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Call <see cref="UpdateDescriptions"/> in a timely fashion to keep descriptions up-to-date and localised.
|
||||||
|
/// </remarks>
|
||||||
|
public static void UpdateAssociations()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateAssociations();
|
||||||
|
NotifyShellUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Log(@$"Failed to update file and URI associations: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateDescriptions(LocalisationManager localisationManager)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateDescriptions(localisationManager);
|
||||||
|
NotifyShellUpdate();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Log(@$"Failed to update file and URI association descriptions: {e.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Installs or updates associations.
|
/// Installs or updates associations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user