Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jzebedee committed Oct 5, 2019
1 parent 2c59661 commit 1c90beb
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Chronicler/ChronicleCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public override Chronicle Read(ref Utf8JsonReader reader, Type typeToConvert, Js
chapters.Add(chapter);
break;
case JsonTokenType.PropertyName when reader.ValueTextEquals("character"):
reader.Read();
character = reader.GetInt32();
break;
}
Expand Down Expand Up @@ -92,6 +93,7 @@ public override ChronicleChapter Read(ref Utf8JsonReader reader, Type typeToConv
entries.Add(entry);
break;
case JsonTokenType.PropertyName when reader.ValueTextEquals("year"):
reader.Read();
year = reader.GetInt32();
break;
}
Expand All @@ -115,7 +117,23 @@ public override void Write(Utf8JsonWriter writer, ChronicleChapter value, JsonSe

public class ChronicleEntry
{
[JsonPropertyName("text")]
public string Text { get; set; }

[JsonPropertyName("picture")]
public string Picture { get; set; }

[JsonPropertyName("portrait")]
public int Portrait { get; set; }

[JsonPropertyName("portrait_culture")]
public string PortraitCulture { get; set; }

[JsonPropertyName("portrait_title_tier")]
public int PortraitTitleTier { get; set; }

[JsonPropertyName("portrait_government")]
public string PortraitGovernment { get; set; }
}

[JsonConverter(typeof(ChronicleChapterConverter))]
Expand Down Expand Up @@ -183,9 +201,7 @@ public static ChronicleCollection ParseJson(JsonDocument ck2json)
})
});

var auto = JsonSerializer.Deserialize<ChronicleCollection>(chronicleCollection.ToString());

return new ChronicleCollection();
return JsonSerializer.Deserialize<ChronicleCollection>(chronicleCollection.ToString());
}
}
}

0 comments on commit 1c90beb

Please sign in to comment.