コード例 #1
0
        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);
        }
コード例 #2
0
 public AggregatedEntry(SegregatedEntries entries, GameLevel level)
     : this()
 {
     foreach ((Origin origin, Entry entry) in entries)
     {
         if (origin.Level == level)
         {
             this.Combine(entry, origin.Result);
         }
     }
 }
コード例 #3
0
 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);
        }