From 4277fbaa98437c24d0c753ae747bb70767e6a9a3 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 21 Nov 2022 08:43:54 +1000 Subject: [PATCH] Add architecture variants to tshock installer --- TShockInstaller/Program.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/TShockInstaller/Program.cs b/TShockInstaller/Program.cs index 0d033906..01f8cc84 100644 --- a/TShockInstaller/Program.cs +++ b/TShockInstaller/Program.cs @@ -11,13 +11,26 @@ Console.WriteLine($"TShock Installer {typeof(Program).GetType().Assembly.GetName Console.WriteLine("Determining dotnet runtime url..."); +var arch = RuntimeInformation.ProcessArchitecture switch +{ + Architecture.X64 => "x64", + Architecture.Arm64 => "arm64", + _ => null +}; + +if (arch is null) +{ + Console.WriteLine($"{RuntimeInformation.ProcessArchitecture} is not yet supported via this installer."); + return; +} + string? url = null; if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - url = "https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-osx-x64.tar.gz"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-osx-{arch}.tar.gz"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - url = "https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-win-x64.zip"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-win-{arch}.zip"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) - url = "https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-linux-x64.tar.gz"; + url = $"https://dotnetcli.azureedge.net/dotnet/Runtime/6.0.11/dotnet-runtime-6.0.11-linux-{arch}.tar.gz"; if(url is null) {