diff --git a/src/.vs/DiscordCLI/v16/.suo b/src/.vs/DiscordCLI/v16/.suo index 0784777..12a6ffe 100644 Binary files a/src/.vs/DiscordCLI/v16/.suo and b/src/.vs/DiscordCLI/v16/.suo differ diff --git a/src/DiscordCLI/PlatformType.cs b/src/DiscordCLI/PlatformType.cs new file mode 100644 index 0000000..bda479d --- /dev/null +++ b/src/DiscordCLI/PlatformType.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DiscordCLI +{ + internal enum PlatformType + { + Windows, + Linux, + LinuxARM + } +} \ No newline at end of file diff --git a/src/DiscordCLI/Program.cs b/src/DiscordCLI/Program.cs index 1c48df5..46157cd 100644 --- a/src/DiscordCLI/Program.cs +++ b/src/DiscordCLI/Program.cs @@ -6,6 +6,7 @@ using DSharpPlus.Exceptions; using Stone_Red_Utilities.ConsoleExtentions; using AlwaysUpToDate; using System.Diagnostics; +using System.Runtime.InteropServices; namespace DiscordCLI { @@ -17,12 +18,7 @@ namespace DiscordCLI private CommandsManager commandsManager; private InputManager inputManager; private OutputManager outputManager; - -#if DEBUG - private Updater updater = new Updater(new TimeSpan(0), "https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/develop/update/updateInfo.json", "./", true); -#else - private Updater updater = new Updater(new TimeSpan(0), "https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/main/update/updateInfo.json", "./", true); -#endif + private Updater updater; public static void Main() => new Program().Setup().GetAwaiter().GetResult(); @@ -31,6 +27,33 @@ namespace DiscordCLI Console.ForegroundColor = ConsoleColor.White; Console.OutputEncoding = System.Text.Encoding.UTF8; + PlatformType platformType; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (RuntimeInformation.ProcessArchitecture == Architecture.Arm || RuntimeInformation.ProcessArchitecture == Architecture.Arm64) + { + platformType = PlatformType.LinuxARM; + } + else + { + platformType = PlatformType.Linux; + } + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + platformType = PlatformType.Windows; + } + else + { + throw new PlatformNotSupportedException("DiscordCLI only supports Windows and Linux!"); + } +#if DEBUG + updater = new Updater(new TimeSpan(0), $"https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/develop/update/updateInfo{platformType}.json", "./", true); +#else + updater = new Updater(new TimeSpan(0), $"https://raw.githubusercontent.com/Stone-Red-Code/DiscordCLI/main/update/updateInfo{platformType}.json", "./", true); +#endif + updater.UpdateAvailible += Updater_UpdateAvailible; updater.NoUpdateAvailible += Updater_NoUpdateAvailible; updater.ProgressChanged += Updater_ProgressChanged; @@ -108,6 +131,7 @@ namespace DiscordCLI private void Updater_OnException(Exception exception) { + ConsoleExt.WriteLine("Update failed!", ConsoleColor.Red); ConsoleExt.WriteLine(exception.Message, ConsoleColor.Red); Environment.Exit(-1); } diff --git a/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll b/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll index 05832eb..ce44623 100644 Binary files a/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll and b/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.dll differ diff --git a/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb b/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb index d50b9ab..1328f09 100644 Binary files a/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb and b/src/DiscordCLI/bin/Debug/net5.0/DiscordCLI.pdb differ diff --git a/src/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll b/src/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll index f0dee32..0736271 100644 Binary files a/src/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll and b/src/DiscordCLI/bin/Debug/net5.0/ref/DiscordCLI.dll differ diff --git a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.AssemblyReference.cache b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.AssemblyReference.cache index 4956bb7..f5e894a 100644 Binary files a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.AssemblyReference.cache and b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.AssemblyReference.cache differ diff --git a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.CoreCompileInputs.cache b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.CoreCompileInputs.cache index b896f60..ea4e015 100644 --- a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.CoreCompileInputs.cache +++ b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -6b2fcd6f6be795bf368acd9bea6af905c3230f40 +5819de5694d0ca464238a467fd3b6e9087ce8675 diff --git a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll index 05832eb..ce44623 100644 Binary files a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll and b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.dll differ diff --git a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb index d50b9ab..1328f09 100644 Binary files a/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb and b/src/DiscordCLI/obj/Debug/net5.0/DiscordCLI.pdb differ diff --git a/src/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll b/src/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll index f0dee32..0736271 100644 Binary files a/src/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll and b/src/DiscordCLI/obj/Debug/net5.0/ref/DiscordCLI.dll differ diff --git a/update/updateInfo.json b/update/updateInfoWindows.json similarity index 100% rename from update/updateInfo.json rename to update/updateInfoWindows.json