mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-25 15:36:26 +00:00
29 lines
802 B
C#
29 lines
802 B
C#
|
using System.Diagnostics;
|
|||
|
using System.Runtime.InteropServices;
|
|||
|
|
|||
|
namespace SpotifyAPI.Web.Auth
|
|||
|
{
|
|||
|
internal static class AuthUtil
|
|||
|
{
|
|||
|
public static void OpenBrowser(string url)
|
|||
|
{
|
|||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|||
|
{
|
|||
|
url = url.Replace("&", "^&");
|
|||
|
Process.Start(new ProcessStartInfo("cmd", $"/c start {url}"));
|
|||
|
}
|
|||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|||
|
{
|
|||
|
Process.Start("xdg-open", url);
|
|||
|
}
|
|||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|||
|
{
|
|||
|
Process.Start("open", url);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// throw
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|