public static GameHeader FromJson(JObject json) { var plyCount = json.ContainsKey("ply_count") ? Optional <ushort> .Create(json["ply_count"].Value <ushort>()) : Optional <ushort> .CreateEmpty(); return(new GameHeader( json["game_id"].Value <uint>(), GameResultHelper.FromStringPgnFormat(json["result"].Value <string>()).First(), Date.FromJson(json["date"]), Eco.FromJson(json["eco"]), plyCount, json["event"].Value <string>(), json["white"].Value <string>(), json["black"].Value <string>())); }
public GameHeader( uint gameId, GameResult result, Date date, Eco eco, Optional <ushort> plyCount, string @event, string white, string black) { this.GameId = gameId; this.Result = result; this.Date = date; this.Eco = eco; this.PlyCount = plyCount; this.Event = @event; this.White = white; this.Black = black; }
public static Eco FromJson(JToken json) { return(Eco.FromString(json.Value <string>())); }