forked from aly/qstbak
muffin v7.5.0
This commit is contained in:
parent
afafd5e377
commit
a6481e7b9a
67 changed files with 4281 additions and 2372 deletions
|
|
@ -111,17 +111,23 @@ internal sealed class ValidationDetailsRenderer
|
|||
|
||||
private void DrawIssueDetails(ValidationIssue issue)
|
||||
{
|
||||
Vector4 color = ((issue.Severity == EIssueSeverity.Error) ? ImGuiColors.DalamudRed : ImGuiColors.DalamudOrange);
|
||||
Vector4 vector = ((issue.Severity == EIssueSeverity.Error) ? ImGuiColors.DalamudRed : ImGuiColors.DalamudOrange);
|
||||
FontAwesomeIcon icon = ((issue.Severity == EIssueSeverity.Error) ? FontAwesomeIcon.ExclamationTriangle : FontAwesomeIcon.InfoCircle);
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, vector, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextUnformatted(icon.ToIconString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
||||
ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.Text, vector, true);
|
||||
try
|
||||
{
|
||||
ImU8String text = new ImU8String(2, 2);
|
||||
text.AppendFormatted(issue.Severity);
|
||||
|
|
@ -129,6 +135,10 @@ internal sealed class ValidationDetailsRenderer
|
|||
text.AppendFormatted(issue.Type);
|
||||
ImGui.Text(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
ImGui.Separator();
|
||||
if (issue.ElementId != null)
|
||||
{
|
||||
|
|
@ -194,24 +204,39 @@ internal sealed class ValidationDetailsRenderer
|
|||
}
|
||||
else if (text.StartsWith("JSON parsing error", StringComparison.Ordinal))
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
else if (text.StartsWith("This usually indicates", StringComparison.Ordinal) || text.StartsWith("Please check", StringComparison.Ordinal))
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||
ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
}
|
||||
else if (text.StartsWith("\ufffd ", StringComparison.Ordinal))
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow))
|
||||
ColorDisposable val3 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -253,8 +278,9 @@ internal sealed class ValidationDetailsRenderer
|
|||
for (int num = 0; num < list.Count; num++)
|
||||
{
|
||||
string value = list[num];
|
||||
Vector4 color = array2[num % array2.Length];
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, color))
|
||||
Vector4 vector = array2[num % array2.Length];
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, vector, true);
|
||||
try
|
||||
{
|
||||
if (ElementId.TryFromString(value, out ElementId elementId) && elementId != null)
|
||||
{
|
||||
|
|
@ -285,6 +311,10 @@ internal sealed class ValidationDetailsRenderer
|
|||
ImGui.TextWrapped(text3);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
ImGui.Unindent();
|
||||
}
|
||||
|
|
@ -318,7 +348,8 @@ internal sealed class ValidationDetailsRenderer
|
|||
|
||||
private void DrawJsonValidationError(JsonValidationError error, int index)
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow))
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow, true);
|
||||
try
|
||||
{
|
||||
ImU8String text = new ImU8String(8, 1);
|
||||
text.AppendLiteral("Error #");
|
||||
|
|
@ -326,16 +357,25 @@ internal sealed class ValidationDetailsRenderer
|
|||
text.AppendLiteral(":");
|
||||
ImGui.Text(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
ImGui.Indent(12f);
|
||||
if (!string.IsNullOrEmpty(error.Path))
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text("Location:");
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue))
|
||||
ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(FormatJsonPath(error.Path));
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
}
|
||||
if (error.Messages.Count > 0)
|
||||
{
|
||||
|
|
@ -344,7 +384,8 @@ internal sealed class ValidationDetailsRenderer
|
|||
foreach (string message in error.Messages)
|
||||
{
|
||||
ImGui.Indent(12f);
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val3 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
string text2 = CleanJsonText(message);
|
||||
if (string.Equals(text2, "validation failed", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
@ -357,13 +398,18 @@ internal sealed class ValidationDetailsRenderer
|
|||
ImGui.TextWrapped(text3);
|
||||
ImGui.Unindent(12f);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
List<string> validationSuggestions = GetValidationSuggestions(error);
|
||||
if (validationSuggestions.Count > 0)
|
||||
{
|
||||
ImGui.Spacing();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||
ColorDisposable val4 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, true);
|
||||
try
|
||||
{
|
||||
ImGui.Text("Suggestions:");
|
||||
foreach (string item in validationSuggestions)
|
||||
|
|
@ -371,19 +417,33 @@ internal sealed class ValidationDetailsRenderer
|
|||
ImGui.Indent(12f);
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow))
|
||||
ColorDisposable val5 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudYellow, true);
|
||||
try
|
||||
{
|
||||
ImGui.Text(FontAwesomeIcon.Lightbulb.ToIconString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val5)?.Dispose();
|
||||
}
|
||||
}
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||
ColorDisposable val6 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(item);
|
||||
ImGui.Unindent(12f);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val6)?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val4)?.Dispose();
|
||||
}
|
||||
}
|
||||
ImGui.Unindent(12f);
|
||||
}
|
||||
|
|
@ -395,10 +455,15 @@ internal sealed class ValidationDetailsRenderer
|
|||
{
|
||||
if (text.StartsWith("JSON Validation failed:", StringComparison.Ordinal))
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
else if (text.StartsWith(" - ", StringComparison.Ordinal))
|
||||
{
|
||||
|
|
@ -413,24 +478,39 @@ internal sealed class ValidationDetailsRenderer
|
|||
}
|
||||
ImGui.Text("\ufffd");
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue))
|
||||
ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue, true);
|
||||
try
|
||||
{
|
||||
ImGui.Text(FormatJsonPath(path));
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(":");
|
||||
ImGui.SameLine();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val3 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val3)?.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val4 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(CleanJsonText(text));
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val4)?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -541,20 +621,30 @@ internal sealed class ValidationDetailsRenderer
|
|||
}
|
||||
else if (text.StartsWith("Error:", StringComparison.Ordinal) || text.StartsWith("Invalid", StringComparison.Ordinal) || text.StartsWith("Missing", StringComparison.Ordinal))
|
||||
{
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed))
|
||||
ColorDisposable val = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, true);
|
||||
try
|
||||
{
|
||||
ImGui.TextWrapped(text);
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
else if (text.Contains(':', StringComparison.Ordinal))
|
||||
{
|
||||
int num = text.IndexOf(':', StringComparison.Ordinal);
|
||||
string text2 = text.Substring(0, num);
|
||||
string text3 = text.Substring(num + 1).TrimStart();
|
||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue))
|
||||
ColorDisposable val2 = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.ParsedBlue, true);
|
||||
try
|
||||
{
|
||||
ImGui.Text(text2 + ":");
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val2)?.Dispose();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.TextWrapped(text3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue