Rework around a saner import popup and decouple logic from interface.

This commit is contained in:
Ottermandias 2023-04-08 22:29:43 +02:00
parent bfb630d317
commit bbfc9a0a6f
16 changed files with 478 additions and 411 deletions

View file

@ -18,8 +18,8 @@ using Penumbra.Meta.Manipulations;
using Penumbra.Mods.Manager;
using Penumbra.Services;
using Penumbra.UI;
using Penumbra.Collections.Manager;
using Penumbra.Collections.Manager;
namespace Penumbra.Api;
public class IpcTester : IDisposable
@ -847,13 +847,15 @@ public class IpcTester : IDisposable
{
private readonly DalamudPluginInterface _pi;
private string _modDirectory = string.Empty;
private string _modName = string.Empty;
private string _pathInput = string.Empty;
private string _modDirectory = string.Empty;
private string _modName = string.Empty;
private string _pathInput = string.Empty;
private string _newInstallPath = string.Empty;
private PenumbraApiEc _lastReloadEc;
private PenumbraApiEc _lastAddEc;
private PenumbraApiEc _lastDeleteEc;
private PenumbraApiEc _lastSetPathEc;
private PenumbraApiEc _lastInstallEc;
private IList<(string, string)> _mods = new List<(string, string)>();
public readonly EventSubscriber<string> DeleteSubscriber;
@ -895,9 +897,10 @@ public class IpcTester : IDisposable
if (!_)
return;
ImGui.InputTextWithHint("##modDir", "Mod Directory Name...", ref _modDirectory, 100);
ImGui.InputTextWithHint("##modName", "Mod Name...", ref _modName, 100);
ImGui.InputTextWithHint("##path", "New Path...", ref _pathInput, 100);
ImGui.InputTextWithHint("##install", "Install File Path...", ref _newInstallPath, 100);
ImGui.InputTextWithHint("##modDir", "Mod Directory Name...", ref _modDirectory, 100);
ImGui.InputTextWithHint("##modName", "Mod Name...", ref _modName, 100);
ImGui.InputTextWithHint("##path", "New Path...", ref _pathInput, 100);
using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit);
if (!table)
return;
@ -916,6 +919,13 @@ public class IpcTester : IDisposable
ImGui.SameLine();
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");
if (ImGui.Button("Add"))
_lastAddEc = Ipc.AddMod.Subscriber(_pi).Invoke(_modDirectory);
@ -1140,7 +1150,7 @@ public class IpcTester : IDisposable
private class Temporary
{
private readonly DalamudPluginInterface _pi;
private readonly ModManager _modManager;
private readonly ModManager _modManager;
public Temporary(DalamudPluginInterface pi, ModManager modManager)
{