mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Remove Mod.BasePath
This commit is contained in:
parent
49c8afb72a
commit
aa4bc45641
7 changed files with 78 additions and 80 deletions
|
|
@ -28,33 +28,34 @@ public class IpcTester : IDisposable
|
|||
private readonly PenumbraIpcProviders _ipcProviders;
|
||||
private bool _subscribed = true;
|
||||
|
||||
private readonly PluginState _pluginState;
|
||||
private readonly Configuration _configuration;
|
||||
private readonly Ui _ui;
|
||||
private readonly Redrawing _redrawing;
|
||||
private readonly GameState _gameState;
|
||||
private readonly Resolve _resolve;
|
||||
private readonly Collections _collections;
|
||||
private readonly Meta _meta;
|
||||
private readonly Mods _mods;
|
||||
private readonly ModSettings _modSettings;
|
||||
private readonly Temporary _temporary;
|
||||
private readonly PluginState _pluginState;
|
||||
private readonly IpcConfiguration _ipcConfiguration;
|
||||
private readonly Ui _ui;
|
||||
private readonly Redrawing _redrawing;
|
||||
private readonly GameState _gameState;
|
||||
private readonly Resolve _resolve;
|
||||
private readonly Collections _collections;
|
||||
private readonly Meta _meta;
|
||||
private readonly Mods _mods;
|
||||
private readonly ModSettings _modSettings;
|
||||
private readonly Temporary _temporary;
|
||||
|
||||
public IpcTester(DalamudPluginInterface pi, PenumbraIpcProviders ipcProviders, ModManager modManager, CollectionManager collections,
|
||||
public IpcTester(Configuration config, DalamudPluginInterface pi, PenumbraIpcProviders ipcProviders, ModManager modManager,
|
||||
CollectionManager collections,
|
||||
TempModManager tempMods, TempCollectionManager tempCollections, SaveService saveService)
|
||||
{
|
||||
_ipcProviders = ipcProviders;
|
||||
_pluginState = new PluginState(pi);
|
||||
_configuration = new Configuration(pi);
|
||||
_ui = new Ui(pi);
|
||||
_redrawing = new Redrawing(pi);
|
||||
_gameState = new GameState(pi);
|
||||
_resolve = new Resolve(pi);
|
||||
_collections = new Collections(pi);
|
||||
_meta = new Meta(pi);
|
||||
_mods = new Mods(pi);
|
||||
_modSettings = new ModSettings(pi);
|
||||
_temporary = new Temporary(pi, modManager, collections, tempMods, tempCollections, saveService, _configuration);
|
||||
_ipcProviders = ipcProviders;
|
||||
_pluginState = new PluginState(pi);
|
||||
_ipcConfiguration = new IpcConfiguration(pi);
|
||||
_ui = new Ui(pi);
|
||||
_redrawing = new Redrawing(pi);
|
||||
_gameState = new GameState(pi);
|
||||
_resolve = new Resolve(pi);
|
||||
_collections = new Collections(pi);
|
||||
_meta = new Meta(pi);
|
||||
_mods = new Mods(pi);
|
||||
_modSettings = new ModSettings(pi);
|
||||
_temporary = new Temporary(pi, modManager, collections, tempMods, tempCollections, saveService, config);
|
||||
UnsubscribeEvents();
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +66,7 @@ public class IpcTester : IDisposable
|
|||
SubscribeEvents();
|
||||
ImGui.TextUnformatted($"API Version: {_ipcProviders.Api.ApiVersion.Breaking}.{_ipcProviders.Api.ApiVersion.Feature:D4}");
|
||||
_pluginState.Draw();
|
||||
_configuration.Draw();
|
||||
_ipcConfiguration.Draw();
|
||||
_ui.Draw();
|
||||
_redrawing.Draw();
|
||||
_gameState.Draw();
|
||||
|
|
@ -97,7 +98,7 @@ public class IpcTester : IDisposable
|
|||
_modSettings.SettingChanged.Enable();
|
||||
_gameState.CharacterBaseCreating.Enable();
|
||||
_gameState.CharacterBaseCreated.Enable();
|
||||
_configuration.ModDirectoryChanged.Enable();
|
||||
_ipcConfiguration.ModDirectoryChanged.Enable();
|
||||
_gameState.GameObjectResourcePathResolved.Enable();
|
||||
_mods.DeleteSubscriber.Enable();
|
||||
_mods.AddSubscriber.Enable();
|
||||
|
|
@ -121,7 +122,7 @@ public class IpcTester : IDisposable
|
|||
_modSettings.SettingChanged.Disable();
|
||||
_gameState.CharacterBaseCreating.Disable();
|
||||
_gameState.CharacterBaseCreated.Disable();
|
||||
_configuration.ModDirectoryChanged.Disable();
|
||||
_ipcConfiguration.ModDirectoryChanged.Disable();
|
||||
_gameState.GameObjectResourcePathResolved.Disable();
|
||||
_mods.DeleteSubscriber.Disable();
|
||||
_mods.AddSubscriber.Disable();
|
||||
|
|
@ -143,7 +144,7 @@ public class IpcTester : IDisposable
|
|||
_modSettings.SettingChanged.Dispose();
|
||||
_gameState.CharacterBaseCreating.Dispose();
|
||||
_gameState.CharacterBaseCreated.Dispose();
|
||||
_configuration.ModDirectoryChanged.Dispose();
|
||||
_ipcConfiguration.ModDirectoryChanged.Dispose();
|
||||
_gameState.GameObjectResourcePathResolved.Dispose();
|
||||
_mods.DeleteSubscriber.Dispose();
|
||||
_mods.AddSubscriber.Dispose();
|
||||
|
|
@ -229,7 +230,7 @@ public class IpcTester : IDisposable
|
|||
=> (_lastEnabledChange, _lastEnabledValue) = (DateTimeOffset.Now, val);
|
||||
}
|
||||
|
||||
private class Configuration
|
||||
private class IpcConfiguration
|
||||
{
|
||||
private readonly DalamudPluginInterface _pi;
|
||||
public readonly EventSubscriber<string, bool> ModDirectoryChanged;
|
||||
|
|
@ -239,7 +240,7 @@ public class IpcTester : IDisposable
|
|||
private bool _lastModDirectoryValid;
|
||||
private DateTimeOffset _lastModDirectoryTime = DateTimeOffset.MinValue;
|
||||
|
||||
public Configuration(DalamudPluginInterface pi)
|
||||
public IpcConfiguration(DalamudPluginInterface pi)
|
||||
{
|
||||
_pi = pi;
|
||||
ModDirectoryChanged = Ipc.ModDirectoryChanged.Subscriber(pi, UpdateModDirectoryChanged);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class PenumbraIpcProviders : IDisposable
|
|||
internal readonly FuncProvider<string, string, int, PenumbraApiEc> RemoveTemporaryMod;
|
||||
|
||||
public PenumbraIpcProviders(DalamudPluginInterface pi, IPenumbraApi api, ModManager modManager, CollectionManager collections,
|
||||
TempModManager tempMods, TempCollectionManager tempCollections, SaveService saveService)
|
||||
TempModManager tempMods, TempCollectionManager tempCollections, SaveService saveService, Configuration config)
|
||||
{
|
||||
Api = api;
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ public class PenumbraIpcProviders : IDisposable
|
|||
RemoveTemporaryModAll = Ipc.RemoveTemporaryModAll.Provider(pi, Api.RemoveTemporaryModAll);
|
||||
RemoveTemporaryMod = Ipc.RemoveTemporaryMod.Provider(pi, Api.RemoveTemporaryMod);
|
||||
|
||||
Tester = new IpcTester(pi, this, modManager, collections, tempMods, tempCollections, saveService);
|
||||
Tester = new IpcTester(config, pi, this, modManager, collections, tempMods, tempCollections, saveService);
|
||||
|
||||
Initialized.Invoke();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ public enum NewDirectoryState
|
|||
Identical,
|
||||
Empty,
|
||||
}
|
||||
|
||||
/// <summary> Describes the state of a changed mod event. </summary>
|
||||
public enum ModPathChangeType
|
||||
{
|
||||
Added,
|
||||
Deleted,
|
||||
Moved,
|
||||
Reloaded,
|
||||
StartingReload,
|
||||
}
|
||||
|
||||
public sealed class ModManager : ModStorage
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Penumbra.Mods.Manager;
|
||||
|
||||
namespace Penumbra.Mods;
|
||||
|
||||
public enum ModPathChangeType
|
||||
{
|
||||
Added,
|
||||
Deleted,
|
||||
Moved,
|
||||
Reloaded,
|
||||
StartingReload,
|
||||
}
|
||||
|
||||
public partial class Mod
|
||||
{
|
||||
public DirectoryInfo ModPath { get; internal set; }
|
||||
public string Identifier
|
||||
=> Index >= 0 ? ModPath.Name : Name;
|
||||
public int Index { get; internal set; } = -1;
|
||||
|
||||
public bool IsTemporary
|
||||
=> Index < 0;
|
||||
|
||||
// Unused if Index < 0 but used for special temporary mods.
|
||||
public int Priority
|
||||
=> 0;
|
||||
|
||||
internal Mod( DirectoryInfo modPath )
|
||||
{
|
||||
ModPath = modPath;
|
||||
Default = new SubMod( this );
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OtterGui;
|
||||
using OtterGui.Classes;
|
||||
|
|
@ -18,6 +19,25 @@ public sealed partial class Mod : IMod
|
|||
Priority = int.MaxValue,
|
||||
};
|
||||
|
||||
// Main Data
|
||||
public DirectoryInfo ModPath { get; internal set; }
|
||||
public string Identifier
|
||||
=> Index >= 0 ? ModPath.Name : Name;
|
||||
public int Index { get; internal set; } = -1;
|
||||
|
||||
public bool IsTemporary
|
||||
=> Index < 0;
|
||||
|
||||
/// <summary>Unused if Index < 0 but used for special temporary mods.</summary>
|
||||
public int Priority
|
||||
=> 0;
|
||||
|
||||
public Mod(DirectoryInfo modPath)
|
||||
{
|
||||
ModPath = modPath;
|
||||
Default = new SubMod(this);
|
||||
}
|
||||
|
||||
// Meta Data
|
||||
public LowerString Name { get; internal set; } = "New Mod";
|
||||
public LowerString Author { get; internal set; } = LowerString.Empty;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ public class ModCache
|
|||
public string LowerChangedItemsString = string.Empty;
|
||||
public string AllTagsLower = string.Empty;
|
||||
|
||||
public ModCache()
|
||||
{}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
TotalFileCount = 0;
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ public class Penumbra : IDalamudPlugin
|
|||
public string Name
|
||||
=> "Penumbra";
|
||||
|
||||
public static Logger Log { get; private set; } = null!;
|
||||
public static ChatService ChatService { get; private set; } = null!;
|
||||
public static Configuration Config { get; private set; } = null!;
|
||||
public static Logger Log { get; private set; } = null!;
|
||||
public static ChatService ChatService { get; private set; } = null!;
|
||||
public static Configuration Config { get; private set; } = null!;
|
||||
|
||||
public static CharacterUtility CharacterUtility { get; private set; } = null!;
|
||||
public static ModCacheManager ModCaches { get; private set; } = null!;
|
||||
public static CollectionManager CollectionManager { get; private set; } = null!;
|
||||
public static ActorManager Actors { get; private set; } = null!;
|
||||
public static CharacterUtility CharacterUtility { get; private set; } = null!;
|
||||
public static ModCacheManager ModCaches { get; private set; } = null!;
|
||||
public static CollectionManager CollectionManager { get; private set; } = null!;
|
||||
public static ActorManager Actors { get; private set; } = null!;
|
||||
|
||||
public readonly RedrawService RedrawService;
|
||||
public readonly ModFileSystem ModFileSystem;
|
||||
|
|
@ -67,15 +67,15 @@ public class Penumbra : IDalamudPlugin
|
|||
ChatService = _tmp.Services.GetRequiredService<ChatService>();
|
||||
_validityChecker = _tmp.Services.GetRequiredService<ValidityChecker>();
|
||||
_tmp.Services.GetRequiredService<BackupService>();
|
||||
Config = _tmp.Services.GetRequiredService<Configuration>();
|
||||
CharacterUtility = _tmp.Services.GetRequiredService<CharacterUtility>();
|
||||
Actors = _tmp.Services.GetRequiredService<ActorService>().AwaitedService;
|
||||
Config = _tmp.Services.GetRequiredService<Configuration>();
|
||||
CharacterUtility = _tmp.Services.GetRequiredService<CharacterUtility>();
|
||||
Actors = _tmp.Services.GetRequiredService<ActorService>().AwaitedService;
|
||||
_tempMods = _tmp.Services.GetRequiredService<TempModManager>();
|
||||
_residentResources = _tmp.Services.GetRequiredService<ResidentResourceManager>();
|
||||
_tmp.Services.GetRequiredService<ResourceManagerService>();
|
||||
_modManager = _tmp.Services.GetRequiredService<ModManager>();
|
||||
_modManager = _tmp.Services.GetRequiredService<ModManager>();
|
||||
CollectionManager = _tmp.Services.GetRequiredService<CollectionManager>();
|
||||
_tempCollections = _tmp.Services.GetRequiredService<TempCollectionManager>();
|
||||
_tempCollections = _tmp.Services.GetRequiredService<TempCollectionManager>();
|
||||
ModFileSystem = _tmp.Services.GetRequiredService<ModFileSystem>();
|
||||
RedrawService = _tmp.Services.GetRequiredService<RedrawService>();
|
||||
_tmp.Services.GetRequiredService<ResourceService>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue