Some fixes.

This commit is contained in:
Ottermandias 2022-07-05 23:28:14 +02:00
parent 8fd9569508
commit abce14dfdd
8 changed files with 50 additions and 148 deletions

View file

@ -87,32 +87,31 @@ public partial class MetaManager
public bool RevertMod( ImcManipulation m )
{
#if USE_IMC
if( _imcManipulations.Remove( m ) )
if( !_imcManipulations.Remove( m ) )
{
var path = m.GamePath();
if( !_imcFiles.TryGetValue( path, out var file ) )
{
return false;
}
var def = ImcFile.GetDefault( path, m.EquipSlot, m.Variant, out _ );
var manip = m with { Entry = def };
if( !manip.Apply( file ) )
{
return false;
}
var fullPath = CreateImcPath( path );
if( _collection.HasCache )
{
_collection.ForceFile( path, fullPath );
}
return true;
return false;
}
#endif
return false;
var path = m.GamePath();
if( !_imcFiles.TryGetValue( path, out var file ) )
{
return false;
}
var def = ImcFile.GetDefault( path, m.EquipSlot, m.Variant, out _ );
var manip = m with { Entry = def };
if( !manip.Apply( file ) )
{
return false;
}
var fullPath = CreateImcPath( path );
if( _collection.HasCache )
{
_collection.ForceFile( path, fullPath );
}
return true;
}
public void DisposeImc()

View file

@ -10,7 +10,7 @@ using Penumbra.Mods;
namespace Penumbra.Meta.Manager;
public partial class MetaManager : IDisposable, IEnumerable<KeyValuePair<MetaManipulation, IMod>>
public partial class MetaManager : IDisposable, IEnumerable< KeyValuePair< MetaManipulation, IMod > >
{
private readonly Dictionary< MetaManipulation, IMod > _manipulations = new();
private readonly ModCollection _collection;
@ -25,7 +25,7 @@ public partial class MetaManager : IDisposable, IEnumerable<KeyValuePair<MetaMan
=> _manipulations.Keys;
public IEnumerator<KeyValuePair<MetaManipulation, IMod>> GetEnumerator()
public IEnumerator< KeyValuePair< MetaManipulation, IMod > > GetEnumerator()
=> _manipulations.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
@ -135,6 +135,12 @@ public partial class MetaManager : IDisposable, IEnumerable<KeyValuePair<MetaMan
};
}
if( Penumbra.CollectionManager.Default == _collection )
{
SetFiles();
Penumbra.ResidentResources.Reload();
}
Penumbra.CharacterUtility.LoadingFinished -= ApplyStoredManipulations;
}