diff --git a/Intersect.Client/Interface/Menu/LoginWindow.cs b/Intersect.Client/Interface/Menu/LoginWindow.cs index f1d2ebd544..d200df3a37 100644 --- a/Intersect.Client/Interface/Menu/LoginWindow.cs +++ b/Intersect.Client/Interface/Menu/LoginWindow.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; @@ -237,17 +238,46 @@ void DiscordButton_Clicked(Base sender, ClickedEventArgs arguments) { try { - System.Diagnostics.Process.Start(new ProcessStartInfo + // Spróbuj otworzyć link za pomocą odpowiedniego polecenia dla danego systemu operacyjnego + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - FileName = "cmd", - Arguments = $"/c start https://discord.com/", - UseShellExecute = false, - CreateNoWindow = true - }); + System.Diagnostics.Process.Start(new ProcessStartInfo + { + FileName = "cmd", + Arguments = $"/c start https://discord.gg/ztKp93zvzb", + UseShellExecute = false, + CreateNoWindow = true + }); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + System.Diagnostics.Process.Start(new ProcessStartInfo + { + FileName = "xdg-open", + Arguments = $"\"https://discord.gg/ztKp93zvzb\"", + UseShellExecute = false, + CreateNoWindow = true + }); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) + { + System.Diagnostics.Process.Start(new ProcessStartInfo + { + FileName = "open", + Arguments = $"\"https://discord.gg/ztKp93zvzb\"", + UseShellExecute = false, + CreateNoWindow = true + }); + } + else + { + // Obsługa błędu dla nieobsługiwanego systemu operacyjnego + Console.WriteLine("Unsupported operating system."); + } } catch (Exception ex) { - // Error if it doesn't open the link + // Obsłużanie błędu, jeśli nie udało się otworzyć linku Console.WriteLine($"Error opening Discord link: {ex.Message}"); } }