Metamanipulations seemingly working.

This commit is contained in:
Ottermandias 2022-03-14 15:23:00 +01:00
parent 707570615c
commit 6f527a1dbc
26 changed files with 1637 additions and 1237 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using Dalamud.Logging;
using Penumbra.Interop.Structs;
using Penumbra.Mod;
using Penumbra.Util;
@ -43,6 +44,14 @@ public class CollectionManager
{
ActiveCollection = newActive;
Penumbra.ResidentResources.Reload();
if( ActiveCollection.Cache == null )
{
Penumbra.CharacterUtility.ResetAll();
}
else
{
ActiveCollection.Cache.MetaManipulations.SetFiles();
}
}
else
{
@ -206,10 +215,9 @@ public class CollectionManager
public void SetDefaultCollection( ModCollection newCollection )
=> SetCollection( newCollection, DefaultCollection, c =>
{
if( !CollectionChangedTo.Any() )
if( CollectionChangedTo.Length == 0 )
{
ActiveCollection = c;
Penumbra.ResidentResources.Reload();
SetActiveCollection( c, string.Empty );
}
DefaultCollection = c;
@ -228,8 +236,7 @@ public class CollectionManager
{
if( CollectionChangedTo == characterName && CharacterCollection.TryGetValue( characterName, out var collection ) )
{
ActiveCollection = c;
Penumbra.ResidentResources.Reload();
SetActiveCollection( c, CollectionChangedTo );
}
CharacterCollection[ characterName ] = c;

View file

@ -7,8 +7,7 @@ using System.IO;
using System.Linq;
using Dalamud.Logging;
using Penumbra.GameData.ByteString;
using Penumbra.GameData.Util;
using Penumbra.Meta;
using Penumbra.Meta.Manager;
using Penumbra.Mod;
using Penumbra.Util;
@ -27,7 +26,7 @@ public class ModCollectionCache
private readonly SortedList< string, object? > _changedItems = new();
public readonly Dictionary< Utf8GamePath, FullPath > ResolvedFiles = new();
public readonly HashSet< FullPath > MissingFiles = new();
public readonly MetaManager2 MetaManipulations;
public readonly MetaManager MetaManipulations;
public IReadOnlyDictionary< string, object? > ChangedItems
{
@ -39,7 +38,7 @@ public class ModCollectionCache
}
public ModCollectionCache( ModCollection collection )
=> MetaManipulations = new MetaManager2( collection );
=> MetaManipulations = new MetaManager( collection );
private static void ResetFileSeen( int size )
{
@ -258,7 +257,7 @@ public class ModCollectionCache
}
private void AddMetaFiles()
=> MetaManipulations.ApplyImcFiles( ResolvedFiles );
=> MetaManipulations.Imc.SetFiles();
private void AddSwaps( Mod.Mod mod )
{

View file

@ -2,14 +2,16 @@ using System;
using System.Collections.Generic;
using System.IO;
using Dalamud.Logging;
using Penumbra.Meta.Manipulations;
using Penumbra.Mod;
namespace Penumbra.Mods;
public partial class ModManagerNew
{
private readonly List<ModData> _mods = new();
public IReadOnlyList<ModData> Mods
private readonly List< ModData > _mods = new();
public IReadOnlyList< ModData > Mods
=> _mods;
public void DiscoverMods()
@ -35,7 +37,6 @@ public partial class ModManagerNew
//Collections.RecreateCaches();
}
}
public partial class ModManagerNew
{
public DirectoryInfo BasePath { get; private set; } = null!;
@ -52,7 +53,7 @@ public partial class ModManagerNew
{
if( Valid )
{
Valid = Directory.Exists(BasePath.FullName);
Valid = Directory.Exists( BasePath.FullName );
}
return Valid;
@ -87,7 +88,6 @@ public partial class ModManagerNew
return;
}
( BasePath, Valid ) = CreateDirectory( path );
if( Penumbra.Config.ModDirectory != BasePath.FullName )
@ -105,6 +105,6 @@ public partial class ModManagerNew
}
InitBaseDirectory( path );
BasePathChanged?.Invoke( BasePath );
BasePathChanged?.Invoke( BasePath );
}
}