private async Task SetRecentStatusAsync(TwitterStatus status, CancellationToken cancellationToken) { if (status != null) { var entities = status.MergedEntities; foreach (var entity in entities.Urls) entity.ExpandedUrl = await ShortUrl.Instance.ExpandUrlAsync(entity.ExpandedUrl); var html = TweetFormatter.AutoLinkHtml(status.Text, entities); html = this.mainForm.createDetailHtml(html + " Posted at " + MyCommon.DateTimeParse(status.CreatedAt) + " via " + status.Source); if (cancellationToken.IsCancellationRequested) return; this.RecentPostBrowser.DocumentText = html; } else { this.RecentPostBrowser.DocumentText = Properties.Resources.ShowUserInfo2; } }
/// <summary>Compatibility Modeのツイートを<see cref="TwitterStatus"/>に変換します</summary> public TwitterStatus Normalize() { var normalized = new TwitterStatus { Contributors = this.Contributors, Coordinates = this.Coordinates, CreatedAt = this.CreatedAt, FavoriteCount = this.FavoriteCount, Favorited = this.Favorited, FilterLevel = this.FilterLevel, Id = this.Id, IdStr = this.IdStr, InReplyToScreenName = this.InReplyToScreenName, InReplyToStatusId = this.InReplyToStatusId, InReplyToStatusIdStr = this.InReplyToStatusIdStr, InReplyToUserId = this.InReplyToUserId, InReplyToUserIdStr = this.InReplyToUserIdStr, Lang = this.Lang, Place = this.Place, PossiblySensitive = this.PossiblySensitive, QuotedStatusId = this.QuotedStatusId, QuotedStatusIdStr = this.QuotedStatusIdStr, QuotedStatus = this.QuotedStatus?.Normalize(), RetweetCount = this.RetweetCount, Retweeted = this.Retweeted, RetweetedStatus = this.RetweetedStatus?.Normalize(), Source = this.Source, User = this.User, WithheldCopyright = this.WithheldCopyright, WithheldInCountries = this.WithheldInCountries, WithheldScope = this.WithheldScope, }; if (this.ExtendedTweet != null) { // Extended Tweet normalized.DisplayTextRange = this.ExtendedTweet.DisplayTextRange; normalized.Entities = this.ExtendedTweet.Entities; normalized.ExtendedEntities = this.ExtendedTweet.ExtendedEntities; normalized.FullText = this.ExtendedTweet.FullText; normalized.Truncated = false; } else { // Classic Tweet normalized.DisplayTextRange = new[] { 0, this.GetCodePointCount(this.Text) }; normalized.Entities = this.Entities; normalized.ExtendedEntities = this.ExtendedEntities; normalized.FullText = this.Text; normalized.Truncated = this.Truncated; } return normalized; }