diff --git a/Penumbra/Collections/Cache/CollectionCache.cs b/Penumbra/Collections/Cache/CollectionCache.cs index 97205990..56539526 100644 --- a/Penumbra/Collections/Cache/CollectionCache.cs +++ b/Penumbra/Collections/Cache/CollectionCache.cs @@ -151,6 +151,10 @@ public class CollectionCache : IDisposable { var conflicts = Conflicts(mod); var (paths, manipulations) = ModData.RemoveMod(mod); + + if (addMetaChanges) + ++_collection.ChangeCounter; + foreach (var path in paths) { if (ResolvedFiles.Remove(path, out var mp) && mp.Mod != mod) @@ -183,10 +187,7 @@ public class CollectionCache : IDisposable } if (addMetaChanges) - { - ++_collection.ChangeCounter; _manager.MetaFileManager.ApplyDefaultFiles(_collection); - } } diff --git a/Penumbra/Collections/Cache/CollectionCacheManager.cs b/Penumbra/Collections/Cache/CollectionCacheManager.cs index 7850cdce..5417aa19 100644 --- a/Penumbra/Collections/Cache/CollectionCacheManager.cs +++ b/Penumbra/Collections/Cache/CollectionCacheManager.cs @@ -27,7 +27,10 @@ public class CollectionCacheManager : IDisposable internal readonly MetaFileManager MetaFileManager; - public int Count { get; private set; } + private int _count; + + public int Count + => _count; public IEnumerable Active => _storage.Where(c => c.HasCache); @@ -78,7 +81,8 @@ public class CollectionCacheManager : IDisposable return false; collection._cache = new CollectionCache(this, collection); - ++Count; + if (collection.Index > 0) + Interlocked.Increment(ref _count); Penumbra.Log.Verbose($"Created new cache for collection {collection.AnonymizedName}."); return true; } @@ -295,7 +299,8 @@ public class CollectionCacheManager : IDisposable collection._cache!.Dispose(); collection._cache = null; - --Count; + if (collection.Index > 0) + Interlocked.Decrement(ref _count); Penumbra.Log.Verbose($"Cleared cache of collection {collection.AnonymizedName}."); } diff --git a/Penumbra/Collections/Manager/CollectionEditor.cs b/Penumbra/Collections/Manager/CollectionEditor.cs index 4000f504..5aad1595 100644 --- a/Penumbra/Collections/Manager/CollectionEditor.cs +++ b/Penumbra/Collections/Manager/CollectionEditor.cs @@ -7,7 +7,6 @@ using Penumbra.Api.Enums; using Penumbra.Mods; using Penumbra.Mods.Manager; using Penumbra.Services; -using Penumbra.Util; namespace Penumbra.Collections.Manager; diff --git a/Penumbra/UI/Tabs/DebugTab.cs b/Penumbra/UI/Tabs/DebugTab.cs index 671ead3b..9acecce9 100644 --- a/Penumbra/UI/Tabs/DebugTab.cs +++ b/Penumbra/UI/Tabs/DebugTab.cs @@ -154,7 +154,7 @@ public class DebugTab : Window, ITab if (collection.HasCache) { using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value()); - using var node = TreeNode(collection.AnonymizedName); + using var node = TreeNode($"{collection.AnonymizedName} (Change Counter {collection.ChangeCounter})"); if (!node) continue; @@ -177,7 +177,7 @@ public class DebugTab : Window, ITab else { using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.UndefinedMod.Value()); - TreeNode(collection.AnonymizedName, ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose(); + TreeNode($"{collection.AnonymizedName} (Change Counter {collection.ChangeCounter})", ImGuiTreeNodeFlags.Bullet | ImGuiTreeNodeFlags.Leaf).Dispose(); } } }