private bool IsPostRestricted(Status status) { var currentPost = new PostInfo(status.CreatedAt, status.IdStr, status.Text ?? string.Empty, status.User.IdStr); if (currentPost.Equals(_prevPostInfo)) { return true; } _prevPostInfo.CreatedAt = currentPost.CreatedAt; _prevPostInfo.Id = currentPost.Id; _prevPostInfo.Text = currentPost.Text; _prevPostInfo.UserId = currentPost.UserId; return false; }
private PostClass CreatePostsFromStatusData(Status status) { Entities entities; var post = new PostClass { StatusId = status.Id }; if (status.RetweetedStatus != null) { var retweeted = status.RetweetedStatus; post.CreatedAt = MyCommon.DateTimeParse(retweeted.CreatedAt); // Id post.RetweetedId = retweeted.Id; // 本文 post.TextFromApi = retweeted.Text; entities = retweeted.Entities; // Source取得(htmlの場合は、中身を取り出し) post.Source = retweeted.Source; // Reply先 { long t; long.TryParse(retweeted.InReplyToStatusId, out t); post.InReplyToStatusId = t; } post.InReplyToUser = retweeted.InReplyToScreenName; { long t; long.TryParse(status.InReplyToUserId, out t); post.InReplyToUserId = t; } // 幻覚fav対策 var tc = TabInformations.Instance.GetTabByType(TabUsageType.Favorites); post.IsFav = tc.Contains(post.RetweetedId); if (retweeted.Geo != null) { post.PostGeo = new PostClass.StatusGeo { Lat = retweeted.Geo.Coordinates[0], Lng = retweeted.Geo.Coordinates[1] }; } // 以下、ユーザー情報 var user = retweeted.User; if (user.ScreenName == null || status.User.ScreenName == null) { return null; } post.UserId = user.Id; post.ScreenName = user.ScreenName; post.Nickname = user.Name.Trim(); post.ImageUrl = user.ProfileImageUrl; post.IsProtect = user.Protected; // Retweetした人 post.RetweetedBy = status.User.ScreenName; post.RetweetedByUserId = status.User.Id; post.IsMe = post.RetweetedBy.ToLower().Equals(_uname); } else { post.CreatedAt = MyCommon.DateTimeParse(status.CreatedAt); // 本文 post.TextFromApi = status.Text; entities = status.Entities; // Source取得(htmlの場合は、中身を取り出し) post.Source = status.Source; { long t; long.TryParse(status.InReplyToStatusId, out t); post.InReplyToStatusId = t; } post.InReplyToUser = status.InReplyToScreenName; { long t; long.TryParse(status.InReplyToUserId, out t); post.InReplyToUserId = t; } if (status.Geo != null) { post.PostGeo = new PostClass.StatusGeo { Lat = status.Geo.Coordinates[0], Lng = status.Geo.Coordinates[1] }; } // 以下、ユーザー情報 var user = status.User; if (user == null || user.ScreenName == null) { return null; } post.UserId = user.Id; post.ScreenName = user.ScreenName; post.Nickname = user.Name.Trim(); post.ImageUrl = user.ProfileImageUrl; post.IsProtect = user.Protected; post.IsMe = post.ScreenName.ToLower().Equals(_uname); // 幻覚fav対策 var tc = TabInformations.Instance.GetTabByType(TabUsageType.Favorites); post.IsFav = tc.Contains(post.StatusId) && TabInformations.Instance.Item(post.StatusId).IsFav; } // HTMLに整形 { var t = post.TextFromApi; post.Text = CreateHtmlAnchor(ref t, post.ReplyToList, entities, post.Media); post.TextFromApi = t; } post.TextFromApi = ReplaceTextFromApi(post.TextFromApi, entities); post.TextFromApi = HttpUtility.HtmlDecode(post.TextFromApi); post.TextFromApi = post.TextFromApi.Replace("<3", "♡"); CreateSource(ref post); // Source整形 post.IsReply = post.ReplyToList.Contains(_uname); post.IsExcludeReply = false; if (post.IsMe) { post.IsOwl = false; } else { if (_followerIds.Count > 0) { post.IsOwl = !_followerIds.Contains(post.UserId); } } post.IsDm = false; return post; }