Example #1
0
        async Task <RootObjectComment> FirstRequest()
        {
            var responce = await requester.Request(requsetBuilder.GetCommentsFromPost(idUser, post_id, token));

            return(serialyzer.Serialyz(responce));
        }
Example #2
0
        async Task <RootObject> FirstRequest()
        {
            var responce = await requester.Request(requsetBuilder.GetPostOnWall(idUser, token));

            return(serialyzer.Serialyz(responce));
        }
Example #3
0
        async Task GetCommentsR(ItemComment item)
        {
            var countComments = item?.thread?.count;

            if (countComments > 0)
            {
                var inc = 0;
                do
                {
                    Comment_.CommentToComment.RootObject serResponce = null;

                    var responce = "";

                    try
                    {
                        responce = await requester
                                   .Request(requsetBuilder.GetCommentsToCommentOffset(idUser, post_id, item.id, token, inc));

                        serResponce = serialyzerToComment.Serialyz(responce);
                    }
                    catch (Exception)
                    {
                        serResponce = null;
                    }

                    if (serResponce != null)
                    {
                        foreach (var i in serResponce?.response?.items)
                        {
                            if (i != null)
                            {
                                var o = new ItemComment
                                {
                                    date          = i.date,
                                    from_id       = i.from_id,
                                    id            = i.id,
                                    owner_id      = i.owner_id,
                                    parents_stack = new List <ItemComment>(),
                                    post_id       = i.post_id,
                                    text          = i.text,
                                    thread        = new Thread(),
                                };
                                await GetCommentsR(o);
                            }
                        }

                        var oo = serResponce?.response?.items?
                                 .Where(i => i != null)
                                 .Select(i =>
                                         new ItemComment
                        {
                            date          = i.date,
                            from_id       = i.from_id,
                            id            = i.id,
                            owner_id      = i.owner_id,
                            parents_stack = new List <ItemComment>(),
                            post_id       = i.post_id,
                            text          = i.text,
                            thread        = new Thread(),
                        })
                                 .ToList();
                        if (oo != null)
                        {
                            item.thread.items.AddRange(oo);
                        }
                    }

                    inc += 100;
                } while (countComments >= inc);
            }
        }