ui(client): optimize installation key caching & show invalid key hint
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
// This code was generated by a tool.
|
||||||
// Laufzeitversion:4.0.30319.42000
|
|
||||||
//
|
//
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// der Code erneut generiert wird.
|
// the code is regenerated.
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -12,46 +11,32 @@ namespace ModpackUpdater.Apps.Client.Gui.LangRes {
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
/// </summary>
|
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
// 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()]
|
|
||||||
public class GeneralLangRes {
|
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() {
|
internal GeneralLangRes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
public static System.Resources.ResourceManager ResourceManager {
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
public static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.Equals(null, resourceMan)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
|
System.Resources.ResourceManager temp = new System.Resources.ResourceManager("ModpackUpdater.Apps.Client.Gui.LangRes.GeneralLangRes", typeof(GeneralLangRes).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
public static System.Globalization.CultureInfo Culture {
|
||||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
public static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
get {
|
||||||
return resourceCulture;
|
return resourceCulture;
|
||||||
}
|
}
|
||||||
@@ -60,166 +45,118 @@ namespace ModpackUpdater.Apps.Client.Gui.LangRes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die An update is available! ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string AnUpdateIsAvailable {
|
public static string AnUpdateIsAvailable {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("AnUpdateIsAvailable", resourceCulture);
|
return ResourceManager.GetString("AnUpdateIsAvailable", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Check for updates ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string CheckForUpdates {
|
public static string CheckForUpdates {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("CheckForUpdates", resourceCulture);
|
return ResourceManager.GetString("CheckForUpdates", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Checking for Updates... ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string CheckingForUpdates {
|
public static string CheckingForUpdates {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("CheckingForUpdates", resourceCulture);
|
return ResourceManager.GetString("CheckingForUpdates", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Config incomplete or not loaded! ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string ConfigIncompleteOrNotLoaded {
|
public static string ConfigIncompleteOrNotLoaded {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ConfigIncompleteOrNotLoaded", resourceCulture);
|
return ResourceManager.GetString("ConfigIncompleteOrNotLoaded", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Downloading program update... ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string DownloadProgramUpdate {
|
public static string DownloadProgramUpdate {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("DownloadProgramUpdate", resourceCulture);
|
return ResourceManager.GetString("DownloadProgramUpdate", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Error on update check or while updating! ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string ErrorOnUpdateCheckOrUpdating {
|
public static string ErrorOnUpdateCheckOrUpdating {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ErrorOnUpdateCheckOrUpdating", resourceCulture);
|
return ResourceManager.GetString("ErrorOnUpdateCheckOrUpdating", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Everything is right and up-to-date. ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string EverythingIsRightAndUpToDate {
|
public static string EverythingIsRightAndUpToDate {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("EverythingIsRightAndUpToDate", resourceCulture);
|
return ResourceManager.GetString("EverythingIsRightAndUpToDate", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Install ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string Install {
|
public static string Install {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Install", resourceCulture);
|
return ResourceManager.GetString("Install", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Installation key ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string InstallationKey {
|
public static string InstallationKey {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("InstallationKey", resourceCulture);
|
return ResourceManager.GetString("InstallationKey", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Installing... ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string Installing {
|
public static string Installing {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Installing", resourceCulture);
|
return ResourceManager.GetString("Installing", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Minecraft profile ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string MinecraftProfile {
|
public static string MinecraftProfile {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("MinecraftProfile", resourceCulture);
|
return ResourceManager.GetString("MinecraftProfile", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Minecraft profile folder seems to be not valid. ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string MinecraftProfileFolderSeemsInvalid {
|
public static string MinecraftProfileFolderSeemsInvalid {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("MinecraftProfileFolderSeemsInvalid", resourceCulture);
|
return ResourceManager.GetString("MinecraftProfileFolderSeemsInvalid", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Modpack config url ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string ModpackConfigUrl {
|
public static string ModpackConfigUrl {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ModpackConfigUrl", resourceCulture);
|
return ResourceManager.GetString("ModpackConfigUrl", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Repair ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string Repair {
|
public static string Repair {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Repair", resourceCulture);
|
return ResourceManager.GetString("Repair", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Select ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string Select {
|
public static string Select {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Select", resourceCulture);
|
return ResourceManager.GetString("Select", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Select the minecraft profile folder (usually named .minecraft) ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string SelectMinecraftProfileFolder {
|
public static string SelectMinecraftProfileFolder {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("SelectMinecraftProfileFolder", resourceCulture);
|
return ResourceManager.GetString("SelectMinecraftProfileFolder", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die Status ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string Status {
|
public static string Status {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("Status", resourceCulture);
|
return ResourceManager.GetString("Status", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sucht eine lokalisierte Zeichenfolge, die The update servers are in maintenance. ähnelt.
|
|
||||||
/// </summary>
|
|
||||||
public static string UpdateServerInMaintenance {
|
public static string UpdateServerInMaintenance {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("UpdateServerInMaintenance", resourceCulture);
|
return ResourceManager.GetString("UpdateServerInMaintenance", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string InstallationKeyNotValid {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("InstallationKeyNotValid", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,4 +171,7 @@
|
|||||||
<data name="UpdateServerInMaintenance" xml:space="preserve">
|
<data name="UpdateServerInMaintenance" xml:space="preserve">
|
||||||
<value>The update servers are in maintenance.</value>
|
<value>The update servers are in maintenance.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="InstallationKeyNotValid" xml:space="preserve">
|
||||||
|
<value>Installation key seems to be invalid</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -111,7 +111,15 @@ public partial class MainForm : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (modpackInfo != null)
|
if (modpackInfo != null)
|
||||||
|
{
|
||||||
features = new(updateConfig);
|
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);
|
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));
|
SetStatus(GeneralLangRes.CheckingForUpdates, Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||||
|
|
||||||
// Check for extras once again
|
// Check for extras once again
|
||||||
updateOptions.IncludeExtras = features != null && features.IsEnabled(ModpackFeatures.FeatureAllowExtas, new AllowExtrasFeatureContext(modpackInfo));
|
updateOptions.IncludeExtras = AllowExtras();
|
||||||
|
|
||||||
// Force re-install on repair
|
// Force re-install on repair
|
||||||
updateOptions.IgnoreInstalledVersion = 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)
|
private void Updated_CheckingProgresssUpdated(int toCheck, int processed)
|
||||||
{
|
{
|
||||||
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
SetStatus(Math.Round(processed / (double)toCheck * 100d, 1) + "%", Symbols.Fluent.GetImageSource(SymbolsFluent.update));
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using Unleash;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Unleash;
|
||||||
using Unleash.ClientFactory;
|
using Unleash.ClientFactory;
|
||||||
|
|
||||||
namespace ModpackUpdater.Manager;
|
namespace ModpackUpdater.Manager;
|
||||||
|
|
||||||
public class ModpackFeatures(ModpackConfig modpackConfig)
|
public class ModpackFeatures(ModpackConfig modpackConfig)
|
||||||
{
|
{
|
||||||
private IUnleash api;
|
private IUnleash? api;
|
||||||
private UnleashContext context;
|
private UnleashContext context;
|
||||||
private UnleashSettings settings;
|
private UnleashSettings settings;
|
||||||
|
|
||||||
@@ -26,20 +27,28 @@ public class ModpackFeatures(ModpackConfig modpackConfig)
|
|||||||
return CheckFeature(feature, context);
|
return CheckFeature(feature, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInvalid()
|
||||||
|
{
|
||||||
|
return string.IsNullOrWhiteSpace(modpackConfig.UnleashApiUrl) || string.IsNullOrWhiteSpace(modpackConfig.UnleashInstanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MemberNotNullWhen(true, nameof(api))]
|
||||||
private bool InitializeApi()
|
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),
|
||||||
AppName = "Modpack Updater",
|
FetchTogglesInterval = TimeSpan.FromSeconds(0),
|
||||||
UnleashApi = new Uri(modpackConfig.UnleashApiUrl),
|
InstanceTag = modpackConfig.UnleashInstanceId,
|
||||||
FetchTogglesInterval = TimeSpan.FromSeconds(60 * 5),
|
};
|
||||||
InstanceTag = modpackConfig.UnleashInstanceId,
|
|
||||||
};
|
|
||||||
|
|
||||||
api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
|
api = new UnleashClientFactory().CreateClient(settings, synchronousInitialization: true);
|
||||||
}
|
|
||||||
|
|
||||||
return api != null;
|
return api != null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user