Use specific counter for Imc.

This commit is contained in:
Ottermandias 2024-06-17 23:11:42 +02:00
parent be729afd4b
commit d7a8c9415b
3 changed files with 5 additions and 1 deletions

View file

@ -68,6 +68,7 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
protected override void ApplyModInternal(ImcIdentifier identifier, ImcEntry entry) protected override void ApplyModInternal(ImcIdentifier identifier, ImcEntry entry)
{ {
++Collection.ImcChangeCounter;
if (Manager.CharacterUtility.Ready) if (Manager.CharacterUtility.Ready)
ApplyFile(identifier, entry); ApplyFile(identifier, entry);
} }
@ -102,6 +103,7 @@ public sealed class ImcCache(MetaFileManager manager, ModCollection collection)
protected override void RevertModInternal(ImcIdentifier identifier) protected override void RevertModInternal(ImcIdentifier identifier)
{ {
++Collection.ImcChangeCounter;
var path = identifier.GamePath(); var path = identifier.GamePath();
if (!_imcFiles.TryGetValue(path, out var pair)) if (!_imcFiles.TryGetValue(path, out var pair))
return; return;

View file

@ -56,6 +56,8 @@ public partial class ModCollection
/// </summary> /// </summary>
public int ChangeCounter { get; private set; } public int ChangeCounter { get; private set; }
public uint ImcChangeCounter { get; set; }
/// <summary> Increment the number of changes in the effective file list. </summary> /// <summary> Increment the number of changes in the effective file list. </summary>
public int IncrementCounter() public int IncrementCounter()
=> ++ChangeCounter; => ++ChangeCounter;

View file

@ -32,7 +32,7 @@ public static class PathDataHandler
/// <summary> Create the encoding path for an IMC file. </summary> /// <summary> Create the encoding path for an IMC file. </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static FullPath CreateImc(ByteString path, ModCollection collection) public static FullPath CreateImc(ByteString path, ModCollection collection)
=> CreateBase(path, collection); => new($"|{collection.LocalId.Id}_{collection.ImcChangeCounter}_{DiscriminatorString}|{path}");
/// <summary> Create the encoding path for a TMB file. </summary> /// <summary> Create the encoding path for a TMB file. </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]