Add testing to IPC Meta.

This commit is contained in:
Ottermandias 2024-11-27 18:41:16 +01:00
parent c8ad4bc106
commit 242c0ee38f
4 changed files with 29 additions and 13 deletions

View file

@ -2,13 +2,19 @@ using Dalamud.Plugin;
using ImGuiNET;
using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text;
using Penumbra.Api.Api;
using Penumbra.Api.IpcSubscribers;
using Penumbra.Meta.Manipulations;
namespace Penumbra.Api.IpcTester;
public class MetaIpcTester(IDalamudPluginInterface pi) : IUiService
{
private int _gameObjectIndex;
private int _gameObjectIndex;
private string _metaBase64 = string.Empty;
private MetaDictionary _metaDict = new();
private byte _parsedVersion = byte.MaxValue;
public void Draw()
{
@ -17,6 +23,11 @@ public class MetaIpcTester(IDalamudPluginInterface pi) : IUiService
return;
ImGui.InputInt("##metaIdx", ref _gameObjectIndex, 0, 0);
if (ImUtf8.InputText("##metaText"u8, ref _metaBase64, "Base64 Metadata..."u8))
if (!MetaApi.ConvertManips(_metaBase64, out _metaDict, out _parsedVersion))
_metaDict ??= new MetaDictionary();
using var table = ImRaii.Table(string.Empty, 3, ImGuiTableFlags.SizingFixedFit);
if (!table)
return;
@ -34,5 +45,8 @@ public class MetaIpcTester(IDalamudPluginInterface pi) : IUiService
var base64 = new GetMetaManipulations(pi).Invoke(_gameObjectIndex);
ImGui.SetClipboardText(base64);
}
IpcTester.DrawIntro(string.Empty, "Parsed Data");
ImUtf8.Text($"Version: {_parsedVersion}, Count: {_metaDict.Count}");
}
}