From 7759ab1212e0da2c20beeebaa776c2b742294de7 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Wed, 25 Oct 2023 14:26:23 +0100 Subject: [PATCH] Autocorrect invalid JSON for flag importing --- .../UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs index 0fad586..cd9ac29 100644 --- a/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Menu/Pages/FastFlagEditorPage.xaml.cs @@ -245,7 +245,14 @@ namespace Bloxstrap.UI.Elements.Menu.Pages if (dialog.Result != MessageBoxResult.OK) return; - json = dialog.JsonTextBox.Text; + json = dialog.JsonTextBox.Text.Trim(); + + // autocorrect where possible + if (!json.StartsWith('{')) + json = '{' + json; + + if (!json.EndsWith('}')) + json += '}'; try {