Пример #1
0
        private static void AddPostsToGroup(JsonArray array, String id)
        {
            foreach (var item in array)
            {
                JsonObject       obj  = item.GetObject();
                TumblrDataCommon post = null;
                string           type = obj.GetNamedString(TumblrDataCommon.STR_TYPE);

                switch (type)
                {
                // text, quote, link, answer, video, audio, photo, chat
                case "text":
                    post = new TumblrTextDataItem(item.Stringify());
                    break;

                case "quote":
                    post = new TumblrQuoteDataItem(item.Stringify());
                    break;

                case "link":
                    post = new TumblrLinkDataItem(item.Stringify());
                    break;

                case "answer":
                    post = new TumblrAnswerDataItem(item.Stringify());
                    break;

                case "video":
                    post = new TumblrVideoDataItem(item.Stringify());
                    break;

                case "audio":
                    post = new TumblrAudioDataItem(item.Stringify());
                    break;

                case "photo":
                    post = new TumblrPhotoDataItem(item.Stringify());
                    break;

                case "chat":
                    post = new TumblrChatDataItem(item.Stringify());
                    break;
                }

                if (post != null)
                {
                    GetGroup(id).Items.Add(post);
                }
            }
        }
Пример #2
0
        private static void AddPostsToGroup(JsonArray array, String id)
        {
            foreach (var item in array)
            {
                JsonObject obj = item.GetObject();
                TumblrDataCommon post = null;
                string type = obj.GetNamedString(TumblrDataCommon.STR_TYPE);

                switch (type)
                {
                    // text, quote, link, answer, video, audio, photo, chat
                    case "text":
                        post = new TumblrTextDataItem(item.Stringify());
                        break;
                    case "quote":
                        post = new TumblrQuoteDataItem(item.Stringify());
                        break;
                    case "link":
                        post = new TumblrLinkDataItem(item.Stringify());
                        break;
                    case "answer":
                        post = new TumblrAnswerDataItem(item.Stringify());
                        break;
                    case "video":
                        post = new TumblrVideoDataItem(item.Stringify());
                        break;
                    case "audio":
                        post = new TumblrAudioDataItem(item.Stringify());
                        break;
                    case "photo":
                        post = new TumblrPhotoDataItem(item.Stringify());
                        break;
                    case "chat":
                        post = new TumblrChatDataItem(item.Stringify());
                        break;
                }

                if (post != null)
                    GetGroup(id).Items.Add(post);
            }
        }