Add Mare Synchronos and MUI API/IPC functions for testing. Not tested myself because how.

This commit is contained in:
Ottermandias 2022-06-19 19:20:02 +02:00
parent 8422d36e4e
commit d6d13594e0
15 changed files with 857 additions and 240 deletions

View file

@ -35,6 +35,24 @@ public partial class ModCollection
private void ForceCacheUpdate()
=> CalculateEffectiveFileList();
// Handle temporary mods for this collection.
public void Apply( Mod.TemporaryMod tempMod, bool created )
{
if( created )
{
_cache?.AddMod( tempMod, tempMod.TotalManipulations > 0 );
}
else
{
_cache?.ReloadMod( tempMod, tempMod.TotalManipulations > 0 );
}
}
public void Remove( Mod.TemporaryMod tempMod )
{
_cache?.RemoveMod( tempMod, tempMod.TotalManipulations > 0 );
}
// Clear the current cache.
private void ClearCache()

View file

@ -20,10 +20,10 @@ public partial class ModCollection
// It will only be setup if a collection gets activated in any way.
private class Cache : IDisposable
{
private readonly ModCollection _collection;
private readonly ModCollection _collection;
private readonly SortedList< string, (SingleArray< IMod >, object?) > _changedItems = new();
public readonly Dictionary< Utf8GamePath, ModPath > ResolvedFiles = new();
public readonly MetaManager MetaManipulations;
public readonly Dictionary< Utf8GamePath, ModPath > ResolvedFiles = new();
public readonly MetaManager MetaManipulations;
private readonly Dictionary< IMod, SingleArray< ModConflicts > > _conflicts = new();
public IEnumerable< SingleArray< ModConflicts > > AllConflicts
@ -160,7 +160,11 @@ public partial class ModCollection
_conflicts.Clear();
// Add all forced redirects.
Penumbra.Redirects.Apply( ResolvedFiles );
foreach( var tempMod in Penumbra.TempMods.ModsForAllCollections.Concat(
Penumbra.TempMods.Mods.TryGetValue( _collection, out var list ) ? list : Array.Empty< Mod.TemporaryMod >() ) )
{
AddMod( tempMod, false );
}
foreach( var mod in Penumbra.ModManager )
{

View file

@ -74,6 +74,17 @@ public partial class ModCollection
public static ModCollection CreateNewEmpty( string name )
=> new(name, CurrentVersion, new Dictionary< string, ModSettings.SavedSettings >());
// Create a new temporary collection that does not save and has a negative index.
public static ModCollection CreateNewTemporary(string tag, string characterName)
{
var collection = new ModCollection($"{tag}_{characterName}_temporary", Empty);
collection.ModSettingChanged -= collection.SaveOnChange;
collection.InheritanceChanged -= collection.SaveOnChange;
collection.Index = ~Penumbra.TempMods.Collections.Count;
collection.CreateCache();
return collection;
}
// Duplicate the calling collection to a new, unique collection of a given name.
public ModCollection Duplicate( string name )
=> new(name, this);