Move CollectionManager out of ModManager

This commit is contained in:
Ottermandias 2022-03-23 11:45:38 +01:00
parent 0eff4e2e67
commit 9c0fc8a8c7
19 changed files with 94 additions and 102 deletions

View file

@ -16,7 +16,7 @@ public class ModsController : WebApiController
[Route( HttpVerbs.Get, "/mods" )]
public object? GetMods()
{
return Penumbra.ModManager.Collections.CurrentCollection.Cache?.AvailableMods.Values.Select( x => new
return Penumbra.CollectionManager.CurrentCollection.Cache?.AvailableMods.Values.Select( x => new
{
x.Settings.Enabled,
x.Settings.Priority,
@ -34,7 +34,7 @@ public class ModsController : WebApiController
[Route( HttpVerbs.Get, "/files" )]
public object GetFiles()
{
return Penumbra.ModManager.Collections.CurrentCollection.Cache?.ResolvedFiles.ToDictionary(
return Penumbra.CollectionManager.CurrentCollection.Cache?.ResolvedFiles.ToDictionary(
o => o.Key.ToString(),
o => o.Value.FullName
)

View file

@ -76,7 +76,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
_penumbra!.ObjectReloader.RedrawAll( setting );
}
private static string ResolvePath( string path, ModManager manager, ModCollection collection )
private static string ResolvePath( string path, ModManager _, ModCollection collection )
{
if( !Penumbra.Config.EnableMods )
{
@ -85,21 +85,21 @@ public class PenumbraApi : IDisposable, IPenumbraApi
var gamePath = Utf8GamePath.FromString( path, out var p, true ) ? p : Utf8GamePath.Empty;
var ret = collection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
ret ??= manager.Collections.ForcedCollection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
ret ??= Penumbra.CollectionManager.ForcedCollection.Cache?.ResolveSwappedOrReplacementPath( gamePath );
return ret?.ToString() ?? path;
}
public string ResolvePath( string path )
{
CheckInitialized();
return ResolvePath( path, Penumbra.ModManager, Penumbra.ModManager.Collections.DefaultCollection );
return ResolvePath( path, Penumbra.ModManager, Penumbra.CollectionManager.DefaultCollection );
}
public string ResolvePath( string path, string characterName )
{
CheckInitialized();
return ResolvePath( path, Penumbra.ModManager,
Penumbra.ModManager.Collections.CharacterCollection.TryGetValue( characterName, out var collection )
Penumbra.CollectionManager.CharacterCollection.TryGetValue( characterName, out var collection )
? collection
: ModCollection.Empty );
}
@ -134,7 +134,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
CheckInitialized();
try
{
if( !Penumbra.ModManager.Collections.Collections.TryGetValue( collectionName, out var collection ) )
if( !Penumbra.CollectionManager.Collections.TryGetValue( collectionName, out var collection ) )
{
collection = ModCollection.Empty;
}