2022-11-27 12:29:35 +00:00
|
|
|
using System;
|
2020-05-15 19:06:24 +01:00
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web.Auth
|
|
|
|
{
|
|
|
|
public static class BrowserUtil
|
|
|
|
{
|
|
|
|
public static void Open(Uri uri)
|
|
|
|
{
|
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
{
|
|
|
|
var uriStr = uri.ToString().Replace("&", "^&");
|
|
|
|
Process.Start(new ProcessStartInfo($"cmd", $"/c start {uriStr}"));
|
|
|
|
}
|
|
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
|
|
{
|
|
|
|
Process.Start("xdg-open", uri.ToString());
|
|
|
|
}
|
|
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
|
|
{
|
|
|
|
Process.Start("open", uri.ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|