diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
index 570b63332..92f340a7b 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs
@@ -1,19 +1,44 @@
-using Dalamud.Interface.Utility;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Numerics;
+using System.Reflection;
+using System.Text;
+
+using Dalamud.Interface.Internal.Notifications;
+using Dalamud.Interface.Utility;
+using Dalamud.Interface.Utility.Raii;
using Dalamud.Plugin.Ipc.Internal;
+
using ImGuiNET;
+using Newtonsoft.Json;
+
+using Formatting = Newtonsoft.Json.Formatting;
+
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
///
/// Widget for displaying plugin data share modules.
///
+[SuppressMessage(
+ "StyleCop.CSharp.LayoutRules",
+ "SA1519:Braces should not be omitted from multi-line child statement",
+ Justification = "Multiple fixed blocks")]
internal class DataShareWidget : IDataWindowWidget
{
+ private const ImGuiTabItemFlags NoCloseButton = (ImGuiTabItemFlags)(1 << 20);
+
+ private readonly List<(string Name, byte[]? Data)> dataView = new();
+ private int nextTab = -1;
+ private IReadOnlyDictionary? gates;
+ private List? gatesSorted;
+
///
public string[]? CommandShortcuts { get; init; } = { "datashare" };
-
+
///
- public string DisplayName { get; init; } = "Data Share";
+ public string DisplayName { get; init; } = "Data Share & Call Gate";
///
public bool Ready { get; set; }
@@ -25,28 +50,290 @@ internal class DataShareWidget : IDataWindowWidget
}
///
- public void Draw()
+ public unsafe void Draw()
{
- if (!ImGui.BeginTable("###DataShareTable", 4, ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.RowBg))
+ using var tabbar = ImRaii.TabBar("##tabbar");
+ if (!tabbar.Success)
+ return;
+
+ var d = true;
+ using (var tabitem = ImRaii.TabItem(
+ "Data Share##tabbar-datashare",
+ ref d,
+ NoCloseButton | (this.nextTab == 0 ? ImGuiTabItemFlags.SetSelected : 0)))
+ {
+ if (tabitem.Success)
+ this.DrawDataShare();
+ }
+
+ using (var tabitem = ImRaii.TabItem(
+ "Call Gate##tabbar-callgate",
+ ref d,
+ NoCloseButton | (this.nextTab == 1 ? ImGuiTabItemFlags.SetSelected : 0)))
+ {
+ if (tabitem.Success)
+ this.DrawCallGate();
+ }
+
+ for (var i = 0; i < this.dataView.Count; i++)
+ {
+ using var idpush = ImRaii.PushId($"##tabbar-data-{i}");
+ var (name, data) = this.dataView[i];
+ d = true;
+ using var tabitem = ImRaii.TabItem(
+ name,
+ ref d,
+ this.nextTab == 2 + i ? ImGuiTabItemFlags.SetSelected : 0);
+ if (!d)
+ this.dataView.RemoveAt(i--);
+ if (!tabitem.Success)
+ continue;
+
+ if (ImGui.Button("Refresh"))
+ data = null;
+
+ if (data is null)
+ {
+ try
+ {
+ var dataShare = Service.Get();
+ var data2 = dataShare.GetData