mirror of
https://github.com/ppy/osu
synced 2024-12-28 18:02:53 +00:00
Remove Win32Icon
class and use plain strings instead
This commit is contained in:
parent
17033e09f6
commit
57d5717e6a
@ -1,10 +1,17 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace osu.Desktop.Windows
|
||||
{
|
||||
public static class Icons
|
||||
{
|
||||
public static Win32Icon Lazer => new Win32Icon(@"lazer.ico");
|
||||
/// <summary>
|
||||
/// Fully qualified path to the directory that contains icons (in the installation folder).
|
||||
/// </summary>
|
||||
private static readonly string icon_directory = Path.GetDirectoryName(typeof(Icons).Assembly.Location)!;
|
||||
|
||||
public static string Lazer => Path.Join(icon_directory, "lazer.ico");
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Desktop.Windows
|
||||
{
|
||||
public class Win32Icon
|
||||
{
|
||||
public readonly string Path;
|
||||
|
||||
internal Win32Icon(string name)
|
||||
{
|
||||
string dir = System.IO.Path.GetDirectoryName(typeof(Win32Icon).Assembly.Location)!;
|
||||
Path = System.IO.Path.Join(dir, name);
|
||||
}
|
||||
}
|
||||
}
|
@ -173,7 +173,7 @@ namespace osu.Desktop.Windows
|
||||
|
||||
#endregion
|
||||
|
||||
private record FileAssociation(string Extension, LocalisableString Description, Win32Icon Icon)
|
||||
private record FileAssociation(string Extension, LocalisableString Description, string IconPath)
|
||||
{
|
||||
private string getProgramId(string prefix) => $@"{prefix}.File{Extension}";
|
||||
|
||||
@ -188,7 +188,7 @@ namespace osu.Desktop.Windows
|
||||
using (var programKey = classes.CreateSubKey(programId))
|
||||
{
|
||||
using (var defaultIconKey = programKey.CreateSubKey(DEFAULT_ICON))
|
||||
defaultIconKey.SetValue(null, Icon.Path);
|
||||
defaultIconKey.SetValue(null, IconPath);
|
||||
|
||||
using (var openCommandKey = programKey.CreateSubKey(SHELL_OPEN_COMMAND))
|
||||
openCommandKey.SetValue(null, $@"""{exePath}"" ""%1""");
|
||||
@ -225,7 +225,7 @@ namespace osu.Desktop.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private record UriAssociation(string Protocol, LocalisableString Description, Win32Icon Icon)
|
||||
private record UriAssociation(string Protocol, LocalisableString Description, string IconPath)
|
||||
{
|
||||
/// <summary>
|
||||
/// "The <c>URL Protocol</c> string value indicates that this key declares a custom pluggable protocol handler."
|
||||
@ -243,7 +243,7 @@ namespace osu.Desktop.Windows
|
||||
protocolKey.SetValue(URL_PROTOCOL, string.Empty);
|
||||
|
||||
using (var defaultIconKey = protocolKey.CreateSubKey(DEFAULT_ICON))
|
||||
defaultIconKey.SetValue(null, Icon.Path);
|
||||
defaultIconKey.SetValue(null, IconPath);
|
||||
|
||||
using (var openCommandKey = protocolKey.CreateSubKey(SHELL_OPEN_COMMAND))
|
||||
openCommandKey.SetValue(null, $@"""{exePath}"" ""%1""");
|
||||
|
Loading…
Reference in New Issue
Block a user