mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-09-05 21:16:52 +00:00
feat: Added a settings page.
This commit is contained in:
33
src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs
Normal file
33
src/ZonyLrcTools.Desktop/Helpers/UrlHelper.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user