feat: add some debug data collection buttons
This commit is contained in:
parent
bf34559e63
commit
6aae1a0f36
|
@ -8,6 +8,10 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Lumina.Excel.GeneratedSheets;
|
using Lumina.Excel.GeneratedSheets;
|
||||||
|
#if DEBUG
|
||||||
|
using System.Text;
|
||||||
|
using NoSoliciting.Ml;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace NoSoliciting {
|
namespace NoSoliciting {
|
||||||
public class Message {
|
public class Message {
|
||||||
|
@ -74,6 +78,25 @@ namespace NoSoliciting {
|
||||||
TypeNameHandling = TypeNameHandling.None,
|
TypeNameHandling = TypeNameHandling.None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
public StringBuilder ToCsv(StringBuilder? builder = null) {
|
||||||
|
builder ??= new StringBuilder();
|
||||||
|
|
||||||
|
var category = MessageCategoryExt.FromName(this.FilterReason) ?? MessageCategory.Normal;
|
||||||
|
|
||||||
|
builder.Append(category.ToModelName());
|
||||||
|
builder.Append(',');
|
||||||
|
builder.Append((int) this.ChatType);
|
||||||
|
builder.Append(",\"");
|
||||||
|
builder.Append(this.Content.TextValue
|
||||||
|
.Replace("\"", "\"\"")
|
||||||
|
.Replace("\r", " "));
|
||||||
|
builder.Append('"');
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1028:Enum Storage should be Int32")]
|
||||||
|
|
|
@ -27,6 +27,36 @@ namespace NoSoliciting.Ml {
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
|
||||||
|
public static string ToModelName(this MessageCategory category) => category switch {
|
||||||
|
MessageCategory.Trade => "TRADE",
|
||||||
|
MessageCategory.FreeCompany => "FC",
|
||||||
|
MessageCategory.Normal => "NORMAL",
|
||||||
|
MessageCategory.Phishing => "PHISH",
|
||||||
|
MessageCategory.RmtContent => "RMT_C",
|
||||||
|
MessageCategory.RmtGil => "RMT_G",
|
||||||
|
MessageCategory.Roleplaying => "RP",
|
||||||
|
MessageCategory.Static => "STATIC",
|
||||||
|
MessageCategory.Community => "COMMUNITY",
|
||||||
|
_ => throw new ArgumentException("Invalid category", nameof(category)),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static MessageCategory? FromName(string? category) => category switch {
|
||||||
|
"Trade ads" => MessageCategory.Trade,
|
||||||
|
"Free Company ads" => MessageCategory.FreeCompany,
|
||||||
|
"Normal messages" => MessageCategory.Normal,
|
||||||
|
"Phishing messages" => MessageCategory.Phishing,
|
||||||
|
"RMT (content)" => MessageCategory.RmtContent,
|
||||||
|
"RMT (gil)" => MessageCategory.RmtGil,
|
||||||
|
"Roleplaying ads" => MessageCategory.Roleplaying,
|
||||||
|
"Static recruitment" => MessageCategory.Static,
|
||||||
|
"Community ads" => MessageCategory.Community,
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
public static string Name(this MessageCategory category) => category switch {
|
public static string Name(this MessageCategory category) => category switch {
|
||||||
MessageCategory.Trade => "Trade ads",
|
MessageCategory.Trade => "Trade ads",
|
||||||
MessageCategory.FreeCompany => "Free Company ads",
|
MessageCategory.FreeCompany => "Free Company ads",
|
||||||
|
|
|
@ -9,6 +9,9 @@ using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
#if DEBUG
|
||||||
|
using System.Text;
|
||||||
|
#endif
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NoSoliciting.Ml;
|
using NoSoliciting.Ml;
|
||||||
|
@ -529,6 +532,22 @@ namespace NoSoliciting {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginTabItem("Party Finder##pf-report")) {
|
if (ImGui.BeginTabItem("Party Finder##pf-report")) {
|
||||||
|
#if DEBUG
|
||||||
|
if (ImGui.Button("Copy CSV")) {
|
||||||
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var message in this.Plugin.PartyFinderHistory) {
|
||||||
|
if (message.FilterReason == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
message.ToCsv(builder).Append('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.SetClipboardText(builder.ToString());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
float[] maxSizes = {0f, 0f, 0f};
|
float[] maxSizes = {0f, 0f, 0f};
|
||||||
|
|
||||||
if (ImGui.BeginChild("##pf-messages", new Vector2(-1, -1))) {
|
if (ImGui.BeginChild("##pf-messages", new Vector2(-1, -1))) {
|
||||||
|
@ -643,6 +662,13 @@ namespace NoSoliciting {
|
||||||
ImGui.SetClipboardText(message.Content.TextValue);
|
ImGui.SetClipboardText(message.Content.TextValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
ImGui.SameLine();
|
||||||
|
if (ImGui.Button("Copy CSV")) {
|
||||||
|
ImGui.SetClipboardText(message.ToCsv().ToString());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
EndPopup:
|
EndPopup:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user