Пример #1
0
        public void Mapper(ref ListingWrapper listingWrapper)
        {
            foreach (var thingWrapper in listingWrapper.Data.Children)
            {
                if (!(thingWrapper.Data is JObject jObject))
                {
                    continue;
                }

                switch (thingWrapper.Kind)
                {
                case ThingTypes.Message:
                    break;

                case ThingTypes.Comment:
                    thingWrapper.Data = jObject.ToObject <Comment>();
                    if (thingWrapper.Data is IComment comment && comment.Replies is JObject repliesAsJObject &&
                        repliesAsJObject.ContainsKey("kind"))
                    {
                        comment.Replies = repliesAsJObject.ToObject <ListingWrapper>();
                    }
                    break;

                case ThingTypes.Link:
                    thingWrapper.Data = jObject.ToObject <Link>();
                    break;

                case ThingTypes.Account:
                    break;

                case ThingTypes.More:
                    break;
                }
            }
        }
Пример #2
0
 private void ReplyMapper(ListingWrapper replies)
 {
 }