diff --git a/EXILED/Exiled.Installer/Program.cs b/EXILED/Exiled.Installer/Program.cs index c7a43a2dcd..6f18258c2f 100644 --- a/EXILED/Exiled.Installer/Program.cs +++ b/EXILED/Exiled.Installer/Program.cs @@ -89,6 +89,30 @@ internal static async Task MainSafe(CommandSettings args) GitHubClient.Credentials = new Credentials(args.GitHubToken, AuthenticationType.Bearer); } + if (string.IsNullOrEmpty(args.TargetVersion) && !args.PreReleases) + { + Console.WriteLine(Resources.Program_MainSafe_Which_version_would_you_like_to_install_); + Console.WriteLine(Resources.Program_MainSafe__1___Latest_stable_release); + Console.WriteLine(Resources.Program_MainSafe__2___Latest_prerelease__beta_dev_); + + Console.Write(Resources.Program_MainSafe_Your_choice__1_2___); + ConsoleKeyInfo key = Console.ReadKey(intercept: true); + Console.WriteLine(key.KeyChar); + + if (key.KeyChar == '2') + { + args.PreReleases = true; + Console.WriteLine(Resources.Program_MainSafe_); + } + else + { + args.PreReleases = false; + Console.WriteLine(Resources.Program_MainSafe_); + } + } + + + Console.WriteLine(Resources.Program_MainSafe_Receiving_releases___); Console.WriteLine(Resources.Program_MainSafe_Prereleases_included____0_, args.PreReleases); Console.WriteLine(Resources.Program_MainSafe_Target_release_version____0_, string.IsNullOrEmpty(args.TargetVersion) ? "(null)" : args.TargetVersion); diff --git a/EXILED/Exiled.Installer/Properties/Resources.Designer.cs b/EXILED/Exiled.Installer/Properties/Resources.Designer.cs index e382401b53..b95cc93c54 100644 --- a/EXILED/Exiled.Installer/Properties/Resources.Designer.cs +++ b/EXILED/Exiled.Installer/Properties/Resources.Designer.cs @@ -1,39 +1,38 @@ //------------------------------------------------------------------------------ // -// Il codice è stato generato da uno strumento. -// Versione runtime:4.0.30319.42000 +// This code was generated by a tool. // -// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se -// il codice viene rigenerato. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ namespace Exiled.Installer.Properties { using System; - - + + /// - /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder. - // tramite uno strumento quale ResGen o Visual Studio. - // Per aggiungere o rimuovere un membro, modificare il file con estensione ResX ed eseguire nuovamente ResGen - // con l'opzione /str oppure ricompilare il progetto VS. + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - + /// - /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -45,10 +44,10 @@ internal Resources() { return resourceMan; } } - + /// - /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte le - /// ricerche di risorse eseguite utilizzando questa classe di risorse fortemente tipizzata. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -59,9 +58,9 @@ internal Resources() { resourceCulture = value; } } - + /// - /// Cerca una stringa localizzata simile a EXILED\:EXILED + /// Looks up a localized string similar to EXILED\:EXILED ///SCP Secret Laboratory\:ABSOLUTE ///. /// @@ -70,108 +69,153 @@ internal static string Markup { return ResourceManager.GetString("Markup", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Does it exist? - {0}. + /// Looks up a localized string similar to Does it exist? - {0}. /// internal static string Program_EnsureDirExists_Does_it_exist_____0_ { get { return ResourceManager.GetString("Program_EnsureDirExists_Does_it_exist_____0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Ensuring directory path: {0}. + /// Looks up a localized string similar to Ensuring directory path: {0}. /// internal static string Program_EnsureDirExists_Ensuring_directory_path___0_ { get { return ResourceManager.GetString("Program_EnsureDirExists_Ensuring_directory_path___0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a An exception occurred while trying to extract a file. + /// Looks up a localized string similar to An exception occurred while trying to extract a file. /// internal static string Program_ExtractEntry_An_exception_occurred_while_trying_to_extract_a_file { get { return ResourceManager.GetString("Program_ExtractEntry_An_exception_occurred_while_trying_to_extract_a_file", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Extracting '{0}' into '{1}'.... + /// Looks up a localized string similar to Extracting '{0}' into '{1}'.... /// internal static string Program_ExtractEntry_Extracting___0___into___1_____ { get { return ResourceManager.GetString("Program_ExtractEntry_Extracting___0___into___1_____", resourceCulture); } } - + + /// + /// Looks up a localized string similar to → Prerelease selected.. + /// + internal static string Program_MainSafe_ { + get { + return ResourceManager.GetString("Program_MainSafe_", resourceCulture); + } + } + /// - /// Cerca una stringa localizzata simile a --- ASSETS ---. + /// Looks up a localized string similar to --- ASSETS ---. /// internal static string Program_MainSafe_____ASSETS____ { get { return ResourceManager.GetString("Program_MainSafe_____ASSETS____", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a --- AVAILABLE VERSIONS ---. + /// Looks up a localized string similar to --- AVAILABLE VERSIONS ---. /// internal static string Program_MainSafe_____AVAILABLE_VERSIONS____ { get { return ResourceManager.GetString("Program_MainSafe_____AVAILABLE_VERSIONS____", resourceCulture); } } - + + /// + /// Looks up a localized string similar to --- RELEASES ---. + /// + internal static string Program_MainSafe_____RELEASES____ { + get { + return ResourceManager.GetString("Program_MainSafe_____RELEASES____", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 1 - Latest stable release. + /// + internal static string Program_MainSafe__1___Latest_stable_release { + get { + return ResourceManager.GetString("Program_MainSafe__1___Latest_stable_release", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to 2 - Latest prerelease (beta/dev). + /// + internal static string Program_MainSafe__2___Latest_prerelease__beta_dev_ { + get { + return ResourceManager.GetString("Program_MainSafe__2___Latest_prerelease__beta_dev_", resourceCulture); + } + } + /// - /// Cerca una stringa localizzata simile a AppData folder: {0}. + /// Looks up a localized string similar to AppData folder: {0}. /// internal static string Program_MainSafe_AppData_folder___0_ { get { return ResourceManager.GetString("Program_MainSafe_AppData_folder___0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Asset found!. + /// Looks up a localized string similar to Asset found!. /// internal static string Program_MainSafe_Asset_found_ { get { return ResourceManager.GetString("Program_MainSafe_Asset_found_", resourceCulture); } } - + + /// + /// Looks up a localized string similar to Couldn't find '{0}' in '{1}'. + /// + internal static string Program_MainSafe_Couldn_t_find___0___in___1__ { + get { + return ResourceManager.GetString("Program_MainSafe_Couldn_t_find___0___in___1__", resourceCulture); + } + } + /// - /// Cerca una stringa localizzata simile a Exiled folder: {0}. + /// Looks up a localized string similar to Exiled folder: {0}. /// internal static string Program_MainSafe_Exiled_folder___0_ { get { return ResourceManager.GetString("Program_MainSafe_Exiled_folder___0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Installation complete. + /// Looks up a localized string similar to Installation complete. /// internal static string Program_MainSafe_Installation_complete { get { return ResourceManager.GetString("Program_MainSafe_Installation_complete", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Prereleases included - {0}. + /// Looks up a localized string similar to Prereleases included - {0}. /// internal static string Program_MainSafe_Prereleases_included____0_ { get { return ResourceManager.GetString("Program_MainSafe_Prereleases_included____0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Read the exception message, read the readme, and if you still don't understand what to do, then contact #support in our discord server with the attached screenshot of the full exception. + /// Looks up a localized string similar to Read the exception message, read the readme, and if you still don't understand what to do, then contact #support in our discord server with the attached screenshot of the full exception. /// internal static string Program_MainSafe_Read_the_exception_message__read_the_readme__and_if_you_still_don_t_understand_what_to_do__then_contact__support_in_our_discord_server_with_the_attached_screenshot_of_the_full_exception { get { @@ -180,81 +224,99 @@ internal static string Program_MainSafe_Read_the_exception_message__read_the_rea "attached_screenshot_of_the_full_exception", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Receiving releases.... + /// Looks up a localized string similar to Receiving releases.... /// internal static string Program_MainSafe_Receiving_releases___ { get { return ResourceManager.GetString("Program_MainSafe_Receiving_releases___", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Release found!. + /// Looks up a localized string similar to Release found!. /// internal static string Program_MainSafe_Release_found_ { get { return ResourceManager.GetString("Program_MainSafe_Release_found_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Searching for the latest release that matches the parameters.... + /// Looks up a localized string similar to Searching for the latest release that matches the parameters.... /// internal static string Program_MainSafe_Searching_for_the_latest_release_that_matches_the_parameters___ { get { return ResourceManager.GetString("Program_MainSafe_Searching_for_the_latest_release_that_matches_the_parameters___", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Target release version - {0}. + /// Looks up a localized string similar to Target release version - {0}. /// internal static string Program_MainSafe_Target_release_version____0_ { get { return ResourceManager.GetString("Program_MainSafe_Target_release_version____0_", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Token detected! Using the token.... + /// Looks up a localized string similar to Token detected! Using the token.... /// internal static string Program_MainSafe_Token_detected__Using_the_token___ { get { return ResourceManager.GetString("Program_MainSafe_Token_detected__Using_the_token___", resourceCulture); } } - + + /// + /// Looks up a localized string similar to Which version would you like to install?. + /// + internal static string Program_MainSafe_Which_version_would_you_like_to_install_ { + get { + return ResourceManager.GetString("Program_MainSafe_Which_version_would_you_like_to_install_", resourceCulture); + } + } + /// - /// Cerca una stringa localizzata simile a Couldn't resolve path for '{0}', update installer. + /// Looks up a localized string similar to Your choice (1/2): . + /// + internal static string Program_MainSafe_Your_choice__1_2___ { + get { + return ResourceManager.GetString("Program_MainSafe_Your_choice__1_2___", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Couldn't resolve path for '{0}', update installer. /// internal static string Program_ProcessTarEntry_Couldn_t_resolve_path_for___0____update_installer { get { return ResourceManager.GetString("Program_ProcessTarEntry_Couldn_t_resolve_path_for___0____update_installer", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Extract for {0} is disabled. + /// Looks up a localized string similar to Extract for {0} is disabled. /// internal static string Program_ProcessTarEntry_Extract_for__0__is_disabled { get { return ResourceManager.GetString("Program_ProcessTarEntry_Extract_for__0__is_disabled", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Processing '{0}'. + /// Looks up a localized string similar to Processing '{0}'. /// internal static string Program_ProcessTarEntry_Processing___0__ { get { return ResourceManager.GetString("Program_ProcessTarEntry_Processing___0__", resourceCulture); } } - + /// - /// Cerca una stringa localizzata simile a Trying to find release... + /// Looks up a localized string similar to Trying to find release... /// internal static string Program_TryFindRelease_Trying_to_find_release__ { get { diff --git a/EXILED/Exiled.Installer/Properties/Resources.resx b/EXILED/Exiled.Installer/Properties/Resources.resx index 656ed6ad10..7c7ae02ee9 100644 --- a/EXILED/Exiled.Installer/Properties/Resources.resx +++ b/EXILED/Exiled.Installer/Properties/Resources.resx @@ -191,4 +191,19 @@ Exiled folder: {0} + + Which version would you like to install? + + + 1 - Latest stable release + + + 2 - Latest prerelease (beta/dev) + + + Your choice (1/2): + + + → Prerelease selected. + \ No newline at end of file diff --git a/EXILED/Exiled.Loader/Models/NewVersion.cs b/EXILED/Exiled.Loader/Models/NewVersion.cs index 81cb4f3e42..ea7e852373 100644 --- a/EXILED/Exiled.Loader/Models/NewVersion.cs +++ b/EXILED/Exiled.Loader/Models/NewVersion.cs @@ -24,15 +24,22 @@ public readonly struct NewVersion /// public readonly ReleaseAsset Asset; + /// + /// Indicates if the release is a prerelease. + /// + public readonly bool IsPrerelease; + /// /// Initializes a new instance of the struct. /// /// /// - public NewVersion(Release release, ReleaseAsset asset) + /// /// Indicates whether the release is a prerelease. + public NewVersion(Release release, ReleaseAsset asset, bool isPrerelease) { Release = release; Asset = asset; + IsPrerelease = isPrerelease; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Loader/Updater.cs b/EXILED/Exiled.Loader/Updater.cs index 7621e33c57..c82a4548c4 100644 --- a/EXILED/Exiled.Loader/Updater.cs +++ b/EXILED/Exiled.Loader/Updater.cs @@ -167,8 +167,11 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio } else { + bool isPrerelease = targetRelease.PreRelease; + Log.Info($"Release type: {(isPrerelease ? "Prerelease" : "Stable")}"); + Log.Info($"Found asset - Name: {asset.Name} | Size: {asset.Size} Download: {asset.BrowserDownloadUrl}"); - newVersion = new NewVersion(targetRelease, asset); + newVersion = new NewVersion(targetRelease, asset, isPrerelease); return true; } } @@ -226,7 +229,7 @@ private void Update(HttpClient client, NewVersion newVersion) FileName = installerPath, UseShellExecute = false, CreateNoWindow = true, - Arguments = $"--exit {(Folder == "global" ? string.Empty : $"--target-port {Folder}")} --target-version {newVersion.Release.TagName} --appdata \"{Paths.AppData}\" --exiled \"{Path.Combine(Paths.Exiled, "..")}\"", + Arguments = $"--exit {(Folder == "global" ? string.Empty : $"--target-port {Folder}")} --target-version {newVersion.Release.TagName} --appdata \"{Paths.AppData}\" --exiled \"{Path.Combine(Paths.Exiled, "..")}\" {(newVersion.IsPrerelease ? "--pre-releases" : string.Empty)}", RedirectStandardOutput = true, RedirectStandardError = true, StandardErrorEncoding = ProcessEncoding,