@@ -203,8 +203,8 @@ public async Task<bool> Apply(IProgress<InstallationProgress> progress,
203203 {
204204 Host . Log ( $ "Received fix application arguments: { arg } ") ;
205205
206- await Launcher . LaunchUriAsync ( new Uri ( $ "amethyst-app:crash-message#{ Host . RequestLocalizedString (
207- "/Plugins/KinectOne/Fixes/NotReady/Prompt/MustEnableKinectMicrophone" ) } " ) ) ;
206+ await $ "amethyst-app:crash-message#{ Host . RequestLocalizedString (
207+ "/Plugins/KinectOne/Fixes/NotReady/Prompt/MustEnableKinectMicrophone" ) } " . Launch ( ) ;
208208
209209 // Open sound control panel on the recording tab
210210 Process . Start ( "rundll32.exe" , "shell32.dll,Control_RunDLL mmsys.cpl,,1" ) ;
@@ -269,4 +269,61 @@ public static async Task CopyToWithProgressAsync(this Stream source,
269269 progress ? . Invoke ( total ) ;
270270 } while ( amtRead == bufferSize ) ;
271271 }
272+ }
273+
274+ public static class UriExtensions
275+ {
276+ public static Uri ToUri ( this string source )
277+ {
278+ return new Uri ( source ) ;
279+ }
280+
281+ public static async Task LaunchAsync ( this Uri uri )
282+ {
283+ try
284+ {
285+ if ( await Launcher . QueryAppUriSupportAsync ( uri ) is LaunchQuerySupportStatus . Available ||
286+ uri . Scheme is "amethyst-app" ) await Launcher . LaunchUriAsync ( uri ) ;
287+ }
288+ catch ( Exception )
289+ {
290+ // ignored
291+ }
292+ }
293+
294+ public static async Task Launch ( this string uri )
295+ {
296+ try
297+ {
298+ if ( PathsHandler . IsAmethystPackaged )
299+ {
300+ await uri . ToUri ( ) . LaunchAsync ( ) ;
301+ }
302+ else
303+ {
304+ // If we've found who asked
305+ if ( File . Exists ( Assembly . GetExecutingAssembly ( ) . Location ) )
306+ {
307+ var info = new ProcessStartInfo
308+ {
309+ FileName = Assembly . GetExecutingAssembly ( ) . Location . Replace ( ".dll" , ".exe" ) ,
310+ Arguments = uri
311+ } ;
312+
313+ try
314+ {
315+ Process . Start ( info ) ;
316+ }
317+ catch ( Exception )
318+ {
319+ // ignored
320+ }
321+ }
322+ }
323+ }
324+ catch ( Exception )
325+ {
326+ // ignored
327+ }
328+ }
272329}
0 commit comments