コード例 #1
0
        public CommentDataType CommentToDataType(CommentThread commentData)
        {
            var comment = new CommentDataType();

            comment.Author          = commentData.Snippet.TopLevelComment.Snippet.AuthorDisplayName;
            comment.AuthorThumbnail = commentData.Snippet.TopLevelComment.Snippet.AuthorProfileImageUrl;
            comment.Content         = commentData.Snippet.TopLevelComment.Snippet.TextDisplay;
            comment.DatePosted      = TimeSinceDate(commentData.Snippet.TopLevelComment.Snippet.PublishedAt);
            comment.Id        = commentData.Snippet.TopLevelComment.Id;
            comment.IsReplies = commentData.Replies != null;
            comment.LikeCount = commentData.Snippet.TopLevelComment.Snippet.LikeCount;

            if (commentData.Replies != null)
            {
                comment.ReplyCount = commentData.Replies.Comments.Count;
            }
            else
            {
                comment.ReplyCount = 0;
            }

            if (commentData.Replies != null)
            {
                foreach (var item in commentData.Replies.Comments)
                {
                    comment.Replies.Add(CommentToDataType(item));
                }
            }

            return(comment);
        }
コード例 #2
0
        public CommentDataType CommentToDataType(Comment commentData)
        {
            var comment = new CommentDataType();

            comment.Author          = commentData.Snippet.AuthorDisplayName;
            comment.AuthorThumbnail = commentData.Snippet.AuthorProfileImageUrl;
            comment.Content         = commentData.Snippet.TextDisplay;
            comment.DatePosted      = TimeSinceDate(commentData.Snippet.PublishedAt);
            comment.Id        = commentData.Id;
            comment.IsReplies = false;
            comment.LikeCount = commentData.Snippet.LikeCount;

            return(comment);
        }
コード例 #3
0
 public CommentContainerDataType(CommentDataType data)
 {
     commentData = data;
 }