Skip to content

Commit

Permalink
Repair Discord button
Browse files Browse the repository at this point in the history
  • Loading branch information
cydyn committed Feb 28, 2024
1 parent 240abde commit 0a842c8
Showing 1 changed file with 37 additions and 7 deletions.
44 changes: 37 additions & 7 deletions Intersect.Client/Interface/Menu/LoginWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;

Expand Down Expand Up @@ -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}");
}
}
Expand Down

0 comments on commit 0a842c8

Please sign in to comment.