public static ResultForRoot FromJson(JObject json)
        {
            var result = new ResultForRoot(
                RootPosition.FromJson(json["position"].Value <JObject>()));

            foreach (Select select in SelectHelper.Values)
            {
                var selectStr = select.Stringify();
                if (json.ContainsKey(selectStr))
                {
                    result.ResultsBySelect.Add(select, SelectResult.FromJson(json[selectStr].Value <JObject>()));
                }
            }

            if (json.ContainsKey("retractions"))
            {
                foreach ((string key, var value) in json["retractions"].Value <JObject>())
                {
                    var entries = SegregatedEntries.FromJson(value.Value <JObject>());
                    result.Retractions.Add(key, entries);
                }
            }

            return(result);
        }
 public AggregatedEntry(SegregatedEntries entries, GameLevel level)
     : this()
 {
     foreach ((Origin origin, Entry entry) in entries)
     {
         if (origin.Level == level)
         {
             this.Combine(entry, origin.Result);
         }
     }
 }
 public AggregatedEntry(SegregatedEntries entries, List <GameLevel> levels)
     : this()
 {
     foreach ((Origin origin, Entry entry) in entries)
     {
         if (levels.Contains(origin.Level))
         {
             this.Combine(entry, origin.Result);
         }
     }
 }
示例#4
0
        public static SegregatedEntries FromJson(JObject json)
        {
            var e = new SegregatedEntries();

            foreach (KeyValuePair <string, JToken> byLevel in json)
            {
                GameLevel level = GameLevelHelper.FromString(byLevel.Key).First();
                foreach (KeyValuePair <string, JToken> byResult in byLevel.Value.Value <JObject>())
                {
                    GameResult result = GameResultHelper.FromStringWordFormat(byResult.Key).First();

                    e.Add(level, result, Entry.FromJson(byResult.Value.Value <JObject>()));
                }
            }

            return(e);
        }
示例#5
0
        public static SelectResult FromJson(JObject json)
        {
            var result = new SelectResult();

            foreach ((string key, var value) in json)
            {
                var entries = SegregatedEntries.FromJson(value.Value <JObject>());
                if (key == "--")
                {
                    result.Root = entries;
                }
                else
                {
                    result.Children.Add(key, entries);
                }
            }

            return(result);
        }