UrlHelper.cs 866 B

1234567891011121314151617181920212223242526272829
  1. using Ryujinx.Common.Logging;
  2. using System.Diagnostics;
  3. using System.Runtime.InteropServices;
  4. namespace Ryujinx.Ui
  5. {
  6. static class UrlHelper
  7. {
  8. public static void OpenUrl(string url)
  9. {
  10. if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
  11. {
  12. Process.Start(new ProcessStartInfo("cmd", $"/c start {url.Replace("&", "^&")}"));
  13. }
  14. else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
  15. {
  16. Process.Start("xdg-open", url);
  17. }
  18. else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
  19. {
  20. Process.Start("open", url);
  21. }
  22. else
  23. {
  24. Logger.Notice.Print(LogClass.Application, $"Cannot open url \"{url}\" on this platform!");
  25. }
  26. }
  27. }
  28. }