Exemplo n.º 1
0
        static WallPostData GetMoreInfoFromPost(Post wall, long?userId, VkApi api)
        {
            var user = api.Users.Get(new List <long>()
            {
                (long)userId
            }, ProfileFields.Photo100);
            WallPostData data = new WallPostData()
            {
                author  = user[0].FirstName + " " + user[0].LastName,
                ava_url = user[0].Photo100.AbsoluteUri
            };

            foreach (var attach in wall.Attachments)
            {
                if (attach.Instance.ToString().IndexOf("audio") == 0)
                {
                    data.tracksCount++;
                }
                else if (attach.Instance.ToString().IndexOf("video") == 0)
                {
                    data.videoCount++;
                }
                else if (attach.Instance.ToString().IndexOf("photo") == 0)
                {
                    data.imgCount++;
                }
            }

            return(data);
        }
Exemplo n.º 2
0
        static string GetPostHtml(WallPostData data)
        {
            string html = ResFindPost.html;

            html = html.Replace("{post_url}", data.postUrl);
            html = html.Replace("{Avatar}", data.ava_url);
            html = html.Replace("{Author}", data.author);
            html = html.Replace("{DatePost}", data.date);
            html = html.Replace("{TittlePost}", data.text);
            html = html.Replace("{imgCount}", data.imgCount.ToString());
            html = html.Replace("{videoCount}", data.videoCount.ToString());
            html = html.Replace("{tracksCount}", data.tracksCount.ToString());

            return(html);
        }