mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Remove Mod.BasePath
This commit is contained in:
parent
49c8afb72a
commit
aa4bc45641
7 changed files with 78 additions and 80 deletions
|
|
@ -29,7 +29,7 @@ public class IpcTester : IDisposable
|
||||||
private bool _subscribed = true;
|
private bool _subscribed = true;
|
||||||
|
|
||||||
private readonly PluginState _pluginState;
|
private readonly PluginState _pluginState;
|
||||||
private readonly Configuration _configuration;
|
private readonly IpcConfiguration _ipcConfiguration;
|
||||||
private readonly Ui _ui;
|
private readonly Ui _ui;
|
||||||
private readonly Redrawing _redrawing;
|
private readonly Redrawing _redrawing;
|
||||||
private readonly GameState _gameState;
|
private readonly GameState _gameState;
|
||||||
|
|
@ -40,12 +40,13 @@ public class IpcTester : IDisposable
|
||||||
private readonly ModSettings _modSettings;
|
private readonly ModSettings _modSettings;
|
||||||
private readonly Temporary _temporary;
|
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)
|
TempModManager tempMods, TempCollectionManager tempCollections, SaveService saveService)
|
||||||
{
|
{
|
||||||
_ipcProviders = ipcProviders;
|
_ipcProviders = ipcProviders;
|
||||||
_pluginState = new PluginState(pi);
|
_pluginState = new PluginState(pi);
|
||||||
_configuration = new Configuration(pi);
|
_ipcConfiguration = new IpcConfiguration(pi);
|
||||||
_ui = new Ui(pi);
|
_ui = new Ui(pi);
|
||||||
_redrawing = new Redrawing(pi);
|
_redrawing = new Redrawing(pi);
|
||||||
_gameState = new GameState(pi);
|
_gameState = new GameState(pi);
|
||||||
|
|
@ -54,7 +55,7 @@ public class IpcTester : IDisposable
|
||||||
_meta = new Meta(pi);
|
_meta = new Meta(pi);
|
||||||
_mods = new Mods(pi);
|
_mods = new Mods(pi);
|
||||||
_modSettings = new ModSettings(pi);
|
_modSettings = new ModSettings(pi);
|
||||||
_temporary = new Temporary(pi, modManager, collections, tempMods, tempCollections, saveService, _configuration);
|
_temporary = new Temporary(pi, modManager, collections, tempMods, tempCollections, saveService, config);
|
||||||
UnsubscribeEvents();
|
UnsubscribeEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +66,7 @@ public class IpcTester : IDisposable
|
||||||
SubscribeEvents();
|
SubscribeEvents();
|
||||||
ImGui.TextUnformatted($"API Version: {_ipcProviders.Api.ApiVersion.Breaking}.{_ipcProviders.Api.ApiVersion.Feature:D4}");
|
ImGui.TextUnformatted($"API Version: {_ipcProviders.Api.ApiVersion.Breaking}.{_ipcProviders.Api.ApiVersion.Feature:D4}");
|
||||||
_pluginState.Draw();
|
_pluginState.Draw();
|
||||||
_configuration.Draw();
|
_ipcConfiguration.Draw();
|
||||||
_ui.Draw();
|
_ui.Draw();
|
||||||
_redrawing.Draw();
|
_redrawing.Draw();
|
||||||
_gameState.Draw();
|
_gameState.Draw();
|
||||||
|
|
@ -97,7 +98,7 @@ public class IpcTester : IDisposable
|
||||||
_modSettings.SettingChanged.Enable();
|
_modSettings.SettingChanged.Enable();
|
||||||
_gameState.CharacterBaseCreating.Enable();
|
_gameState.CharacterBaseCreating.Enable();
|
||||||
_gameState.CharacterBaseCreated.Enable();
|
_gameState.CharacterBaseCreated.Enable();
|
||||||
_configuration.ModDirectoryChanged.Enable();
|
_ipcConfiguration.ModDirectoryChanged.Enable();
|
||||||
_gameState.GameObjectResourcePathResolved.Enable();
|
_gameState.GameObjectResourcePathResolved.Enable();
|
||||||
_mods.DeleteSubscriber.Enable();
|
_mods.DeleteSubscriber.Enable();
|
||||||
_mods.AddSubscriber.Enable();
|
_mods.AddSubscriber.Enable();
|
||||||
|
|
@ -121,7 +122,7 @@ public class IpcTester : IDisposable
|
||||||
_modSettings.SettingChanged.Disable();
|
_modSettings.SettingChanged.Disable();
|
||||||
_gameState.CharacterBaseCreating.Disable();
|
_gameState.CharacterBaseCreating.Disable();
|
||||||
_gameState.CharacterBaseCreated.Disable();
|
_gameState.CharacterBaseCreated.Disable();
|
||||||
_configuration.ModDirectoryChanged.Disable();
|
_ipcConfiguration.ModDirectoryChanged.Disable();
|
||||||
_gameState.GameObjectResourcePathResolved.Disable();
|
_gameState.GameObjectResourcePathResolved.Disable();
|
||||||
_mods.DeleteSubscriber.Disable();
|
_mods.DeleteSubscriber.Disable();
|
||||||
_mods.AddSubscriber.Disable();
|
_mods.AddSubscriber.Disable();
|
||||||
|
|
@ -143,7 +144,7 @@ public class IpcTester : IDisposable
|
||||||
_modSettings.SettingChanged.Dispose();
|
_modSettings.SettingChanged.Dispose();
|
||||||
_gameState.CharacterBaseCreating.Dispose();
|
_gameState.CharacterBaseCreating.Dispose();
|
||||||
_gameState.CharacterBaseCreated.Dispose();
|
_gameState.CharacterBaseCreated.Dispose();
|
||||||
_configuration.ModDirectoryChanged.Dispose();
|
_ipcConfiguration.ModDirectoryChanged.Dispose();
|
||||||
_gameState.GameObjectResourcePathResolved.Dispose();
|
_gameState.GameObjectResourcePathResolved.Dispose();
|
||||||
_mods.DeleteSubscriber.Dispose();
|
_mods.DeleteSubscriber.Dispose();
|
||||||
_mods.AddSubscriber.Dispose();
|
_mods.AddSubscriber.Dispose();
|
||||||
|
|
@ -229,7 +230,7 @@ public class IpcTester : IDisposable
|
||||||
=> (_lastEnabledChange, _lastEnabledValue) = (DateTimeOffset.Now, val);
|
=> (_lastEnabledChange, _lastEnabledValue) = (DateTimeOffset.Now, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Configuration
|
private class IpcConfiguration
|
||||||
{
|
{
|
||||||
private readonly DalamudPluginInterface _pi;
|
private readonly DalamudPluginInterface _pi;
|
||||||
public readonly EventSubscriber<string, bool> ModDirectoryChanged;
|
public readonly EventSubscriber<string, bool> ModDirectoryChanged;
|
||||||
|
|
@ -239,7 +240,7 @@ public class IpcTester : IDisposable
|
||||||
private bool _lastModDirectoryValid;
|
private bool _lastModDirectoryValid;
|
||||||
private DateTimeOffset _lastModDirectoryTime = DateTimeOffset.MinValue;
|
private DateTimeOffset _lastModDirectoryTime = DateTimeOffset.MinValue;
|
||||||
|
|
||||||
public Configuration(DalamudPluginInterface pi)
|
public IpcConfiguration(DalamudPluginInterface pi)
|
||||||
{
|
{
|
||||||
_pi = pi;
|
_pi = pi;
|
||||||
ModDirectoryChanged = Ipc.ModDirectoryChanged.Subscriber(pi, UpdateModDirectoryChanged);
|
ModDirectoryChanged = Ipc.ModDirectoryChanged.Subscriber(pi, UpdateModDirectoryChanged);
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
internal readonly FuncProvider<string, string, int, PenumbraApiEc> RemoveTemporaryMod;
|
internal readonly FuncProvider<string, string, int, PenumbraApiEc> RemoveTemporaryMod;
|
||||||
|
|
||||||
public PenumbraIpcProviders(DalamudPluginInterface pi, IPenumbraApi api, ModManager modManager, CollectionManager collections,
|
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;
|
Api = api;
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
RemoveTemporaryModAll = Ipc.RemoveTemporaryModAll.Provider(pi, Api.RemoveTemporaryModAll);
|
RemoveTemporaryModAll = Ipc.RemoveTemporaryModAll.Provider(pi, Api.RemoveTemporaryModAll);
|
||||||
RemoveTemporaryMod = Ipc.RemoveTemporaryMod.Provider(pi, Api.RemoveTemporaryMod);
|
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();
|
Initialized.Invoke();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,16 @@ public enum NewDirectoryState
|
||||||
Empty,
|
Empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Describes the state of a changed mod event. </summary>
|
||||||
|
public enum ModPathChangeType
|
||||||
|
{
|
||||||
|
Added,
|
||||||
|
Deleted,
|
||||||
|
Moved,
|
||||||
|
Reloaded,
|
||||||
|
StartingReload,
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class ModManager : ModStorage
|
public sealed class ModManager : ModStorage
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
|
@ -18,6 +19,25 @@ public sealed partial class Mod : IMod
|
||||||
Priority = int.MaxValue,
|
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
|
// Meta Data
|
||||||
public LowerString Name { get; internal set; } = "New Mod";
|
public LowerString Name { get; internal set; } = "New Mod";
|
||||||
public LowerString Author { get; internal set; } = LowerString.Empty;
|
public LowerString Author { get; internal set; } = LowerString.Empty;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ public class ModCache
|
||||||
public string LowerChangedItemsString = string.Empty;
|
public string LowerChangedItemsString = string.Empty;
|
||||||
public string AllTagsLower = string.Empty;
|
public string AllTagsLower = string.Empty;
|
||||||
|
|
||||||
|
public ModCache()
|
||||||
|
{}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
TotalFileCount = 0;
|
TotalFileCount = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue