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 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);
        }