1
1
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2
2
// See the LICENCE file in the repository root for full licence text.
3
3
4
- #nullable disable
5
-
6
4
using System ;
7
5
using System . Collections . Generic ;
8
6
using System . Diagnostics ;
22
20
using osu . Desktop . Windows ;
23
21
using osu . Framework . Threading ;
24
22
using osu . Game . IO ;
23
+ using osu . Game . IPC ;
25
24
26
25
namespace osu . Desktop
27
26
{
28
27
internal class OsuGameDesktop : OsuGame
29
28
{
30
- public OsuGameDesktop ( string [ ] args = null )
29
+ private OsuSchemeLinkIPCChannel ? osuSchemeLinkIPCChannel ;
30
+
31
+ public OsuGameDesktop ( string [ ] ? args = null )
31
32
: base ( args )
32
33
{
33
34
}
34
35
35
- public override StableStorage GetStorageForStableInstall ( )
36
+ public override StableStorage ? GetStorageForStableInstall ( )
36
37
{
37
38
try
38
39
{
39
40
if ( Host is DesktopGameHost desktopHost )
40
41
{
41
- string stablePath = getStableInstallPath ( ) ;
42
+ string ? stablePath = getStableInstallPath ( ) ;
42
43
if ( ! string . IsNullOrEmpty ( stablePath ) )
43
44
return new StableStorage ( stablePath , desktopHost ) ;
44
45
}
@@ -51,11 +52,11 @@ public override StableStorage GetStorageForStableInstall()
51
52
return null ;
52
53
}
53
54
54
- private string getStableInstallPath ( )
55
+ private string ? getStableInstallPath ( )
55
56
{
56
57
static bool checkExists ( string p ) => Directory . Exists ( Path . Combine ( p , "Songs" ) ) || File . Exists ( Path . Combine ( p , "osu!.cfg" ) ) ;
57
58
58
- string stableInstallPath ;
59
+ string ? stableInstallPath ;
59
60
60
61
if ( OperatingSystem . IsWindows ( ) )
61
62
{
@@ -83,15 +84,15 @@ private string getStableInstallPath()
83
84
}
84
85
85
86
[ SupportedOSPlatform ( "windows" ) ]
86
- private string getStableInstallPathFromRegistry ( )
87
+ private string ? getStableInstallPathFromRegistry ( )
87
88
{
88
- using ( RegistryKey key = Registry . ClassesRoot . OpenSubKey ( "osu" ) )
89
+ using ( RegistryKey ? key = Registry . ClassesRoot . OpenSubKey ( "osu" ) )
89
90
return key ? . OpenSubKey ( @"shell\open\command" ) ? . GetValue ( string . Empty ) ? . ToString ( ) ? . Split ( '"' ) [ 1 ] . Replace ( "osu!.exe" , "" ) ;
90
91
}
91
92
92
93
protected override UpdateManager CreateUpdateManager ( )
93
94
{
94
- string packageManaged = Environment . GetEnvironmentVariable ( "OSU_EXTERNAL_UPDATE_PROVIDER" ) ;
95
+ string ? packageManaged = Environment . GetEnvironmentVariable ( "OSU_EXTERNAL_UPDATE_PROVIDER" ) ;
95
96
96
97
if ( ! string . IsNullOrEmpty ( packageManaged ) )
97
98
return new NoActionUpdateManager ( ) ;
@@ -118,6 +119,8 @@ protected override void LoadComplete()
118
119
LoadComponentAsync ( new GameplayWinKeyBlocker ( ) , Add ) ;
119
120
120
121
LoadComponentAsync ( new ElevatedPrivilegesChecker ( ) , Add ) ;
122
+
123
+ osuSchemeLinkIPCChannel = new OsuSchemeLinkIPCChannel ( Host , this ) ;
121
124
}
122
125
123
126
public override void SetHost ( GameHost host )
@@ -135,7 +138,7 @@ public override void SetHost(GameHost host)
135
138
}
136
139
137
140
private readonly List < string > importableFiles = new List < string > ( ) ;
138
- private ScheduledDelegate importSchedule ;
141
+ private ScheduledDelegate ? importSchedule ;
139
142
140
143
private void fileDrop ( string [ ] filePaths )
141
144
{
@@ -168,5 +171,11 @@ private void handlePendingImports()
168
171
Task . Factory . StartNew ( ( ) => Import ( paths ) , TaskCreationOptions . LongRunning ) ;
169
172
}
170
173
}
174
+
175
+ protected override void Dispose ( bool isDisposing )
176
+ {
177
+ base . Dispose ( isDisposing ) ;
178
+ osuSchemeLinkIPCChannel ? . Dispose ( ) ;
179
+ }
171
180
}
172
181
}
0 commit comments