Skip to content

Commit

Permalink
Adjust JSON formatting for None macro type
Browse files Browse the repository at this point in the history
  • Loading branch information
colinator27 committed Jul 20, 2024
1 parent 13b1fee commit 3eb5d6a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Underanalyzer/Decompiler/GameSpecific/Json/IMacroTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ internal class IMacroTypeConverter(GameSpecificRegistry registry) : JsonConverte

if (reader.TokenType == JsonTokenType.String)
{
// Read type name - access registry
return Registry.FindType(reader.GetString() ?? throw new JsonException());
// Read type name - access registry (or None to use none)
string typeName = reader.GetString() ?? throw new JsonException();
if (typeName == "None")
{
return NoneMacroType.ReusableInstance;
}
return Registry.FindType(typeName);
}

if (reader.TokenType == JsonTokenType.StartArray)
Expand Down Expand Up @@ -79,6 +84,11 @@ internal class IMacroTypeConverter(GameSpecificRegistry registry) : JsonConverte
case "MatchNot":
return MatchNotMacroTypeConverter.ReadContents(ref reader, this, options);
case "None":
reader.Read();
if (reader.TokenType != JsonTokenType.EndObject)
{
throw new JsonException();
}
return NoneMacroType.ReusableInstance;
}
}
Expand Down

0 comments on commit 3eb5d6a

Please sign in to comment.