public static GameHeader FromJson(JsonValue json) { return(new GameHeader( json["game_id"], GameResultHelper.FromStringPgnFormat(json["result"]).First(), Date.FromJson(json["date"]), Eco.FromJson(json["eco"]), json.ContainsKey("ply_count") ? Optional <ushort> .Create(json["ply_count"]) : Optional <ushort> .CreateEmpty(), json["event"], json["white"], json["black"] )); }
public static SegregatedEntries FromJson(JsonValue json) { var e = new SegregatedEntries(); foreach (KeyValuePair<string, JsonValue> byLevel in json) { GameLevel level = GameLevelHelper.FromString(byLevel.Key).First(); foreach (KeyValuePair<string, JsonValue> byResult in byLevel.Value) { GameResult result = GameResultHelper.FromStringWordFormat(byResult.Key).First(); e.Add(level, result, Entry.FromJson(byResult.Value)); } } return e; }