Now that's a collection manager.

This commit is contained in:
Ottermandias 2023-04-06 15:47:33 +02:00
parent 5a817db069
commit f85fc46fb7
55 changed files with 2433 additions and 2317 deletions

View file

@ -21,7 +21,7 @@ public class ExportManager : IDisposable
_communicator = communicator;
_modManager = modManager;
UpdateExportDirectory(_config.ExportDirectory, false);
_communicator.ModPathChanged.Event += OnModPathChange;
_communicator.ModPathChanged.Subscribe(OnModPathChange);
}
/// <inheritdoc cref="UpdateExportDirectory(string, bool)"/>
@ -76,7 +76,7 @@ public class ExportManager : IDisposable
}
public void Dispose()
=> _communicator.ModPathChanged.Event -= OnModPathChange;
=> _communicator.ModPathChanged.Unsubscribe(OnModPathChange);
/// <summary> Automatically migrate the backup file to the new name if any exists. </summary>
private void OnModPathChange(ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory,

View file

@ -26,10 +26,10 @@ public class ModCacheManager : IDisposable, IReadOnlyList<ModCache>
_identifier = identifier;
_modManager = modManager;
_communicator.ModOptionChanged.Event += OnModOptionChange;
_communicator.ModPathChanged.Event += OnModPathChange;
_communicator.ModDataChanged.Event += OnModDataChange;
_communicator.ModDiscoveryFinished.Event += OnModDiscoveryFinished;
_communicator.ModOptionChanged.Subscribe(OnModOptionChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
_communicator.ModDataChanged.Subscribe(OnModDataChange);
_communicator.ModDiscoveryFinished.Subscribe(OnModDiscoveryFinished);
if (!identifier.Valid)
identifier.FinishedCreation += OnIdentifierCreation;
OnModDiscoveryFinished();
@ -51,10 +51,10 @@ public class ModCacheManager : IDisposable, IReadOnlyList<ModCache>
public void Dispose()
{
_communicator.ModOptionChanged.Event -= OnModOptionChange;
_communicator.ModPathChanged.Event -= OnModPathChange;
_communicator.ModDataChanged.Event -= OnModDataChange;
_communicator.ModDiscoveryFinished.Event -= OnModDiscoveryFinished;
_communicator.ModOptionChanged.Unsubscribe(OnModOptionChange);
_communicator.ModPathChanged.Unsubscribe(OnModPathChange);
_communicator.ModDataChanged.Unsubscribe(OnModDataChange);
_communicator.ModDiscoveryFinished.Unsubscribe(OnModDiscoveryFinished);
}
/// <summary> Compute the items changed by a given meta manipulation and put them into the changedItems dictionary. </summary>

View file

@ -5,10 +5,11 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using OtterGui.Filesystem;
using Penumbra.Mods.Manager;
using Penumbra.Services;
using Penumbra.Util;
namespace Penumbra.Mods.Manager;
namespace Penumbra.Mods;
public sealed class ModFileSystem : FileSystem<Mod>, IDisposable, ISavable
{
@ -23,17 +24,17 @@ public sealed class ModFileSystem : FileSystem<Mod>, IDisposable, ISavable
_communicator = communicator;
_files = files;
Reload();
Changed += OnChange;
_communicator.ModDiscoveryFinished.Event += Reload;
_communicator.ModDataChanged.Event += OnDataChange;
_communicator.ModPathChanged.Event += OnModPathChange;
Changed += OnChange;
_communicator.ModDiscoveryFinished.Subscribe(Reload);
_communicator.ModDataChanged.Subscribe(OnDataChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
}
public void Dispose()
{
_communicator.ModPathChanged.Event -= OnModPathChange;
_communicator.ModDiscoveryFinished.Event -= Reload;
_communicator.ModDataChanged.Event -= OnDataChange;
_communicator.ModPathChanged.Unsubscribe(OnModPathChange);
_communicator.ModDiscoveryFinished.Unsubscribe(Reload);
_communicator.ModDataChanged.Unsubscribe(OnDataChange);
}
public struct ImportDate : ISortMode<Mod>