diff --git a/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.Designer.cs b/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.Designer.cs
index 4beaf39..74e9206 100644
--- a/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.Designer.cs
+++ b/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.Designer.cs
@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
//
-// Dieser Code wurde von einem Tool generiert.
-// Laufzeitversion:4.0.30319.42000
+// This code was generated by a tool.
//
-// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
-// der Code erneut generiert wird.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
//
//------------------------------------------------------------------------------
@@ -12,46 +11,32 @@ namespace ModpackUpdater.Apps.Client.Gui.LangRes {
using System;
- ///
- /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
- ///
- // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
- // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
- // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
- // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class GeneralLangRes {
- private static global::System.Resources.ResourceManager resourceMan;
+ private static System.Resources.ResourceManager resourceMan;
- private static global::System.Globalization.CultureInfo resourceCulture;
+ private static System.Globalization.CultureInfo resourceCulture;
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal GeneralLangRes() {
}
- ///
- /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- public static global::System.Resources.ResourceManager ResourceManager {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static System.Resources.ResourceManager ResourceManager {
get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
+ if (object.Equals(null, resourceMan)) {
+ System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
- ///
- /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
- /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- public static global::System.Globalization.CultureInfo Culture {
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -60,166 +45,118 @@ namespace ModpackUpdater.Apps.Client.Gui.LangRes {
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die An update is available! ähnelt.
- ///
public static string AnUpdateIsAvailable {
get {
return ResourceManager.GetString("AnUpdateIsAvailable", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Check for updates ähnelt.
- ///
public static string CheckForUpdates {
get {
return ResourceManager.GetString("CheckForUpdates", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Checking for Updates... ähnelt.
- ///
public static string CheckingForUpdates {
get {
return ResourceManager.GetString("CheckingForUpdates", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Config incomplete or not loaded! ähnelt.
- ///
public static string ConfigIncompleteOrNotLoaded {
get {
return ResourceManager.GetString("ConfigIncompleteOrNotLoaded", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Downloading program update... ähnelt.
- ///
public static string DownloadProgramUpdate {
get {
return ResourceManager.GetString("DownloadProgramUpdate", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Error on update check or while updating! ähnelt.
- ///
public static string ErrorOnUpdateCheckOrUpdating {
get {
return ResourceManager.GetString("ErrorOnUpdateCheckOrUpdating", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Everything is right and up-to-date. ähnelt.
- ///
public static string EverythingIsRightAndUpToDate {
get {
return ResourceManager.GetString("EverythingIsRightAndUpToDate", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Install ähnelt.
- ///
public static string Install {
get {
return ResourceManager.GetString("Install", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Installation key ähnelt.
- ///
public static string InstallationKey {
get {
return ResourceManager.GetString("InstallationKey", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Installing... ähnelt.
- ///
public static string Installing {
get {
return ResourceManager.GetString("Installing", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Minecraft profile ähnelt.
- ///
public static string MinecraftProfile {
get {
return ResourceManager.GetString("MinecraftProfile", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Minecraft profile folder seems to be not valid. ähnelt.
- ///
public static string MinecraftProfileFolderSeemsInvalid {
get {
return ResourceManager.GetString("MinecraftProfileFolderSeemsInvalid", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Modpack config url ähnelt.
- ///
public static string ModpackConfigUrl {
get {
return ResourceManager.GetString("ModpackConfigUrl", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Repair ähnelt.
- ///
public static string Repair {
get {
return ResourceManager.GetString("Repair", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Select ähnelt.
- ///
public static string Select {
get {
return ResourceManager.GetString("Select", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Select the minecraft profile folder (usually named .minecraft) ähnelt.
- ///
public static string SelectMinecraftProfileFolder {
get {
return ResourceManager.GetString("SelectMinecraftProfileFolder", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die Status ähnelt.
- ///
public static string Status {
get {
return ResourceManager.GetString("Status", resourceCulture);
}
}
- ///
- /// Sucht eine lokalisierte Zeichenfolge, die The update servers are in maintenance. ähnelt.
- ///
public static string UpdateServerInMaintenance {
get {
return ResourceManager.GetString("UpdateServerInMaintenance", resourceCulture);
}
}
+
+ public static string InstallationKeyNotValid {
+ get {
+ return ResourceManager.GetString("InstallationKeyNotValid", resourceCulture);
+ }
+ }
}
}
diff --git a/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.resx b/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.resx
index 5203ba1..90f2ef1 100644
--- a/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.resx
+++ b/ModpackUpdater.Apps.Client.Gui/LangRes/GeneralLangRes.resx
@@ -171,4 +171,7 @@
The update servers are in maintenance.
+
+ Installation key seems to be invalid
+
\ No newline at end of file
diff --git a/ModpackUpdater.Apps.Client.Gui/MainForm.axaml.cs b/ModpackUpdater.Apps.Client.Gui/MainForm.axaml.cs
index 4b347aa..90d5ceb 100644
--- a/ModpackUpdater.Apps.Client.Gui/MainForm.axaml.cs
+++ b/ModpackUpdater.Apps.Client.Gui/MainForm.axaml.cs
@@ -111,7 +111,15 @@ public partial class MainForm : Window
}
if (modpackInfo != null)
+ {
features = new(updateConfig);
+ modpackInfo.ExtrasKey = TextBoxInstallKey.Text?.Trim();
+ if (!features.IsInvalid() && !string.IsNullOrWhiteSpace(TextBoxInstallKey.Text) && !AllowExtras())
+ {
+ SetStatus(GeneralLangRes.InstallationKeyNotValid, Symbols.Fluent.GetImageSource(SymbolsFluent.warning_shield));
+ return false;
+ }
+ }
LabelInstallKey.IsVisible = TextBoxInstallKey.IsVisible = !string.IsNullOrWhiteSpace(updateConfig.UnleashApiUrl);
@@ -177,7 +185,7 @@ public partial class MainForm : Window
SetStatus(GeneralLangRes.CheckingForUpdates, Symbols.Fluent.GetImageSource(SymbolsFluent.update));
// Check for extras once again
- updateOptions.IncludeExtras = features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
+ updateOptions.IncludeExtras = AllowExtras();
// Force re-install on repair
updateOptions.IgnoreInstalledVersion = repair;
@@ -244,6 +252,11 @@ public partial class MainForm : Window
}
}
+ private bool AllowExtras()
+ {
+ return features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
+ }
+
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
{
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
diff --git a/ModpackUpdater.Manager/ModpackFeatures.cs b/ModpackUpdater.Manager/ModpackFeatures.cs
index dd8a75a..b0291f9 100644
--- a/ModpackUpdater.Manager/ModpackFeatures.cs
+++ b/ModpackUpdater.Manager/ModpackFeatures.cs
@@ -1,11 +1,12 @@
-using Unleash;
+using System.Diagnostics.CodeAnalysis;
+using Unleash;
using Unleash.ClientFactory;
namespace ModpackUpdater.Manager;
public class ModpackFeatures(ModpackConfig modpackConfig)
{
- private IUnleash api;
+ private IUnleash? api;
private UnleashContext context;
private UnleashSettings settings;
@@ -26,20 +27,28 @@ public class ModpackFeatures(ModpackConfig modpackConfig)
return CheckFeature(feature, context);
}
+ public bool IsInvalid()
+ {
+ return string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl) || string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId);
+ }
+
+ [MemberNotNullWhen(true, nameof(api))]
private bool InitializeApi()
{
- if (api == null && !string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl) && !string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId))
+ if (api != null
+ || string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl)
+ || string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId))
+ return api != null;
+
+ settings = new UnleashSettings
{
- settings = new UnleashSettings
- {
- AppName = "Modpack Updater",
- UnleashApi = new Uri(modpackConfig.UnleashApiUrl),
- FetchTogglesInterval = TimeSpan.FromSeconds(60 * 5),
- InstanceTag = modpackConfig.UnleashInstanceId,
- };
+ AppName = "Modpack Updater",
+ UnleashApi = new Uri(modpackConfig.UnleashApiUrl),
+ FetchTogglesInterval = TimeSpan.FromSeconds(0),
+ InstanceTag = modpackConfig.UnleashInstanceId,
+ };
- api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
- }
+ api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
return api != null;
}