Use explicit priorities for all internal communication events.

This commit is contained in:
Ottermandias 2023-05-02 17:46:13 +02:00
parent f46daf0f54
commit fb84b43d69
36 changed files with 681 additions and 384 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Penumbra.Communication;
using Penumbra.GameData;
using Penumbra.GameData.Data;
using Penumbra.GameData.Enums;
@ -23,10 +24,10 @@ public class ModCacheManager : IDisposable
_identifier = identifier;
_modManager = modStorage;
_communicator.ModOptionChanged.Subscribe(OnModOptionChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
_communicator.ModDataChanged.Subscribe(OnModDataChange);
_communicator.ModDiscoveryFinished.Subscribe(OnModDiscoveryFinished);
_communicator.ModOptionChanged.Subscribe(OnModOptionChange, ModOptionChanged.Priority.ModCacheManager);
_communicator.ModPathChanged.Subscribe(OnModPathChange, ModPathChanged.Priority.ModCacheManager);
_communicator.ModDataChanged.Subscribe(OnModDataChange, ModDataChanged.Priority.ModCacheManager);
_communicator.ModDiscoveryFinished.Subscribe(OnModDiscoveryFinished, ModDiscoveryFinished.Priority.ModCacheManager);
if (!identifier.Valid)
identifier.FinishedCreation += OnIdentifierCreation;
OnModDiscoveryFinished();

View file

@ -1,5 +1,6 @@
using System;
using System.IO;
using Penumbra.Communication;
using Penumbra.Services;
namespace Penumbra.Mods.Manager;
@ -21,7 +22,7 @@ public class ModExportManager : IDisposable
_communicator = communicator;
_modManager = modManager;
UpdateExportDirectory(_config.ExportDirectory, false);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange, ModPathChanged.Priority.ModExportManager);
}
/// <inheritdoc cref="UpdateExportDirectory(string, bool)"/>

View file

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using OtterGui.Filesystem;
using Penumbra.Communication;
using Penumbra.Mods.Manager;
using Penumbra.Services;
using Penumbra.Util;
@ -25,9 +26,9 @@ public sealed class ModFileSystem : FileSystem<Mod>, IDisposable, ISavable
_saveService = saveService;
Reload();
Changed += OnChange;
_communicator.ModDiscoveryFinished.Subscribe(Reload);
_communicator.ModDataChanged.Subscribe(OnDataChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
_communicator.ModDiscoveryFinished.Subscribe(Reload, ModDiscoveryFinished.Priority.ModFileSystem);
_communicator.ModDataChanged.Subscribe(OnDataChange, ModDataChanged.Priority.ModFileSystem);
_communicator.ModPathChanged.Subscribe(OnModPathChange, ModPathChanged.Priority.ModFileSystem);
}
public void Dispose()

View file

@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Penumbra.Communication;
using Penumbra.Services;
namespace Penumbra.Mods.Manager;
@ -50,7 +51,7 @@ public sealed class ModManager : ModStorage, IDisposable
OptionEditor = optionEditor;
Creator = creator;
SetBaseDirectory(config.ModDirectory, true);
_communicator.ModPathChanged.Subscribe(OnModPathChange);
_communicator.ModPathChanged.Subscribe(OnModPathChange, ModPathChanged.Priority.ModManager);
DiscoverMods();
}