Actually clear cache and restore imc files.

This commit is contained in:
Ottermandias 2022-07-11 14:08:52 +02:00
parent 4030487472
commit b09a736a85
7 changed files with 50 additions and 15 deletions

View file

@ -87,7 +87,6 @@ public partial class ModCollection
newCollection.CreateCache();
}
RemoveCache( oldCollectionIdx );
switch( collectionType )
{
case CollectionType.Default:
@ -110,6 +109,7 @@ public partial class ModCollection
break;
}
RemoveCache( oldCollectionIdx );
UpdateCurrentCollectionInUse();
CollectionChanged.Invoke( collectionType, this[ oldCollectionIdx ], newCollection, characterName );
@ -128,7 +128,7 @@ public partial class ModCollection
// Create a special collection if it does not exist and set it to Empty.
public bool CreateSpecialCollection( CollectionType collectionType )
{
if( !collectionType.IsSpecial() || _specialCollections[( int )collectionType] != null )
if( !collectionType.IsSpecial() || _specialCollections[ ( int )collectionType ] != null )
{
return false;
}
@ -136,7 +136,6 @@ public partial class ModCollection
_specialCollections[ ( int )collectionType ] = Empty;
CollectionChanged.Invoke( collectionType, null, Empty, null );
return true;
}
// Remove a special collection if it exists
@ -361,7 +360,8 @@ public partial class ModCollection
private void RemoveCache( int idx )
{
if( idx != Default.Index
if( idx != Empty.Index
&& idx != Default.Index
&& idx != Current.Index
&& _specialCollections.All( c => c == null || c.Index != idx )
&& _characters.Values.All( c => c.Index != idx ) )

View file

@ -56,7 +56,7 @@ public partial class ModCollection
// Clear the current cache.
private void ClearCache()
internal void ClearCache()
{
_cache?.Dispose();
_cache = null;

View file

@ -59,6 +59,7 @@ public partial class ModCollection
public void Dispose()
{
MetaManipulations.Dispose();
_collection.ModSettingChanged -= OnModSettingChange;
_collection.InheritanceChanged -= OnInheritanceChange;
Penumbra.CharacterUtility.LoadingFinished -= IncrementCounter;