using System.Diagnostics; using System.Runtime.InteropServices; namespace ZonyLrcTools.Desktop.Helpers; public static class UrlHelper { public static void OpenLink(string url) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { using var process = Process.Start(new ProcessStartInfo { FileName = "/bin/sh", Arguments = $"-c \"xdg-open {url.Replace("\"", "\\\"")}\"", RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }); } else { using var process = Process.Start(new ProcessStartInfo { FileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? url : "open", Arguments = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? url : "", CreateNoWindow = true, UseShellExecute = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) }); } } }