From 71667c6c11bb47fb610e014b417429d6fc8ef2ed Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:44:41 +0000 Subject: [PATCH] update version number --- .../CustomBootstrapperTemplate_Blank.xml | 2 +- .../CustomBootstrapperTemplate_Simple.xml | 2 +- .../Bootstrapper/CustomDialog.Creator.cs | 24 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml index 2139b21..99efce9 100644 --- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml +++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Blank.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml index 1b3f534..7664806 100644 --- a/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml +++ b/Bloxstrap/Resources/CustomBootstrapperTemplate_Simple.xml @@ -1,4 +1,4 @@ - + diff --git a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs index 3092653..1642eb8 100644 --- a/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs +++ b/Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs @@ -5,7 +5,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper { public partial class CustomDialog { - const int Version = 0; + const int Version = 1; private class DummyFrameworkElement : FrameworkElement { } @@ -78,6 +78,25 @@ namespace Bloxstrap.UI.Elements.Bootstrapper dialog.ElementGrid.Children.Add(uiElement); } + private static void AssertThemeVersion(string? versionStr) + { + if (string.IsNullOrEmpty(versionStr)) + throw new Exception("BloxstrapCustomBootstrapper version is not set"); + + if (!uint.TryParse(versionStr, out uint version)) + throw new Exception("BloxstrapCustomBootstrapper version is not a number"); + + switch (version) + { + case Version: + break; + case 0: // Themes made between Oct 19, 2024 to Mar 11, 2025 (on the feature/custom-bootstrappers branch) + throw new Exception($"BloxstrapCustomBootstrapper version {version} is no longer supported"); + default: + throw new Exception($"BloxstrapCustomBootstrapper version {version} is not recognised"); + } + } + private void HandleXmlBase(XElement xml) { if (_initialised) @@ -86,8 +105,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper if (xml.Name != "BloxstrapCustomBootstrapper") throw new Exception("XML root is not a BloxstrapCustomBootstrapper"); - if (xml.Attribute("Version")?.Value != Version.ToString()) - throw new Exception("Unknown BloxstrapCustomBootstrapper version"); + AssertThemeVersion(xml.Attribute("Version")?.Value); if (xml.Descendants().Count() > MaxElements) throw new Exception($"Custom bootstrappers can have a maximum of {MaxElements} elements");