public static void LikeComment(TraktComment comment) { var likeThread = new Thread((obj) => { // add like to cache TraktCache.AddCommentToLikes((TraktComment)comment); TraktAPI.TraktAPI.LikeComment(((TraktComment)comment).Id); }) { Name = "LikeComment", IsBackground = true }; likeThread.Start(comment); }
internal static void SetCommentProperties(TraktComment comment, bool isWatched = false) { SetProperty("#Trakt.Shout.Id", comment.Id); SetProperty("#Trakt.Shout.Inserted", comment.CreatedAt.FromISO8601().ToLongDateString()); SetProperty("#Trakt.Shout.Date", comment.CreatedAt.FromISO8601().ToShortDateString()); SetProperty("#Trakt.Shout.Spoiler", comment.IsSpoiler); SetProperty("#Trakt.Shout.Review", comment.IsReview); SetProperty("#Trakt.Shout.Type", comment.IsReview ? "review" : "shout"); SetProperty("#Trakt.Shout.Likes", comment.Likes); SetProperty("#Trakt.Shout.Replies", comment.Replies); SetProperty("#Trakt.Shout.UserRating", comment.UserRating); // don't hide spoilers if watched if (TraktSettings.HideSpoilersOnShouts && comment.IsSpoiler && !isWatched) SetProperty("#Trakt.Shout.Text", Translation.HiddenToPreventSpoilers); else SetProperty("#Trakt.Shout.Text", System.Web.HttpUtility.HtmlDecode(comment.Text.RemapHighOrderChars()).StripHTML()); }
internal static void RemoveCommentFromLikes(TraktComment comment) { if (_LikedComments == null) return; var likedComments = _LikedComments.ToList(); likedComments.RemoveAll(l => l.Comment.Id == comment.Id); _LikedComments = likedComments; }
public static void UnLikeComment(TraktComment comment) { var unlikeThread = new Thread((obj) => { // remove like from cache TraktCache.RemoveCommentFromLikes((TraktComment)comment); TraktAPI.TraktAPI.UnLikeComment(((TraktComment)comment).Id); }) { Name = "LikeComment", IsBackground = true }; unlikeThread.Start(comment); }
internal static void AddCommentToLikes(TraktComment comment) { var likedComments = (_LikedComments ?? new List<TraktLike>()).ToList(); likedComments.Add(new TraktLike { LikedAt = DateTime.UtcNow.ToISO8601(), Comment = comment, Type = "comment" }); _LikedComments = likedComments; }