{
public class PostClass : ICloneable
{
- public struct StatusGeo : IEquatable<StatusGeo>
+ public readonly struct StatusGeo : IEquatable<StatusGeo>
{
public double Longitude { get; }
public double Latitude { get; }
public string ImageUrl { get; set; }
public string ScreenName { get; set; }
- public DateTime CreatedAt { get; set; }
+ public DateTimeUtc CreatedAt { get; set; }
public long StatusId { get; set; }
private bool _IsFav;
private long? _InReplyToStatusId;
public string Source { get; set; }
public Uri SourceUri { get; set; }
- public List<Tuple<long, string>> ReplyToList { get; set; }
+ public List<(long UserId, string ScreenName)> ReplyToList { get; set; }
public bool IsMe { get; set; }
public bool IsDm { get; set; }
public long UserId { get; set; }
if (deepExpand)
this.ExpandTask = this.DeepExpandAsync();
else
- this.ExpandTask = Task.FromResult(0);
+ this.ExpandTask = Task.CompletedTask;
}
protected virtual async Task DeepExpandAsync()
{
RetweetedBy = "";
Media = new List<MediaInfo>();
- ReplyToList = new List<Tuple<long, string>>();
- QuoteStatusIds = new long[0];
- ExpandedUrls = new ExpandedUrlInfo[0];
+ ReplyToList = new List<(long, string)>();
+ QuoteStatusIds = Array.Empty<long>();
+ ExpandedUrls = Array.Empty<ExpandedUrlInfo>();
}
public string TextSingleLine
- {
- get
- {
- return this.TextFromApi == null ? null : this.TextFromApi.Replace("\n", " ");
- }
- }
+ => this.TextFromApi?.Replace("\n", " ");
public bool IsFav
{
public bool IsProtect
{
- get
- {
- return _IsProtect;
- }
+ get => this._IsProtect;
set
{
if (value)
}
public bool IsMark
{
- get
- {
- return _IsMark;
- }
+ get => this._IsMark;
set
{
if (value)
}
public long? InReplyToStatusId
{
- get
- {
- return _InReplyToStatusId;
- }
+ get => this._InReplyToStatusId;
set
{
if (value != null)
public bool IsDeleted
{
- get
- {
- return _IsDeleted;
- }
+ get => this._IsDeleted;
set
{
if (value)
this.InReplyToUser = "";
this.InReplyToUserId = null;
this.IsReply = false;
- this.ReplyToList = new List<Tuple<long, string>>();
+ this.ReplyToList = new List<(long, string)>();
this._states = States.None;
}
_IsDeleted = value;
}
protected virtual PostClass RetweetSource
- {
- get
- {
- return TabInformations.GetInstance().RetweetSource(this.RetweetedId.Value);
- }
- }
+ => TabInformations.GetInstance().RetweetSource(this.RetweetedId.Value);
public StatusGeo? PostGeo
{
- get
- {
- return _postGeo;
- }
+ get => this._postGeo;
set
{
if (value != null)
}
public int StateIndex
- {
- get
- {
- return (int)_states - 1;
- }
- }
+ => (int)_states - 1;
// 互換性のために用意
public string SourceHtml
public PostClass Clone()
{
var clone = (PostClass)this.MemberwiseClone();
- clone.ReplyToList = new List<Tuple<long, string>>(this.ReplyToList);
+ clone.ReplyToList = new List<(long, string)>(this.ReplyToList);
clone.Media = new List<MediaInfo>(this.Media);
clone.QuoteStatusIds = this.QuoteStatusIds.ToArray();
clone.ExpandedUrls = this.ExpandedUrls.Select(x => x.Clone()).ToArray();
}
public override int GetHashCode()
- {
- return this.StatusId.GetHashCode();
- }
+ => this.StatusId.GetHashCode();
}
}