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