Skip to content

Commit

Permalink
Fix config serialization again...
Browse files Browse the repository at this point in the history
  • Loading branch information
awgil committed May 6, 2024
1 parent 6e4ae6b commit 3a104df
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions BossMod/Config/ConfigRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Type, ConfigNode> _nodes = [];
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion BossMod/Config/CooldownPlanningConfigNode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ImGuiNET;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection;

namespace BossMod;

Expand Down Expand Up @@ -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<JsonIgnoreAttribute>() == null))
{
var v = f.GetValue(this);
if (v != null)
Expand Down

0 comments on commit 3a104df

Please sign in to comment.