From bd59591ed8650c5ae544fa3546fbc5e4fa5e813b Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sun, 8 Sep 2024 23:42:19 +0200 Subject: [PATCH] Add display of ImportDate and allow resetting it, add button to open local data json. --- Penumbra/Mods/Manager/ModDataEditor.cs | 11 ++++++ Penumbra/Mods/ModCreator.cs | 2 +- Penumbra/UI/ModsTab/ModFileSystemSelector.cs | 19 +++++----- Penumbra/UI/ModsTab/ModPanelEditTab.cs | 37 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 11 deletions(-) diff --git a/Penumbra/Mods/Manager/ModDataEditor.cs b/Penumbra/Mods/Manager/ModDataEditor.cs index 7a0467d0..933620d9 100644 --- a/Penumbra/Mods/Manager/ModDataEditor.cs +++ b/Penumbra/Mods/Manager/ModDataEditor.cs @@ -249,6 +249,17 @@ public class ModDataEditor(SaveService saveService, CommunicatorService communic communicatorService.ModDataChanged.Invoke(ModDataChangeType.Favorite, mod, null); } + public void ResetModImportDate(Mod mod) + { + var newDate = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); + if (mod.ImportDate == newDate) + return; + + mod.ImportDate = newDate; + saveService.QueueSave(new ModLocalData(mod)); + communicatorService.ModDataChanged.Invoke(ModDataChangeType.ImportDate, mod, null); + } + public void ChangeModNote(Mod mod, string newNote) { if (mod.Note == newNote) diff --git a/Penumbra/Mods/ModCreator.cs b/Penumbra/Mods/ModCreator.cs index 8cfdc9a7..fe027ca4 100644 --- a/Penumbra/Mods/ModCreator.cs +++ b/Penumbra/Mods/ModCreator.cs @@ -77,7 +77,7 @@ public partial class ModCreator( if (modDataChange.HasFlag(ModDataChangeType.Deletion) || mod.Name.Length == 0) return false; - dataEditor.LoadLocalData(mod); + modDataChange |= dataEditor.LoadLocalData(mod); LoadDefaultOption(mod); LoadAllGroups(mod); if (incorporateMetaChanges) diff --git a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs index 7a165feb..0781312c 100644 --- a/Penumbra/UI/ModsTab/ModFileSystemSelector.cs +++ b/Penumbra/UI/ModsTab/ModFileSystemSelector.cs @@ -447,16 +447,15 @@ public sealed class ModFileSystemSelector : FileSystemSelector