From 99bcfb2c295146399cac2df4e17558fdc974fff7 Mon Sep 17 00:00:00 2001 From: Asval Date: Wed, 21 May 2025 14:49:15 +0200 Subject: [PATCH] random stuff --- FModel/Creator/Bases/FN/BaseBundle.cs | 2 +- FModel/Creator/Bases/FN/BaseQuest.cs | 4 ++-- FModel/FModel.csproj | 2 +- FModel/MainWindow.xaml.cs | 2 +- FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs | 10 ++++++++-- FModel/ViewModels/ApplicationViewModel.cs | 2 +- .../Views/Resources/Controls/Rtb/CustomRichTextBox.cs | 3 ++- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/FModel/Creator/Bases/FN/BaseBundle.cs b/FModel/Creator/Bases/FN/BaseBundle.cs index ea85a775..90c9de2b 100644 --- a/FModel/Creator/Bases/FN/BaseBundle.cs +++ b/FModel/Creator/Bases/FN/BaseBundle.cs @@ -59,7 +59,7 @@ public class BaseBundle : UCreator foreach (var reward in rewards) { if (!reward.TryGetValue(out FSoftObjectPath itemDefinition, "ItemDefinition")) continue; - quest.AddCompletionRequest(itemDefinition); + quest.AddCompletionReward(itemDefinition); } _quests.Add(quest); } diff --git a/FModel/Creator/Bases/FN/BaseQuest.cs b/FModel/Creator/Bases/FN/BaseQuest.cs index 48984aff..ef3159aa 100644 --- a/FModel/Creator/Bases/FN/BaseQuest.cs +++ b/FModel/Creator/Bases/FN/BaseQuest.cs @@ -44,12 +44,12 @@ public class BaseQuest : BaseIcon DisplayName = ReformatString(description, completionCount.ToString(), completionCount < 0); } - public void AddCompletionRequest(FSoftObjectPath itemDefinition) + public void AddCompletionReward(FSoftObjectPath itemDefinition) { _rewards.Add(itemDefinition.TryLoad(out UObject uObject) ? new Reward(uObject) : new Reward()); } - public void AddCompletionRequest(int quantity, string reward) + public void AddCompletionReward(int quantity, string reward) { _rewards.Add(new Reward(quantity, reward)); } diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index dc171282..bdfee340 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -164,7 +164,7 @@ - + diff --git a/FModel/MainWindow.xaml.cs b/FModel/MainWindow.xaml.cs index 2f915233..e1d71bc3 100644 --- a/FModel/MainWindow.xaml.cs +++ b/FModel/MainWindow.xaml.cs @@ -63,7 +63,6 @@ public partial class MainWindow await ApplicationViewModel.InitOodle(); await ApplicationViewModel.InitZlib(); - await ApplicationViewModel.InitDetex(); await _applicationView.CUE4Parse.Initialize(); await _applicationView.AesManager.InitAes(); await _applicationView.UpdateProvider(true); @@ -74,6 +73,7 @@ public partial class MainWindow _applicationView.CUE4Parse.VerifyConsoleVariables(), _applicationView.CUE4Parse.VerifyOnDemandArchives(), _applicationView.CUE4Parse.InitMappings(), + ApplicationViewModel.InitDetex(), ApplicationViewModel.InitVgmStream(), ApplicationViewModel.InitImGuiSettings(newOrUpdated), Task.Run(() => diff --git a/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs b/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs index aeaf42b9..47b7bd55 100644 --- a/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs +++ b/FModel/ViewModels/ApiEndpoints/FModelApiEndpoint.cs @@ -106,7 +106,11 @@ public class FModelApiEndpoint : AbstractApiProvider public void CheckForUpdates(bool launch = false) { - if (DateTime.Now < UserSettings.Default.NextUpdateCheck) return; + if (DateTime.Now < UserSettings.Default.NextUpdateCheck) + { + Log.Warning("Updates have been silenced until {DateTime}", UserSettings.Default.NextUpdateCheck); + return; + } if (launch) { @@ -140,7 +144,8 @@ public class FModelApiEndpoint : AbstractApiProvider { UserSettings.Default.LastUpdateCheck = DateTime.Now; - if (((CustomMandatory)args.Mandatory).CommitHash == Constants.APP_COMMIT_ID) + var targetHash = ((CustomMandatory) args.Mandatory).CommitHash; + if (targetHash == Constants.APP_COMMIT_ID) { if (UserSettings.Default.ShowChangelog) ShowChangelog(args); @@ -152,6 +157,7 @@ public class FModelApiEndpoint : AbstractApiProvider UserSettings.Default.ShowChangelog = currentVersion != args.InstalledVersion; const string message = "A new update is available!"; + Log.Warning("{message} Version {CurrentVersion} ({Hash})", message, currentVersion, targetHash); Helper.OpenWindow(message, () => new UpdateView { Title = message, ResizeMode = ResizeMode.NoResize }.ShowDialog()); } else diff --git a/FModel/ViewModels/ApplicationViewModel.cs b/FModel/ViewModels/ApplicationViewModel.cs index e3faa892..dd0806c2 100644 --- a/FModel/ViewModels/ApplicationViewModel.cs +++ b/FModel/ViewModels/ApplicationViewModel.cs @@ -260,7 +260,7 @@ public class ApplicationViewModel : ViewModel ZlibHelper.Initialize(zlibPath); } - public static async ValueTask InitDetex() + public static async Task InitDetex() { var detexPath = Path.Combine(UserSettings.Default.OutputDirectory, ".data", DetexHelper.DLL_NAME); if (File.Exists(DetexHelper.DLL_NAME)) diff --git a/FModel/Views/Resources/Controls/Rtb/CustomRichTextBox.cs b/FModel/Views/Resources/Controls/Rtb/CustomRichTextBox.cs index d8dbccfa..0c63a759 100644 --- a/FModel/Views/Resources/Controls/Rtb/CustomRichTextBox.cs +++ b/FModel/Views/Resources/Controls/Rtb/CustomRichTextBox.cs @@ -6,6 +6,7 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Threading; namespace FModel.Views.Resources.Controls; @@ -54,7 +55,7 @@ public class FLogger : ITextFormatter } job(); - }); + }, DispatcherPriority.Background); } public static void Text(string message, string color, bool newLine = false)