public static ResultForRoot FromJson(JsonValue json) { var result = new ResultForRoot( RootPosition.FromJson(json["position"]) ); foreach (Select select in SelectHelper.Values) { var selectStr = select.Stringify(); if (json.ContainsKey(selectStr)) { result.ResultsBySelect.Add(select, SelectResult.FromJson(json[selectStr])); } } if (json.ContainsKey("retractions")) { foreach (KeyValuePair <string, JsonValue> entry in json["retractions"]) { var entries = SegregatedEntries.FromJson(entry.Value); result.Retractions.Add(entry.Key, entries); } } return(result); }
public AggregatedEntry(SegregatedEntries entries, GameLevel level) : this() { foreach ((Origin origin, Entry entry) in entries) { if (origin.Level == level) { Combine(entry, origin.Result); } } }
public AggregatedEntry(SegregatedEntries entries, List <GameLevel> levels) : this() { foreach ((Origin origin, Entry entry) in entries) { if (levels.Contains(origin.Level)) { Combine(entry, origin.Result); } } }
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; }
public static SelectResult FromJson(JsonValue json) { var result = new SelectResult(); foreach (KeyValuePair <string, JsonValue> entry in json) { var entries = SegregatedEntries.FromJson(entry.Value); if (entry.Key == "--") { result.Root = entries; } else { result.Children.Add(entry.Key, entries); } } return(result); }