From 3a104df46780345ccb119aabccfc48abbc24889e Mon Sep 17 00:00:00 2001 From: Andrew Gilewsky Date: Mon, 6 May 2024 18:42:23 +0100 Subject: [PATCH] Fix config serialization again... --- BossMod/Config/ConfigRoot.cs | 5 +++-- BossMod/Config/CooldownPlanningConfigNode.cs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/BossMod/Config/ConfigRoot.cs b/BossMod/Config/ConfigRoot.cs index 77d525e19..ee472f6f2 100644 --- a/BossMod/Config/ConfigRoot.cs +++ b/BossMod/Config/ConfigRoot.cs @@ -6,7 +6,7 @@ namespace BossMod; public class ConfigRoot { - private const int _version = 8; + private const int _version = 9; public Event Modified = new(); private readonly Dictionary _nodes = []; @@ -298,7 +298,8 @@ private static JObject ConvertConfig(JObject payload, int version) amConfig["GTMode"] = autorotConfig?["GTMode"] ?? "Manual"; } // v8: remove accidentally serializable Modified field - if (version < 8) + // v9: and again the same thing... + if (version < 9) { foreach (var (_, config) in payload) { diff --git a/BossMod/Config/CooldownPlanningConfigNode.cs b/BossMod/Config/CooldownPlanningConfigNode.cs index 369a5179a..7d5231633 100644 --- a/BossMod/Config/CooldownPlanningConfigNode.cs +++ b/BossMod/Config/CooldownPlanningConfigNode.cs @@ -1,6 +1,7 @@ using ImGuiNET; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using System.Reflection; namespace BossMod; @@ -153,7 +154,7 @@ public override JObject Serialize(JsonSerializer ser) { var baseType = typeof(CooldownPlanningConfigNode); JObject res = []; - foreach (var f in GetType().GetFields().Where(f => f.DeclaringType != baseType)) + foreach (var f in GetType().GetFields().Where(f => f.DeclaringType != baseType && f.GetCustomAttribute() == null)) { var v = f.GetValue(this); if (v != null)