Skip to content

Commit

Permalink
Fix Events not parsing correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpup committed Jan 15, 2024
1 parent 695ef01 commit 3e99adc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dota2GSI/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public Events Events
{
if (events == null)
{
events = new Events(GetJObject("events"));
events = new Events(GetJArray("events"));
}

return events;
Expand Down
2 changes: 1 addition & 1 deletion Dota2GSI/Nodes/Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Events : IEnumerable<Event>
/// </summary>
public int Count { get { return _events.Count; } }

internal Events(JObject parsed_data = null) : base()
internal Events(JArray parsed_data = null) : base()
{
if (parsed_data != null)
{
Expand Down
12 changes: 12 additions & 0 deletions Dota2GSI/Nodes/Node.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ internal JObject GetJObject(string property_name)
return null;
}

internal JArray GetJArray(string property_name)
{
var jtoken = GetJToken(property_name);

if (jtoken != null)
{
return jtoken as JArray;
}

return null;
}


internal string GetString(string property_name)
{
Expand Down

0 comments on commit 3e99adc

Please sign in to comment.