mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 12:44:19 +01:00
Rework around a saner import popup and decouple logic from interface.
This commit is contained in:
parent
bfb630d317
commit
bbfc9a0a6f
16 changed files with 478 additions and 411 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 13ade28e21bed02e16bbd081b2e6567382cf69bd
|
Subproject commit d7e8c8c44d92bd50764394af51ac24cb07f362dc
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using Dalamud.Game.ClientState.Keys;
|
|
||||||
using OtterGui.Filesystem;
|
|
||||||
using OtterGui.FileSystem.Selector;
|
|
||||||
using Penumbra.Mods;
|
|
||||||
using Penumbra.UI.Classes;
|
|
||||||
using Penumbra.UI.ModsTab;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Penumbra.Api {
|
|
||||||
public class ExternalModImporter {
|
|
||||||
private static ModFileSystemSelector modFileSystemSelectorInstance;
|
|
||||||
|
|
||||||
public static ModFileSystemSelector ModFileSystemSelectorInstance { get => modFileSystemSelectorInstance; set => modFileSystemSelectorInstance = value; }
|
|
||||||
|
|
||||||
public static void UnpackMod(string modPackagePath)
|
|
||||||
{
|
|
||||||
modFileSystemSelectorInstance.ImportStandaloneModPackage(modPackagePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -16,8 +16,8 @@ public class HttpApi : IDisposable
|
||||||
[Route( HttpVerbs.Post, "/redraw" )] public partial Task Redraw();
|
[Route( HttpVerbs.Post, "/redraw" )] public partial Task Redraw();
|
||||||
[Route( HttpVerbs.Post, "/redrawAll" )] public partial void RedrawAll();
|
[Route( HttpVerbs.Post, "/redrawAll" )] public partial void RedrawAll();
|
||||||
[Route( HttpVerbs.Post, "/reloadmod" )] public partial Task ReloadMod();
|
[Route( HttpVerbs.Post, "/reloadmod" )] public partial Task ReloadMod();
|
||||||
[Route( HttpVerbs.Post, "/unpackmod" )] public partial Task UnpackMod();
|
[Route( HttpVerbs.Post, "/installmod" )] public partial Task InstallMod();
|
||||||
[Route( HttpVerbs.Post, "/openwindow")] public partial Task OpenWindow();
|
[Route( HttpVerbs.Post, "/openwindow" )] public partial void OpenWindow();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,16 +103,15 @@ public class HttpApi : IDisposable
|
||||||
_api.ReloadMod(data.Path, data.Name);
|
_api.ReloadMod(data.Path, data.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async partial Task UnpackMod()
|
public async partial Task InstallMod()
|
||||||
{
|
{
|
||||||
var data = await HttpContext.GetRequestDataAsync<ModUnpackData>();
|
var data = await HttpContext.GetRequestDataAsync<ModInstallData>();
|
||||||
Penumbra.Log.Debug($"[HTTP] {nameof(UnpackMod)} triggered with {data}.");
|
Penumbra.Log.Debug($"[HTTP] {nameof(InstallMod)} triggered with {data}.");
|
||||||
// Unpack the mod package if its valid.
|
|
||||||
if (data.Path.Length != 0)
|
if (data.Path.Length != 0)
|
||||||
_api.UnpackMod(data.Path);
|
_api.InstallMod(data.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async partial Task OpenWindow()
|
public partial void OpenWindow()
|
||||||
{
|
{
|
||||||
Penumbra.Log.Debug($"[HTTP] {nameof(OpenWindow)} triggered.");
|
Penumbra.Log.Debug($"[HTTP] {nameof(OpenWindow)} triggered.");
|
||||||
_api.OpenMainWindow(TabType.Mods, string.Empty, string.Empty);
|
_api.OpenMainWindow(TabType.Mods, string.Empty, string.Empty);
|
||||||
|
|
@ -125,9 +124,9 @@ public class HttpApi : IDisposable
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
private record ModUnpackData(string Path)
|
private record ModInstallData(string Path)
|
||||||
{
|
{
|
||||||
public ModUnpackData()
|
public ModInstallData()
|
||||||
: this(string.Empty)
|
: this(string.Empty)
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -850,10 +850,12 @@ public class IpcTester : IDisposable
|
||||||
private string _modDirectory = string.Empty;
|
private string _modDirectory = string.Empty;
|
||||||
private string _modName = string.Empty;
|
private string _modName = string.Empty;
|
||||||
private string _pathInput = string.Empty;
|
private string _pathInput = string.Empty;
|
||||||
|
private string _newInstallPath = string.Empty;
|
||||||
private PenumbraApiEc _lastReloadEc;
|
private PenumbraApiEc _lastReloadEc;
|
||||||
private PenumbraApiEc _lastAddEc;
|
private PenumbraApiEc _lastAddEc;
|
||||||
private PenumbraApiEc _lastDeleteEc;
|
private PenumbraApiEc _lastDeleteEc;
|
||||||
private PenumbraApiEc _lastSetPathEc;
|
private PenumbraApiEc _lastSetPathEc;
|
||||||
|
private PenumbraApiEc _lastInstallEc;
|
||||||
private IList<(string, string)> _mods = new List<(string, string)>();
|
private IList<(string, string)> _mods = new List<(string, string)>();
|
||||||
|
|
||||||
public readonly EventSubscriber<string> DeleteSubscriber;
|
public readonly EventSubscriber<string> DeleteSubscriber;
|
||||||
|
|
@ -895,6 +897,7 @@ public class IpcTester : IDisposable
|
||||||
if (!_)
|
if (!_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ImGui.InputTextWithHint("##install", "Install File Path...", ref _newInstallPath, 100);
|
||||||
ImGui.InputTextWithHint("##modDir", "Mod Directory Name...", ref _modDirectory, 100);
|
ImGui.InputTextWithHint("##modDir", "Mod Directory Name...", ref _modDirectory, 100);
|
||||||
ImGui.InputTextWithHint("##modName", "Mod Name...", ref _modName, 100);
|
ImGui.InputTextWithHint("##modName", "Mod Name...", ref _modName, 100);
|
||||||
ImGui.InputTextWithHint("##path", "New Path...", ref _pathInput, 100);
|
ImGui.InputTextWithHint("##path", "New Path...", ref _pathInput, 100);
|
||||||
|
|
@ -916,6 +919,13 @@ public class IpcTester : IDisposable
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.TextUnformatted(_lastReloadEc.ToString());
|
ImGui.TextUnformatted(_lastReloadEc.ToString());
|
||||||
|
|
||||||
|
DrawIntro(Ipc.InstallMod.Label, "Install Mod");
|
||||||
|
if (ImGui.Button("Install"))
|
||||||
|
_lastInstallEc = Ipc.InstallMod.Subscriber(_pi).Invoke(_newInstallPath);
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted(_lastInstallEc.ToString());
|
||||||
|
|
||||||
DrawIntro(Ipc.AddMod.Label, "Add Mod");
|
DrawIntro(Ipc.AddMod.Label, "Add Mod");
|
||||||
if (ImGui.Button("Add"))
|
if (ImGui.Button("Add"))
|
||||||
_lastAddEc = Ipc.AddMod.Subscriber(_pi).Invoke(_modDirectory);
|
_lastAddEc = Ipc.AddMod.Subscriber(_pi).Invoke(_modDirectory);
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,11 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
||||||
private ActorService _actors;
|
private ActorService _actors;
|
||||||
private CollectionResolver _collectionResolver;
|
private CollectionResolver _collectionResolver;
|
||||||
private CutsceneService _cutsceneService;
|
private CutsceneService _cutsceneService;
|
||||||
|
private ModImportManager _modImportManager;
|
||||||
|
|
||||||
public unsafe PenumbraApi(CommunicatorService communicator, Penumbra penumbra, ModManager modManager, ResourceLoader resourceLoader,
|
public unsafe PenumbraApi(CommunicatorService communicator, Penumbra penumbra, ModManager modManager, ResourceLoader resourceLoader,
|
||||||
Configuration config, CollectionManager collectionManager, DalamudServices dalamud, TempCollectionManager tempCollections,
|
Configuration config, CollectionManager collectionManager, DalamudServices dalamud, TempCollectionManager tempCollections,
|
||||||
TempModManager tempMods, ActorService actors, CollectionResolver collectionResolver, CutsceneService cutsceneService)
|
TempModManager tempMods, ActorService actors, CollectionResolver collectionResolver, CutsceneService cutsceneService, ModImportManager modImportManager)
|
||||||
{
|
{
|
||||||
_communicator = communicator;
|
_communicator = communicator;
|
||||||
_penumbra = penumbra;
|
_penumbra = penumbra;
|
||||||
|
|
@ -126,6 +127,7 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
||||||
_actors = actors;
|
_actors = actors;
|
||||||
_collectionResolver = collectionResolver;
|
_collectionResolver = collectionResolver;
|
||||||
_cutsceneService = cutsceneService;
|
_cutsceneService = cutsceneService;
|
||||||
|
_modImportManager = modImportManager;
|
||||||
|
|
||||||
_lumina = (Lumina.GameData?)_dalamud.GameData.GetType()
|
_lumina = (Lumina.GameData?)_dalamud.GameData.GetType()
|
||||||
.GetField("gameData", BindingFlags.Instance | BindingFlags.NonPublic)
|
.GetField("gameData", BindingFlags.Instance | BindingFlags.NonPublic)
|
||||||
|
|
@ -602,11 +604,11 @@ public class PenumbraApi : IDisposable, IPenumbraApi
|
||||||
return PenumbraApiEc.Success;
|
return PenumbraApiEc.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PenumbraApiEc UnpackMod(string modFilePackagePath)
|
public PenumbraApiEc InstallMod(string modFilePackagePath)
|
||||||
{
|
{
|
||||||
if (File.Exists(modFilePackagePath))
|
if (File.Exists(modFilePackagePath))
|
||||||
{
|
{
|
||||||
ExternalModImporter.UnpackMod(modFilePackagePath);
|
_modImportManager.AddUnpack(modFilePackagePath);
|
||||||
return PenumbraApiEc.Success;
|
return PenumbraApiEc.Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
// Mods
|
// Mods
|
||||||
internal readonly FuncProvider<IList<(string, string)>> GetMods;
|
internal readonly FuncProvider<IList<(string, string)>> GetMods;
|
||||||
internal readonly FuncProvider<string, string, PenumbraApiEc> ReloadMod;
|
internal readonly FuncProvider<string, string, PenumbraApiEc> ReloadMod;
|
||||||
|
internal readonly FuncProvider<string, PenumbraApiEc> InstallMod;
|
||||||
internal readonly FuncProvider<string, PenumbraApiEc> AddMod;
|
internal readonly FuncProvider<string, PenumbraApiEc> AddMod;
|
||||||
internal readonly FuncProvider<string, string, PenumbraApiEc> DeleteMod;
|
internal readonly FuncProvider<string, string, PenumbraApiEc> DeleteMod;
|
||||||
internal readonly FuncProvider<string, string, (PenumbraApiEc, string, bool)> GetModPath;
|
internal readonly FuncProvider<string, string, (PenumbraApiEc, string, bool)> GetModPath;
|
||||||
|
|
@ -123,7 +124,8 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
ApiVersion = Ipc.ApiVersion.Provider(pi, DeprecatedVersion);
|
ApiVersion = Ipc.ApiVersion.Provider(pi, DeprecatedVersion);
|
||||||
ApiVersions = Ipc.ApiVersions.Provider(pi, () => Api.ApiVersion);
|
ApiVersions = Ipc.ApiVersions.Provider(pi, () => Api.ApiVersion);
|
||||||
GetEnabledState = Ipc.GetEnabledState.Provider(pi, Api.GetEnabledState);
|
GetEnabledState = Ipc.GetEnabledState.Provider(pi, Api.GetEnabledState);
|
||||||
EnabledChange = Ipc.EnabledChange.Provider( pi, () => Api.EnabledChange += EnabledChangeEvent, () => Api.EnabledChange -= EnabledChangeEvent );
|
EnabledChange =
|
||||||
|
Ipc.EnabledChange.Provider(pi, () => Api.EnabledChange += EnabledChangeEvent, () => Api.EnabledChange -= EnabledChangeEvent);
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
GetModDirectory = Ipc.GetModDirectory.Provider(pi, Api.GetModDirectory);
|
GetModDirectory = Ipc.GetModDirectory.Provider(pi, Api.GetModDirectory);
|
||||||
|
|
@ -133,7 +135,8 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
// UI
|
// UI
|
||||||
PreSettingsDraw = Ipc.PreSettingsDraw.Provider(pi, a => Api.PreSettingsPanelDraw += a, a => Api.PreSettingsPanelDraw -= a);
|
PreSettingsDraw = Ipc.PreSettingsDraw.Provider(pi, a => Api.PreSettingsPanelDraw += a, a => Api.PreSettingsPanelDraw -= a);
|
||||||
PostSettingsDraw = Ipc.PostSettingsDraw.Provider(pi, a => Api.PostSettingsPanelDraw += a, a => Api.PostSettingsPanelDraw -= a);
|
PostSettingsDraw = Ipc.PostSettingsDraw.Provider(pi, a => Api.PostSettingsPanelDraw += a, a => Api.PostSettingsPanelDraw -= a);
|
||||||
ChangedItemTooltip = Ipc.ChangedItemTooltip.Provider( pi, () => Api.ChangedItemTooltip += OnTooltip, () => Api.ChangedItemTooltip -= OnTooltip );
|
ChangedItemTooltip =
|
||||||
|
Ipc.ChangedItemTooltip.Provider(pi, () => Api.ChangedItemTooltip += OnTooltip, () => Api.ChangedItemTooltip -= OnTooltip);
|
||||||
ChangedItemClick = Ipc.ChangedItemClick.Provider(pi, () => Api.ChangedItemClicked += OnClick, () => Api.ChangedItemClicked -= OnClick);
|
ChangedItemClick = Ipc.ChangedItemClick.Provider(pi, () => Api.ChangedItemClicked += OnClick, () => Api.ChangedItemClicked -= OnClick);
|
||||||
OpenMainWindow = Ipc.OpenMainWindow.Provider(pi, Api.OpenMainWindow);
|
OpenMainWindow = Ipc.OpenMainWindow.Provider(pi, Api.OpenMainWindow);
|
||||||
CloseMainWindow = Ipc.CloseMainWindow.Provider(pi, Api.CloseMainWindow);
|
CloseMainWindow = Ipc.CloseMainWindow.Provider(pi, Api.CloseMainWindow);
|
||||||
|
|
@ -143,7 +146,8 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
RedrawObject = Ipc.RedrawObject.Provider(pi, Api.RedrawObject);
|
RedrawObject = Ipc.RedrawObject.Provider(pi, Api.RedrawObject);
|
||||||
RedrawObjectByIndex = Ipc.RedrawObjectByIndex.Provider(pi, Api.RedrawObject);
|
RedrawObjectByIndex = Ipc.RedrawObjectByIndex.Provider(pi, Api.RedrawObject);
|
||||||
RedrawObjectByName = Ipc.RedrawObjectByName.Provider(pi, Api.RedrawObject);
|
RedrawObjectByName = Ipc.RedrawObjectByName.Provider(pi, Api.RedrawObject);
|
||||||
GameObjectRedrawn = Ipc.GameObjectRedrawn.Provider( pi, () => Api.GameObjectRedrawn += OnGameObjectRedrawn, () => Api.GameObjectRedrawn -= OnGameObjectRedrawn );
|
GameObjectRedrawn = Ipc.GameObjectRedrawn.Provider(pi, () => Api.GameObjectRedrawn += OnGameObjectRedrawn,
|
||||||
|
() => Api.GameObjectRedrawn -= OnGameObjectRedrawn);
|
||||||
|
|
||||||
// Game State
|
// Game State
|
||||||
GetDrawObjectInfo = Ipc.GetDrawObjectInfo.Provider(pi, Api.GetDrawObjectInfo);
|
GetDrawObjectInfo = Ipc.GetDrawObjectInfo.Provider(pi, Api.GetDrawObjectInfo);
|
||||||
|
|
@ -189,6 +193,7 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
// Mods
|
// Mods
|
||||||
GetMods = Ipc.GetMods.Provider(pi, Api.GetModList);
|
GetMods = Ipc.GetMods.Provider(pi, Api.GetModList);
|
||||||
ReloadMod = Ipc.ReloadMod.Provider(pi, Api.ReloadMod);
|
ReloadMod = Ipc.ReloadMod.Provider(pi, Api.ReloadMod);
|
||||||
|
InstallMod = Ipc.InstallMod.Provider(pi, Api.InstallMod);
|
||||||
AddMod = Ipc.AddMod.Provider(pi, Api.AddMod);
|
AddMod = Ipc.AddMod.Provider(pi, Api.AddMod);
|
||||||
DeleteMod = Ipc.DeleteMod.Provider(pi, Api.DeleteMod);
|
DeleteMod = Ipc.DeleteMod.Provider(pi, Api.DeleteMod);
|
||||||
GetModPath = Ipc.GetModPath.Provider(pi, Api.GetModPath);
|
GetModPath = Ipc.GetModPath.Provider(pi, Api.GetModPath);
|
||||||
|
|
@ -295,6 +300,7 @@ public class PenumbraIpcProviders : IDisposable
|
||||||
// Mods
|
// Mods
|
||||||
GetMods.Dispose();
|
GetMods.Dispose();
|
||||||
ReloadMod.Dispose();
|
ReloadMod.Dispose();
|
||||||
|
InstallMod.Dispose();
|
||||||
AddMod.Dispose();
|
AddMod.Dispose();
|
||||||
DeleteMod.Dispose();
|
DeleteMod.Dispose();
|
||||||
GetModPath.Dispose();
|
GetModPath.Dispose();
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ public partial class TexToolsImporter : IDisposable
|
||||||
private readonly ModEditor _editor;
|
private readonly ModEditor _editor;
|
||||||
private readonly ModManager _modManager;
|
private readonly ModManager _modManager;
|
||||||
|
|
||||||
public TexToolsImporter( DirectoryInfo baseDirectory, int count, IEnumerable< FileInfo > modPackFiles,
|
public TexToolsImporter( int count, IEnumerable< FileInfo > modPackFiles,
|
||||||
Action< FileInfo, DirectoryInfo?, Exception? > handler, Configuration config, ModEditor editor, ModManager modManager)
|
Action< FileInfo, DirectoryInfo?, Exception? > handler, Configuration config, ModEditor editor, ModManager modManager)
|
||||||
{
|
{
|
||||||
_baseDirectory = baseDirectory;
|
_baseDirectory = modManager.BasePath;
|
||||||
_tmpFile = Path.Combine( _baseDirectory.FullName, TempFileName );
|
_tmpFile = Path.Combine( _baseDirectory.FullName, TempFileName );
|
||||||
_modPackFiles = modPackFiles;
|
_modPackFiles = modPackFiles;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ public class ModBackup
|
||||||
public readonly string Name;
|
public readonly string Name;
|
||||||
public readonly bool Exists;
|
public readonly bool Exists;
|
||||||
|
|
||||||
public ModBackup(ExportManager exportManager, Mod mod)
|
public ModBackup(ModExportManager modExportManager, Mod mod)
|
||||||
{
|
{
|
||||||
_mod = mod;
|
_mod = mod;
|
||||||
Name = Path.Combine(exportManager.ExportDirectory.FullName, _mod.ModPath.Name) + ".pmp";
|
Name = Path.Combine(modExportManager.ExportDirectory.FullName, _mod.ModPath.Name) + ".pmp";
|
||||||
Exists = File.Exists(Name);
|
Exists = File.Exists(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ using Penumbra.Services;
|
||||||
|
|
||||||
namespace Penumbra.Mods.Manager;
|
namespace Penumbra.Mods.Manager;
|
||||||
|
|
||||||
public class ExportManager : IDisposable
|
public class ModExportManager : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
private readonly CommunicatorService _communicator;
|
private readonly CommunicatorService _communicator;
|
||||||
|
|
@ -15,7 +15,7 @@ public class ExportManager : IDisposable
|
||||||
public DirectoryInfo ExportDirectory
|
public DirectoryInfo ExportDirectory
|
||||||
=> _exportDirectory ?? _modManager.BasePath;
|
=> _exportDirectory ?? _modManager.BasePath;
|
||||||
|
|
||||||
public ExportManager(Configuration config, CommunicatorService communicator, ModManager modManager)
|
public ModExportManager(Configuration config, CommunicatorService communicator, ModManager modManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_communicator = communicator;
|
_communicator = communicator;
|
||||||
123
Penumbra/Mods/Manager/ModImportManager.cs
Normal file
123
Penumbra/Mods/Manager/ModImportManager.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using Dalamud.Interface.Internal.Notifications;
|
||||||
|
using Penumbra.Import;
|
||||||
|
|
||||||
|
namespace Penumbra.Mods.Manager;
|
||||||
|
|
||||||
|
public class ModImportManager : IDisposable
|
||||||
|
{
|
||||||
|
private readonly ModManager _modManager;
|
||||||
|
private readonly Configuration _config;
|
||||||
|
private readonly ModEditor _modEditor;
|
||||||
|
|
||||||
|
private readonly ConcurrentQueue<string[]> _modsToUnpack = new();
|
||||||
|
|
||||||
|
/// <summary> Mods need to be added thread-safely outside of iteration. </summary>
|
||||||
|
private readonly ConcurrentQueue<DirectoryInfo> _modsToAdd = new();
|
||||||
|
|
||||||
|
private TexToolsImporter? _import;
|
||||||
|
|
||||||
|
public ModImportManager(ModManager modManager, Configuration config, ModEditor modEditor)
|
||||||
|
{
|
||||||
|
_modManager = modManager;
|
||||||
|
_config = config;
|
||||||
|
_modEditor = modEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TryUnpacking()
|
||||||
|
{
|
||||||
|
if (Importing || !_modsToUnpack.TryDequeue(out var newMods))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var files = newMods.Where(s =>
|
||||||
|
{
|
||||||
|
if (File.Exists(s))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
Penumbra.ChatService.NotificationMessage($"Failed to import queued mod at {s}, the file does not exist.", "Warning",
|
||||||
|
NotificationType.Warning);
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}).Select(s => new FileInfo(s)).ToArray();
|
||||||
|
|
||||||
|
if (files.Length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_import = new TexToolsImporter(files.Length, files, AddNewMod, _config, _modEditor, _modManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Importing
|
||||||
|
=> _import != null;
|
||||||
|
|
||||||
|
public bool IsImporting([NotNullWhen(true)] out TexToolsImporter? importer)
|
||||||
|
{
|
||||||
|
importer = _import;
|
||||||
|
return _import != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddUnpack(IEnumerable<string> paths)
|
||||||
|
=> _modsToUnpack.Enqueue(paths.ToArray());
|
||||||
|
|
||||||
|
public void AddUnpack(params string[] paths)
|
||||||
|
=> _modsToUnpack.Enqueue(paths);
|
||||||
|
|
||||||
|
public void ClearImport()
|
||||||
|
{
|
||||||
|
_import?.Dispose();
|
||||||
|
_import = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool AddUnpackedMod([NotNullWhen(true)] out Mod? mod)
|
||||||
|
{
|
||||||
|
if (!_modsToAdd.TryDequeue(out var directory))
|
||||||
|
{
|
||||||
|
mod = null;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_modManager.AddMod(directory);
|
||||||
|
mod = _modManager.LastOrDefault();
|
||||||
|
return mod != null && mod.ModPath == directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
ClearImport();
|
||||||
|
_modsToAdd.Clear();
|
||||||
|
_modsToUnpack.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up invalid directory if necessary.
|
||||||
|
/// Add successfully extracted mods.
|
||||||
|
/// </summary>
|
||||||
|
private void AddNewMod(FileInfo file, DirectoryInfo? dir, Exception? error)
|
||||||
|
{
|
||||||
|
if (error != null)
|
||||||
|
{
|
||||||
|
if (dir != null && Directory.Exists(dir.FullName))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Delete(dir.FullName, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Penumbra.Log.Error($"Error cleaning up failed mod extraction of {file.FullName} to {dir.FullName}:\n{e}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error is not OperationCanceledException)
|
||||||
|
Penumbra.Log.Error($"Error extracting {file.FullName}, mod skipped:\n{error}");
|
||||||
|
}
|
||||||
|
else if (dir != null)
|
||||||
|
{
|
||||||
|
_modsToAdd.Enqueue(dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -98,7 +98,8 @@ public class PenumbraNew
|
||||||
.AddSingleton<ModDataEditor>()
|
.AddSingleton<ModDataEditor>()
|
||||||
.AddSingleton<ModOptionEditor>()
|
.AddSingleton<ModOptionEditor>()
|
||||||
.AddSingleton<ModManager>()
|
.AddSingleton<ModManager>()
|
||||||
.AddSingleton<ExportManager>()
|
.AddSingleton<ModExportManager>()
|
||||||
|
.AddSingleton<ModImportManager>()
|
||||||
.AddSingleton<ModFileSystem>()
|
.AddSingleton<ModFileSystem>()
|
||||||
.AddSingleton<ModCacheManager>();
|
.AddSingleton<ModCacheManager>();
|
||||||
|
|
||||||
|
|
@ -131,6 +132,7 @@ public class PenumbraNew
|
||||||
.AddSingleton<ModsTab>()
|
.AddSingleton<ModsTab>()
|
||||||
.AddSingleton<ModPanel>()
|
.AddSingleton<ModPanel>()
|
||||||
.AddSingleton<ModFileSystemSelector>()
|
.AddSingleton<ModFileSystemSelector>()
|
||||||
|
.AddSingleton<ImportPopup>()
|
||||||
.AddSingleton<ModPanelDescriptionTab>()
|
.AddSingleton<ModPanelDescriptionTab>()
|
||||||
.AddSingleton<ModPanelSettingsTab>()
|
.AddSingleton<ModPanelSettingsTab>()
|
||||||
.AddSingleton<ModPanelEditTab>()
|
.AddSingleton<ModPanelEditTab>()
|
||||||
|
|
|
||||||
64
Penumbra/UI/ImportPopup.cs
Normal file
64
Penumbra/UI/ImportPopup.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System;
|
||||||
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
|
using ImGuiNET;
|
||||||
|
using OtterGui.Raii;
|
||||||
|
using Penumbra.Import.Structs;
|
||||||
|
using Penumbra.Mods.Manager;
|
||||||
|
|
||||||
|
namespace Penumbra.UI;
|
||||||
|
|
||||||
|
/// <summary> Draw the progress information for import. </summary>
|
||||||
|
public sealed class ImportPopup : Window
|
||||||
|
{
|
||||||
|
private readonly ModImportManager _modImportManager;
|
||||||
|
|
||||||
|
public ImportPopup(ModImportManager modImportManager)
|
||||||
|
: base("Penumbra Import Status",
|
||||||
|
ImGuiWindowFlags.Modal
|
||||||
|
| ImGuiWindowFlags.Popup
|
||||||
|
| ImGuiWindowFlags.NoCollapse
|
||||||
|
| ImGuiWindowFlags.NoDecoration
|
||||||
|
| ImGuiWindowFlags.NoBackground
|
||||||
|
| ImGuiWindowFlags.NoMove
|
||||||
|
| ImGuiWindowFlags.NoInputs
|
||||||
|
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||||
|
| ImGuiWindowFlags.NoBringToFrontOnFocus, true)
|
||||||
|
{
|
||||||
|
_modImportManager = modImportManager;
|
||||||
|
IsOpen = true;
|
||||||
|
SizeConstraints = new WindowSizeConstraints
|
||||||
|
{
|
||||||
|
MinimumSize = Vector2.Zero,
|
||||||
|
MaximumSize = Vector2.Zero,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
_modImportManager.TryUnpacking();
|
||||||
|
if (!_modImportManager.IsImporting(out var import))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ImGui.OpenPopup("##importPopup");
|
||||||
|
|
||||||
|
var display = ImGui.GetIO().DisplaySize;
|
||||||
|
var height = Math.Max(display.Y / 4, 15 * ImGui.GetFrameHeightWithSpacing());
|
||||||
|
var width = display.X / 8;
|
||||||
|
var size = new Vector2(width * 2, height);
|
||||||
|
ImGui.SetNextWindowPos(ImGui.GetMainViewport().GetCenter(), ImGuiCond.Always, Vector2.One / 2);
|
||||||
|
ImGui.SetNextWindowSize(size);
|
||||||
|
using var popup = ImRaii.Popup("##importPopup", ImGuiWindowFlags.Modal);
|
||||||
|
using (var child = ImRaii.Child("##import", new Vector2(-1, size.Y - ImGui.GetFrameHeight() * 2)))
|
||||||
|
{
|
||||||
|
if (child)
|
||||||
|
import.DrawProgressInfo(new Vector2(-1, ImGui.GetFrameHeight()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((import.State != ImporterState.Done || !ImGui.Button("Close", -Vector2.UnitX))
|
||||||
|
&& (import.State == ImporterState.Done || !import.DrawCancelButton(-Vector2.UnitX)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_modImportManager.ClearImport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
@ -13,12 +10,9 @@ using OtterGui.Classes;
|
||||||
using OtterGui.Filesystem;
|
using OtterGui.Filesystem;
|
||||||
using OtterGui.FileSystem.Selector;
|
using OtterGui.FileSystem.Selector;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using Penumbra.Api;
|
|
||||||
using Penumbra.Api.Enums;
|
using Penumbra.Api.Enums;
|
||||||
using Penumbra.Collections;
|
using Penumbra.Collections;
|
||||||
using Penumbra.Collections.Manager;
|
using Penumbra.Collections.Manager;
|
||||||
using Penumbra.Import;
|
|
||||||
using Penumbra.Import.Structs;
|
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Mods.Manager;
|
using Penumbra.Mods.Manager;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
|
|
@ -27,7 +21,7 @@ using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.UI.ModsTab;
|
namespace Penumbra.UI.ModsTab;
|
||||||
|
|
||||||
public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSystemSelector.ModState>
|
public sealed class ModFileSystemSelector : FileSystemSelector<Mod, ModFileSystemSelector.ModState>
|
||||||
{
|
{
|
||||||
private readonly CommunicatorService _communicator;
|
private readonly CommunicatorService _communicator;
|
||||||
private readonly ChatService _chat;
|
private readonly ChatService _chat;
|
||||||
|
|
@ -37,18 +31,13 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
private readonly ModCacheManager _modCaches;
|
private readonly ModCacheManager _modCaches;
|
||||||
private readonly CollectionManager _collectionManager;
|
private readonly CollectionManager _collectionManager;
|
||||||
private readonly TutorialService _tutorial;
|
private readonly TutorialService _tutorial;
|
||||||
private readonly ModEditor _modEditor;
|
private readonly ModImportManager _modImportManager;
|
||||||
private Queue<string> _modUnpackQueue = new Queue<string>();
|
|
||||||
|
|
||||||
private TexToolsImporter? _import;
|
|
||||||
public ModSettings SelectedSettings { get; private set; } = ModSettings.Empty;
|
public ModSettings SelectedSettings { get; private set; } = ModSettings.Empty;
|
||||||
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
|
public ModCollection SelectedSettingCollection { get; private set; } = ModCollection.Empty;
|
||||||
|
|
||||||
private uint _infoPopupId = 0;
|
|
||||||
|
|
||||||
public ModFileSystemSelector(CommunicatorService communicator, ModFileSystem fileSystem, ModManager modManager,
|
public ModFileSystemSelector(CommunicatorService communicator, ModFileSystem fileSystem, ModManager modManager,
|
||||||
CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat,
|
CollectionManager collectionManager, Configuration config, TutorialService tutorial, FileDialogService fileDialog, ChatService chat,
|
||||||
ModEditor modEditor, ModCacheManager modCaches)
|
ModCacheManager modCaches, ModImportManager modImportManager)
|
||||||
: base(fileSystem, DalamudServices.KeyState, HandleException)
|
: base(fileSystem, DalamudServices.KeyState, HandleException)
|
||||||
{
|
{
|
||||||
_communicator = communicator;
|
_communicator = communicator;
|
||||||
|
|
@ -58,8 +47,8 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
_tutorial = tutorial;
|
_tutorial = tutorial;
|
||||||
_fileDialog = fileDialog;
|
_fileDialog = fileDialog;
|
||||||
_chat = chat;
|
_chat = chat;
|
||||||
_modEditor = modEditor;
|
|
||||||
_modCaches = modCaches;
|
_modCaches = modCaches;
|
||||||
|
_modImportManager = modImportManager;
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
SubscribeRightClickFolder(EnableDescendants, 10);
|
SubscribeRightClickFolder(EnableDescendants, 10);
|
||||||
|
|
@ -91,7 +80,6 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
_communicator.ModDiscoveryStarted.Subscribe(StoreCurrentSelection);
|
_communicator.ModDiscoveryStarted.Subscribe(StoreCurrentSelection);
|
||||||
_communicator.ModDiscoveryFinished.Subscribe(RestoreLastSelection);
|
_communicator.ModDiscoveryFinished.Subscribe(RestoreLastSelection);
|
||||||
OnCollectionChange(CollectionType.Current, null, _collectionManager.Active.Current, "");
|
OnCollectionChange(CollectionType.Current, null, _collectionManager.Active.Current, "");
|
||||||
ExternalModImporter.ModFileSystemSelectorInstance = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|
@ -103,8 +91,6 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
_collectionManager.Active.Current.ModSettingChanged -= OnSettingChange;
|
_collectionManager.Active.Current.ModSettingChanged -= OnSettingChange;
|
||||||
_collectionManager.Active.Current.InheritanceChanged -= OnInheritanceChange;
|
_collectionManager.Active.Current.InheritanceChanged -= OnInheritanceChange;
|
||||||
_communicator.CollectionChange.Unsubscribe(OnCollectionChange);
|
_communicator.CollectionChange.Unsubscribe(OnCollectionChange);
|
||||||
_import?.Dispose();
|
|
||||||
_import = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new ModFileSystem.Leaf? SelectedLeaf
|
public new ModFileSystem.Leaf? SelectedLeaf
|
||||||
|
|
@ -131,7 +117,6 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
protected override void DrawPopups()
|
protected override void DrawPopups()
|
||||||
{
|
{
|
||||||
DrawHelpPopup();
|
DrawHelpPopup();
|
||||||
DrawInfoPopup();
|
|
||||||
|
|
||||||
if (ImGuiUtil.OpenNameField("Create New Mod", ref _newModName))
|
if (ImGuiUtil.OpenNameField("Create New Mod", ref _newModName))
|
||||||
try
|
try
|
||||||
|
|
@ -147,13 +132,8 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
Penumbra.Log.Error($"Could not create directory for new Mod {_newModName}:\n{e}");
|
Penumbra.Log.Error($"Could not create directory for new Mod {_newModName}:\n{e}");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (_modsToAdd.TryDequeue(out var dir))
|
while (_modImportManager.AddUnpackedMod(out var mod))
|
||||||
{
|
{
|
||||||
_modManager.AddMod(dir);
|
|
||||||
var mod = _modManager.LastOrDefault();
|
|
||||||
if (mod == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
MoveModToDefaultDirectory(mod);
|
MoveModToDefaultDirectory(mod);
|
||||||
SelectByValue(mod);
|
SelectByValue(mod);
|
||||||
}
|
}
|
||||||
|
|
@ -234,8 +214,6 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
/// <summary> Add an import mods button that opens a file selector. </summary>
|
/// <summary> Add an import mods button that opens a file selector. </summary>
|
||||||
private void AddImportModButton(Vector2 size)
|
private void AddImportModButton(Vector2 size)
|
||||||
{
|
{
|
||||||
_infoPopupId = ImGui.GetID("Import Status");
|
|
||||||
ExternalImportListener();
|
|
||||||
var button = ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.FileImport.ToIconString(), size,
|
var button = ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.FileImport.ToIconString(), size,
|
||||||
"Import one or multiple mods from Tex Tools Mod Pack Files or Penumbra Mod Pack Files.", !Penumbra.ModManager.Valid, true);
|
"Import one or multiple mods from Tex Tools Mod Pack Files or Penumbra Mod Pack Files.", !Penumbra.ModManager.Valid, true);
|
||||||
_tutorial.OpenTutorial(BasicTutorialSteps.ModImport);
|
_tutorial.OpenTutorial(BasicTutorialSteps.ModImport);
|
||||||
|
|
@ -251,105 +229,11 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
{
|
{
|
||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
_modsCurrentlyUnpacking = true;
|
|
||||||
_import = new TexToolsImporter(_modManager.BasePath, f.Count, f.Select(file => new FileInfo(file)),
|
_modImportManager.AddUnpack(f);
|
||||||
AddNewMod, _config, _modEditor, _modManager);
|
|
||||||
ImGui.OpenPopup(_infoPopupId);
|
|
||||||
}, 0, modPath, _config.AlwaysOpenDefaultImport);
|
}, 0, modPath, _config.AlwaysOpenDefaultImport);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExternalImportListener()
|
|
||||||
{
|
|
||||||
if (_modUnpackQueue.Count > 0)
|
|
||||||
{
|
|
||||||
// Attempt to avoid triggering if other mods are already unpacking
|
|
||||||
if (!_modsCurrentlyUnpacking)
|
|
||||||
{
|
|
||||||
string modPackagePath = _modUnpackQueue.Dequeue();
|
|
||||||
if (File.Exists(modPackagePath))
|
|
||||||
{
|
|
||||||
_modsCurrentlyUnpacking = true;
|
|
||||||
var modPath = !_config.AlwaysOpenDefaultImport ? null
|
|
||||||
: _config.DefaultModImportPath.Length > 0 ? _config.DefaultModImportPath
|
|
||||||
: _config.ModDirectory.Length > 0 ? _config.ModDirectory : null;
|
|
||||||
|
|
||||||
_import = new TexToolsImporter(Penumbra.ModManager.BasePath, 1, new List<FileInfo>() { new FileInfo(modPackagePath) }, AddNewMod,
|
|
||||||
_config, _modEditor, _modManager);
|
|
||||||
ImGui.OpenPopup(_infoPopupId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unpacks the specified standalone package
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="modPackagePath">The package to unpack</param>
|
|
||||||
public void ImportStandaloneModPackage(string modPackagePath)
|
|
||||||
{
|
|
||||||
_modUnpackQueue.Enqueue(modPackagePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Draw the progress information for import. </summary>
|
|
||||||
private void DrawInfoPopup()
|
|
||||||
{
|
|
||||||
var display = ImGui.GetIO().DisplaySize;
|
|
||||||
var height = Math.Max(display.Y / 4, 15 * ImGui.GetFrameHeightWithSpacing());
|
|
||||||
var width = display.X / 8;
|
|
||||||
var size = new Vector2(width * 2, height);
|
|
||||||
ImGui.SetNextWindowPos(ImGui.GetMainViewport().GetCenter(), ImGuiCond.Always, Vector2.One / 2);
|
|
||||||
ImGui.SetNextWindowSize(size);
|
|
||||||
var infoPopupId = ImGui.GetID("Import Status");
|
|
||||||
using var popup = ImRaii.Popup("Import Status", ImGuiWindowFlags.Modal);
|
|
||||||
if (_import == null || !popup.Success)
|
|
||||||
return;
|
|
||||||
|
|
||||||
using (var child = ImRaii.Child("##import", new Vector2(-1, size.Y - ImGui.GetFrameHeight() * 2)))
|
|
||||||
{
|
|
||||||
if (child)
|
|
||||||
_import.DrawProgressInfo(new Vector2(-1, ImGui.GetFrameHeight()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((_import.State != ImporterState.Done || !ImGui.Button("Close", -Vector2.UnitX))
|
|
||||||
&& (_import.State == ImporterState.Done || !_import.DrawCancelButton(-Vector2.UnitX)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_import?.Dispose();
|
|
||||||
_import = null;
|
|
||||||
ImGui.CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Mods need to be added thread-safely outside of iteration. </summary>
|
|
||||||
private readonly ConcurrentQueue<DirectoryInfo> _modsToAdd = new();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up invalid directory if necessary.
|
|
||||||
/// Add successfully extracted mods.
|
|
||||||
/// </summary>
|
|
||||||
private void AddNewMod(FileInfo file, DirectoryInfo? dir, Exception? error)
|
|
||||||
{
|
|
||||||
if (error != null)
|
|
||||||
{
|
|
||||||
if (dir != null && Directory.Exists(dir.FullName))
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Directory.Delete(dir.FullName, true);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Penumbra.Log.Error($"Error cleaning up failed mod extraction of {file.FullName} to {dir.FullName}:\n{e}");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error is not OperationCanceledException)
|
|
||||||
Penumbra.Log.Error($"Error extracting {file.FullName}, mod skipped:\n{error}");
|
|
||||||
}
|
|
||||||
else if (dir != null)
|
|
||||||
{
|
|
||||||
_modsToAdd.Enqueue(dir);
|
|
||||||
}
|
|
||||||
_modsCurrentlyUnpacking = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeleteModButton(Vector2 size)
|
private void DeleteModButton(Vector2 size)
|
||||||
{
|
{
|
||||||
var keys = _config.DeleteModModifier.IsActive();
|
var keys = _config.DeleteModModifier.IsActive();
|
||||||
|
|
@ -573,7 +457,6 @@ public sealed partial class ModFileSystemSelector : FileSystemSelector<Mod, ModF
|
||||||
private LowerString _modFilter = LowerString.Empty;
|
private LowerString _modFilter = LowerString.Empty;
|
||||||
private int _filterType = -1;
|
private int _filterType = -1;
|
||||||
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
||||||
private bool _modsCurrentlyUnpacking;
|
|
||||||
|
|
||||||
private void SetFilterTooltip()
|
private void SetFilterTooltip()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class ModPanelEditTab : ITab
|
||||||
private readonly ChatService _chat;
|
private readonly ChatService _chat;
|
||||||
private readonly FilenameService _filenames;
|
private readonly FilenameService _filenames;
|
||||||
private readonly ModManager _modManager;
|
private readonly ModManager _modManager;
|
||||||
private readonly ExportManager _exportManager;
|
private readonly ModExportManager _modExportManager;
|
||||||
private readonly ModFileSystem _fileSystem;
|
private readonly ModFileSystem _fileSystem;
|
||||||
private readonly ModFileSystemSelector _selector;
|
private readonly ModFileSystemSelector _selector;
|
||||||
private readonly ModEditWindow _editWindow;
|
private readonly ModEditWindow _editWindow;
|
||||||
|
|
@ -38,7 +38,7 @@ public class ModPanelEditTab : ITab
|
||||||
private Mod _mod = null!;
|
private Mod _mod = null!;
|
||||||
|
|
||||||
public ModPanelEditTab(ModManager modManager, ModFileSystemSelector selector, ModFileSystem fileSystem, ChatService chat,
|
public ModPanelEditTab(ModManager modManager, ModFileSystemSelector selector, ModFileSystem fileSystem, ChatService chat,
|
||||||
ModEditWindow editWindow, ModEditor editor, FilenameService filenames, ExportManager exportManager)
|
ModEditWindow editWindow, ModEditor editor, FilenameService filenames, ModExportManager modExportManager)
|
||||||
{
|
{
|
||||||
_modManager = modManager;
|
_modManager = modManager;
|
||||||
_selector = selector;
|
_selector = selector;
|
||||||
|
|
@ -47,7 +47,7 @@ public class ModPanelEditTab : ITab
|
||||||
_editWindow = editWindow;
|
_editWindow = editWindow;
|
||||||
_editor = editor;
|
_editor = editor;
|
||||||
_filenames = filenames;
|
_filenames = filenames;
|
||||||
_exportManager = exportManager;
|
_modExportManager = modExportManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadOnlySpan<byte> Label
|
public ReadOnlySpan<byte> Label
|
||||||
|
|
@ -150,7 +150,7 @@ public class ModPanelEditTab : ITab
|
||||||
|
|
||||||
private void BackupButtons(Vector2 buttonSize)
|
private void BackupButtons(Vector2 buttonSize)
|
||||||
{
|
{
|
||||||
var backup = new ModBackup(_exportManager, _mod);
|
var backup = new ModBackup(_modExportManager, _mod);
|
||||||
var tt = ModBackup.CreatingBackup
|
var tt = ModBackup.CreatingBackup
|
||||||
? "Already exporting a mod."
|
? "Already exporting a mod."
|
||||||
: backup.Exists
|
: backup.Exists
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class SettingsTab : ITab
|
||||||
private readonly Penumbra _penumbra;
|
private readonly Penumbra _penumbra;
|
||||||
private readonly FileDialogService _fileDialog;
|
private readonly FileDialogService _fileDialog;
|
||||||
private readonly ModManager _modManager;
|
private readonly ModManager _modManager;
|
||||||
private readonly ExportManager _exportManager;
|
private readonly ModExportManager _modExportManager;
|
||||||
private readonly ModFileSystemSelector _selector;
|
private readonly ModFileSystemSelector _selector;
|
||||||
private readonly CharacterUtility _characterUtility;
|
private readonly CharacterUtility _characterUtility;
|
||||||
private readonly ResidentResourceManager _residentResources;
|
private readonly ResidentResourceManager _residentResources;
|
||||||
|
|
@ -40,7 +40,7 @@ public class SettingsTab : ITab
|
||||||
|
|
||||||
public SettingsTab(Configuration config, FontReloader fontReloader, TutorialService tutorial, Penumbra penumbra,
|
public SettingsTab(Configuration config, FontReloader fontReloader, TutorialService tutorial, Penumbra penumbra,
|
||||||
FileDialogService fileDialog, ModManager modManager, ModFileSystemSelector selector, CharacterUtility characterUtility,
|
FileDialogService fileDialog, ModManager modManager, ModFileSystemSelector selector, CharacterUtility characterUtility,
|
||||||
ResidentResourceManager residentResources, DalamudServices dalamud, ExportManager exportManager)
|
ResidentResourceManager residentResources, DalamudServices dalamud, ModExportManager modExportManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_fontReloader = fontReloader;
|
_fontReloader = fontReloader;
|
||||||
|
|
@ -52,7 +52,7 @@ public class SettingsTab : ITab
|
||||||
_characterUtility = characterUtility;
|
_characterUtility = characterUtility;
|
||||||
_residentResources = residentResources;
|
_residentResources = residentResources;
|
||||||
_dalamud = dalamud;
|
_dalamud = dalamud;
|
||||||
_exportManager = exportManager;
|
_modExportManager = modExportManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawHeader()
|
public void DrawHeader()
|
||||||
|
|
@ -555,7 +555,7 @@ public class SettingsTab : ITab
|
||||||
_tempExportDirectory = tmp;
|
_tempExportDirectory = tmp;
|
||||||
|
|
||||||
if (ImGui.IsItemDeactivatedAfterEdit())
|
if (ImGui.IsItemDeactivatedAfterEdit())
|
||||||
_exportManager.UpdateExportDirectory(_tempExportDirectory);
|
_modExportManager.UpdateExportDirectory(_tempExportDirectory);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##export", UiHelpers.IconButtonSize,
|
if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##export", UiHelpers.IconButtonSize,
|
||||||
|
|
@ -569,7 +569,7 @@ public class SettingsTab : ITab
|
||||||
_fileDialog.OpenFolderPicker("Choose Default Export Directory", (b, s) =>
|
_fileDialog.OpenFolderPicker("Choose Default Export Directory", (b, s) =>
|
||||||
{
|
{
|
||||||
if (b)
|
if (b)
|
||||||
_exportManager.UpdateExportDirectory(s);
|
_modExportManager.UpdateExportDirectory(s);
|
||||||
}, startDir, false);
|
}, startDir, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ public class PenumbraWindowSystem : IDisposable
|
||||||
public readonly PenumbraChangelog Changelog;
|
public readonly PenumbraChangelog Changelog;
|
||||||
|
|
||||||
public PenumbraWindowSystem(DalamudPluginInterface pi, Configuration config, PenumbraChangelog changelog, ConfigWindow window,
|
public PenumbraWindowSystem(DalamudPluginInterface pi, Configuration config, PenumbraChangelog changelog, ConfigWindow window,
|
||||||
LaunchButton _,
|
LaunchButton _, ModEditWindow editWindow, FileDialogService fileDialog, ImportPopup importPopup)
|
||||||
ModEditWindow editWindow, FileDialogService fileDialog)
|
|
||||||
{
|
{
|
||||||
_uiBuilder = pi.UiBuilder;
|
_uiBuilder = pi.UiBuilder;
|
||||||
_fileDialog = fileDialog;
|
_fileDialog = fileDialog;
|
||||||
|
|
@ -27,6 +26,7 @@ public class PenumbraWindowSystem : IDisposable
|
||||||
_windowSystem.AddWindow(changelog.Changelog);
|
_windowSystem.AddWindow(changelog.Changelog);
|
||||||
_windowSystem.AddWindow(window);
|
_windowSystem.AddWindow(window);
|
||||||
_windowSystem.AddWindow(editWindow);
|
_windowSystem.AddWindow(editWindow);
|
||||||
|
_windowSystem.AddWindow(importPopup);
|
||||||
_uiBuilder.OpenConfigUi += Window.Toggle;
|
_uiBuilder.OpenConfigUi += Window.Toggle;
|
||||||
_uiBuilder.Draw += _windowSystem.Draw;
|
_uiBuilder.Draw += _windowSystem.Draw;
|
||||||
_uiBuilder.Draw += _fileDialog.Draw;
|
_uiBuilder.Draw += _fileDialog.Draw;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue