mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
27 lines
674 B
C#
27 lines
674 B
C#
|
using System.Diagnostics;
|
||
|
using System.Runtime.InteropServices;
|
||
|
using System;
|
||
|
|
||
|
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());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|