• R/O
  • HTTP
  • SSH
  • HTTPS

open-tween: 提交

開発に使用するリポジトリ


Commit MetaInfo

修订版4add08983956781990d58da360b150197990e5ef (tree)
时间2018-10-14 16:13:20
作者upsilon <kim.upsilon@bucy...>
CommiterGitHub

Log Message

Merge pull request #56 from upsilon/dotnet472

.NET Framework 4.7.2 で追加されたメソッド等を使用

更改概述

差异

--- a/OpenTween.Tests/Api/TwitterApiTest.cs
+++ b/OpenTween.Tests/Api/TwitterApiTest.cs
@@ -104,7 +104,7 @@ namespace OpenTween.Api
104104 },
105105 "/statuses/home_timeline")
106106 )
107- .ReturnsAsync(new TwitterStatus[0]);
107+ .ReturnsAsync(Array.Empty<TwitterStatus>());
108108
109109 twitterApi.apiConnection = mock.Object;
110110
@@ -134,7 +134,7 @@ namespace OpenTween.Api
134134 },
135135 "/statuses/mentions_timeline")
136136 )
137- .ReturnsAsync(new TwitterStatus[0]);
137+ .ReturnsAsync(Array.Empty<TwitterStatus>());
138138
139139 twitterApi.apiConnection = mock.Object;
140140
@@ -166,7 +166,7 @@ namespace OpenTween.Api
166166 },
167167 "/statuses/user_timeline")
168168 )
169- .ReturnsAsync(new TwitterStatus[0]);
169+ .ReturnsAsync(Array.Empty<TwitterStatus>());
170170
171171 twitterApi.apiConnection = mock.Object;
172172
@@ -261,7 +261,7 @@ namespace OpenTween.Api
261261
262262 twitterApi.apiConnection = mock.Object;
263263
264- await twitterApi.StatusesUpdate("hogehoge", replyToId: null, mediaIds: null, excludeReplyUserIds: new long[0])
264+ await twitterApi.StatusesUpdate("hogehoge", replyToId: null, mediaIds: null, excludeReplyUserIds: Array.Empty<long>())
265265 .IgnoreResponse()
266266 .ConfigureAwait(false);
267267
@@ -536,7 +536,7 @@ namespace OpenTween.Api
536536 },
537537 "/lists/statuses")
538538 )
539- .ReturnsAsync(new TwitterStatus[0]);
539+ .ReturnsAsync(Array.Empty<TwitterStatus>());
540540
541541 twitterApi.apiConnection = mock.Object;
542542
@@ -718,7 +718,7 @@ namespace OpenTween.Api
718718 }
719719 }")
720720 )
721- .Returns(Task.FromResult(0));
721+ .Returns(Task.CompletedTask);
722722
723723 twitterApi.apiConnection = mock.Object;
724724
@@ -795,7 +795,7 @@ namespace OpenTween.Api
795795 },
796796 "/users/lookup")
797797 )
798- .ReturnsAsync(new TwitterUser[0]);
798+ .ReturnsAsync(Array.Empty<TwitterUser>());
799799
800800 twitterApi.apiConnection = mock.Object;
801801
@@ -851,7 +851,7 @@ namespace OpenTween.Api
851851 },
852852 "/favorites/list")
853853 )
854- .ReturnsAsync(new TwitterStatus[0]);
854+ .ReturnsAsync(Array.Empty<TwitterStatus>());
855855
856856 twitterApi.apiConnection = mock.Object;
857857
@@ -995,7 +995,7 @@ namespace OpenTween.Api
995995 null,
996996 "/friendships/no_retweets/ids")
997997 )
998- .ReturnsAsync(new long[0]);
998+ .ReturnsAsync(Array.Empty<long>());
999999
10001000 twitterApi.apiConnection = mock.Object;
10011001
@@ -1313,7 +1313,7 @@ namespace OpenTween.Api
13131313 },
13141314 new Dictionary<string, IMediaItem> { { "media", media } })
13151315 )
1316- .Returns(Task.FromResult(0));
1316+ .Returns(Task.CompletedTask);
13171317
13181318 twitterApi.apiConnection = mock.Object;
13191319
@@ -1387,7 +1387,7 @@ namespace OpenTween.Api
13871387 new Uri("https://upload.twitter.com/1.1/media/metadata/create.json", UriKind.Absolute),
13881388 "{\"media_id\": \"12345\", \"alt_text\": {\"text\": \"hogehoge\"}}")
13891389 )
1390- .Returns(Task.FromResult(0));
1390+ .Returns(Task.CompletedTask);
13911391
13921392 twitterApi.apiConnection = mock.Object;
13931393
--- a/OpenTween.Tests/HashtagManageTest.cs
+++ b/OpenTween.Tests/HashtagManageTest.cs
@@ -51,7 +51,7 @@ namespace OpenTween
5151 [Fact]
5252 public void InitHashtagHistory_EmptyTest()
5353 {
54- var hashtags = new string[0];
54+ var hashtags = Array.Empty<string>();
5555
5656 using (var atDialog = new AtIdSupplement())
5757 using (var hashDialog = new HashtagManage(atDialog, hashtags, "", false, false, false))
@@ -67,7 +67,7 @@ namespace OpenTween
6767 public void AddHashtag_Test()
6868 {
6969 using (var atDialog = new AtIdSupplement())
70- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
70+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
7171 {
7272 hashDialog.RunSilent = true;
7373
@@ -86,7 +86,7 @@ namespace OpenTween
8686 public void AddHashtag_FullWidthTest()
8787 {
8888 using (var atDialog = new AtIdSupplement())
89- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
89+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
9090 {
9191 hashDialog.RunSilent = true;
9292
@@ -107,7 +107,7 @@ namespace OpenTween
107107 // ハッシュタグを表す「#」の直後に結合文字 (濁点など) が続いた場合に対するテスト
108108
109109 using (var atDialog = new AtIdSupplement())
110- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
110+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
111111 {
112112 hashDialog.RunSilent = true;
113113
@@ -127,7 +127,7 @@ namespace OpenTween
127127 public void AddHashtag_MultipleTest()
128128 {
129129 using (var atDialog = new AtIdSupplement())
130- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
130+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
131131 {
132132 hashDialog.RunSilent = true;
133133
@@ -146,7 +146,7 @@ namespace OpenTween
146146 public void AddHashtag_InvalidTest()
147147 {
148148 using (var atDialog = new AtIdSupplement())
149- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
149+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
150150 {
151151 hashDialog.RunSilent = true;
152152
@@ -265,7 +265,7 @@ namespace OpenTween
265265 public void EditModeSwitch_Test()
266266 {
267267 using (var atDialog = new AtIdSupplement())
268- using (var hashDialog = new HashtagManage(atDialog, new string[0], "", false, false, false))
268+ using (var hashDialog = new HashtagManage(atDialog, Array.Empty<string>(), "", false, false, false))
269269 {
270270 hashDialog.RunSilent = true;
271271
--- a/OpenTween.Tests/Models/PostClassTest.cs
+++ b/OpenTween.Tests/Models/PostClassTest.cs
@@ -191,7 +191,7 @@ namespace OpenTween.Models
191191 InReplyToUser = "hogehoge",
192192 InReplyToUserId = 100L,
193193 IsReply = true,
194- ReplyToList = new List<Tuple<long, string>> { Tuple.Create(100L, "hogehoge") },
194+ ReplyToList = { (100L, "hogehoge") },
195195 };
196196
197197 post.IsDeleted = true;
--- a/OpenTween.Tests/TweenMainTest.cs
+++ b/OpenTween.Tests/TweenMainTest.cs
@@ -75,7 +75,7 @@ namespace OpenTween
7575 [Fact]
7676 public void GetUrlFromDataObject_UnknownFormatTest()
7777 {
78- using (var memstream = new MemoryStream(new byte[0]))
78+ using (var memstream = new MemoryStream(Array.Empty<byte>()))
7979 {
8080 var data = new DataObject("application/x-hogehoge", memstream);
8181
--- a/OpenTween/Connection/Networking.cs
+++ b/OpenTween/Connection/Networking.cs
@@ -104,6 +104,7 @@ namespace OpenTween.Connection
104104 Networking.initialized = true;
105105
106106 ServicePointManager.Expect100Continue = false;
107+ ServicePointManager.CheckCertificateRevocationList = true;
107108
108109 // Win7 では SystemDefault が SSL3.0 または TLS1.0 のため、明示的にバージョンを引き上げる必要がある
109110 if (IsWindows7)
--- a/OpenTween/Connection/TwitterApiConnection.cs
+++ b/OpenTween/Connection/TwitterApiConnection.cs
@@ -461,7 +461,7 @@ namespace OpenTween.Connection
461461 private void Networking_WebProxyChanged(object sender, EventArgs e)
462462 => this.InitializeHttpClients();
463463
464- public static async Task<Tuple<string, string>> GetRequestTokenAsync()
464+ public static async Task<(string Token, string TokenSecret)> GetRequestTokenAsync()
465465 {
466466 var param = new Dictionary<string, string>
467467 {
@@ -470,14 +470,14 @@ namespace OpenTween.Connection
470470 var response = await GetOAuthTokenAsync(new Uri("https://api.twitter.com/oauth/request_token"), param, oauthToken: null)
471471 .ConfigureAwait(false);
472472
473- return Tuple.Create(response["oauth_token"], response["oauth_token_secret"]);
473+ return (response["oauth_token"], response["oauth_token_secret"]);
474474 }
475475
476- public static Uri GetAuthorizeUri(Tuple<string, string> requestToken, string screenName = null)
476+ public static Uri GetAuthorizeUri((string Token, string TokenSecret) requestToken, string screenName = null)
477477 {
478478 var param = new Dictionary<string, string>
479479 {
480- ["oauth_token"] = requestToken.Item1,
480+ ["oauth_token"] = requestToken.Token,
481481 };
482482
483483 if (screenName != null)
@@ -486,7 +486,7 @@ namespace OpenTween.Connection
486486 return new Uri("https://api.twitter.com/oauth/authorize?" + MyCommon.BuildQueryString(param));
487487 }
488488
489- public static async Task<IDictionary<string, string>> GetAccessTokenAsync(Tuple<string, string> requestToken, string verifier)
489+ public static async Task<IDictionary<string, string>> GetAccessTokenAsync((string Token, string TokenSecret) requestToken, string verifier)
490490 {
491491 var param = new Dictionary<string, string>
492492 {
@@ -499,11 +499,11 @@ namespace OpenTween.Connection
499499 }
500500
501501 private static async Task<IDictionary<string, string>> GetOAuthTokenAsync(Uri uri, IDictionary<string, string> param,
502- Tuple<string, string> oauthToken)
502+ (string Token, string TokenSecret)? oauthToken)
503503 {
504504 HttpClient authorizeClient;
505505 if (oauthToken != null)
506- authorizeClient = InitializeHttpClient(oauthToken.Item1, oauthToken.Item2);
506+ authorizeClient = InitializeHttpClient(oauthToken.Value.Token, oauthToken.Value.TokenSecret);
507507 else
508508 authorizeClient = InitializeHttpClient("", "");
509509
--- a/OpenTween/Models/LocalSearchTabModel.cs
+++ b/OpenTween/Models/LocalSearchTabModel.cs
@@ -39,6 +39,6 @@ namespace OpenTween.Models
3939 }
4040
4141 public override Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress)
42- => Task.FromResult(0); // 何もしない
42+ => Task.CompletedTask; // 何もしない
4343 }
4444 }
--- a/OpenTween/Models/MuteTabModel.cs
+++ b/OpenTween/Models/MuteTabModel.cs
@@ -45,6 +45,6 @@ namespace OpenTween.Models
4545 }
4646
4747 public override Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress)
48- => Task.FromResult(0); // 何もしない
48+ => Task.CompletedTask; // 何もしない
4949 }
5050 }
--- a/OpenTween/Models/PostClass.cs
+++ b/OpenTween/Models/PostClass.cs
@@ -102,7 +102,7 @@ namespace OpenTween.Models
102102 private long? _InReplyToStatusId;
103103 public string Source { get; set; }
104104 public Uri SourceUri { get; set; }
105- public List<Tuple<long, string>> ReplyToList { get; set; }
105+ public List<(long UserId, string ScreenName)> ReplyToList { get; set; }
106106 public bool IsMe { get; set; }
107107 public bool IsDm { get; set; }
108108 public long UserId { get; set; }
@@ -153,7 +153,7 @@ namespace OpenTween.Models
153153 if (deepExpand)
154154 this.ExpandTask = this.DeepExpandAsync();
155155 else
156- this.ExpandTask = Task.FromResult(0);
156+ this.ExpandTask = Task.CompletedTask;
157157 }
158158
159159 protected virtual async Task DeepExpandAsync()
@@ -191,9 +191,9 @@ namespace OpenTween.Models
191191 {
192192 RetweetedBy = "";
193193 Media = new List<MediaInfo>();
194- ReplyToList = new List<Tuple<long, string>>();
195- QuoteStatusIds = new long[0];
196- ExpandedUrls = new ExpandedUrlInfo[0];
194+ ReplyToList = new List<(long, string)>();
195+ QuoteStatusIds = Array.Empty<long>();
196+ ExpandedUrls = Array.Empty<ExpandedUrlInfo>();
197197 }
198198
199199 public string TextSingleLine
@@ -288,7 +288,7 @@ namespace OpenTween.Models
288288 this.InReplyToUser = "";
289289 this.InReplyToUserId = null;
290290 this.IsReply = false;
291- this.ReplyToList = new List<Tuple<long, string>>();
291+ this.ReplyToList = new List<(long, string)>();
292292 this._states = States.None;
293293 }
294294 _IsDeleted = value;
@@ -431,7 +431,7 @@ namespace OpenTween.Models
431431 public PostClass Clone()
432432 {
433433 var clone = (PostClass)this.MemberwiseClone();
434- clone.ReplyToList = new List<Tuple<long, string>>(this.ReplyToList);
434+ clone.ReplyToList = new List<(long, string)>(this.ReplyToList);
435435 clone.Media = new List<MediaInfo>(this.Media);
436436 clone.QuoteStatusIds = this.QuoteStatusIds.ToArray();
437437 clone.ExpandedUrls = this.ExpandedUrls.Select(x => x.Clone()).ToArray();
--- a/OpenTween/Models/PostFilterRule.cs
+++ b/OpenTween/Models/PostFilterRule.cs
@@ -93,7 +93,7 @@ namespace OpenTween.Models
9393 get => this._FilterBody;
9494 set => this.SetProperty(ref this._FilterBody, value ?? throw new ArgumentNullException(nameof(value)));
9595 }
96- private string[] _FilterBody = new string[0];
96+ private string[] _FilterBody = Array.Empty<string>();
9797
9898 [XmlArray("ExBodyFilterArray")]
9999 public string[] ExFilterBody
@@ -101,7 +101,7 @@ namespace OpenTween.Models
101101 get => this._ExFilterBody;
102102 set => this.SetProperty(ref this._ExFilterBody, value ?? throw new ArgumentNullException(nameof(value)));
103103 }
104- private string[] _ExFilterBody = new string[0];
104+ private string[] _ExFilterBody = Array.Empty<string>();
105105
106106 [XmlElement("SearchBoth")]
107107 public bool UseNameField
--- a/OpenTween/Models/TabInformations.cs
+++ b/OpenTween/Models/TabInformations.cs
@@ -311,7 +311,7 @@ namespace OpenTween.Models
311311 lock (this.LockObj)
312312 {
313313 soundFile = "";
314- notifyPosts = new PostClass[0];
314+ notifyPosts = Array.Empty<PostClass>();
315315 newMentionOrDm = false;
316316 isDeletePost = false;
317317
--- a/OpenTween/MyLists.cs
+++ b/OpenTween/MyLists.cs
@@ -45,10 +45,10 @@ namespace OpenTween
4545 private readonly string contextScreenName;
4646
4747 /// <summary>自分が所有しているリスト</summary>
48- private ListElement[] ownedLists = new ListElement[0];
48+ private ListElement[] ownedLists = Array.Empty<ListElement>();
4949
5050 /// <summary>操作対象のユーザーが追加されているリストのID</summary>
51- private long[] addedListIds = new long[0];
51+ private long[] addedListIds = Array.Empty<long>();
5252
5353 public MyLists()
5454 => this.InitializeComponent();
--- a/OpenTween/Setting/SettingTabs.cs
+++ b/OpenTween/Setting/SettingTabs.cs
@@ -73,7 +73,7 @@ namespace OpenTween
7373 /// <summary>
7474 /// 振り分けルール (<see cref="MyCommon.TabUsageType.UserDefined"/> で使用)
7575 /// </summary>
76- public PostFilterRule[] FilterArray { get; set; } = new PostFilterRule[0];
76+ public PostFilterRule[] FilterArray { get; set; } = Array.Empty<PostFilterRule>();
7777
7878 /// <summary>
7979 /// 表示するユーザーのスクリーンネーム (<see cref="MyCommon.TabUsageType.UserTimeline"/> で使用)
--- a/OpenTween/ShortcutCommand.cs
+++ b/OpenTween/ShortcutCommand.cs
@@ -66,8 +66,8 @@ namespace OpenTween
6666
6767 private ShortcutCommand()
6868 {
69- this.Shortcuts = new Keys[0];
70- this.command = () => Task.FromResult(0);
69+ this.Shortcuts = Array.Empty<Keys>();
70+ this.command = () => Task.CompletedTask;
7171 this.onlyWhen = () => true;
7272 this.FocusedOn = FocusedControl.None;
7373 this.NotFocusedOn = FocusedControl.None;
@@ -166,14 +166,11 @@ namespace OpenTween
166166 return this.instance;
167167 }
168168
169- /// <summary>何もしないタスク</summary>
170- private static Task noOpTask = Task.FromResult(0);
171-
172169 /// <summary>
173170 /// Action を Func&lt;Task&gt; に変換します
174171 /// </summary>
175172 private static Func<Task> SynchronousTask(Action action)
176- => () => { action(); return noOpTask; };
173+ => () => { action(); return Task.CompletedTask; };
177174 }
178175 }
179176 }
--- a/OpenTween/Thumbnail/Services/Tumblr.cs
+++ b/OpenTween/Thumbnail/Services/Tumblr.cs
@@ -97,7 +97,7 @@ namespace OpenTween.Thumbnail.Services
9797
9898 var item = xElm.XPathSelectElement("/response/posts/item[1]");
9999 if (item == null)
100- return new ThumbnailInfo[0];
100+ return Array.Empty<ThumbnailInfo>();
101101
102102 var postUrlElm = item.Element("post_url");
103103
--- a/OpenTween/Tween.cs
+++ b/OpenTween/Tween.cs
@@ -169,7 +169,7 @@ namespace OpenTween
169169 private int _hisIdx; //発言履歴カレントインデックス
170170
171171 //発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない)
172- private Tuple<long, string> inReplyTo = null; // リプライ先のステータスID・スクリーン名
172+ private (long StatusId, string ScreenName)? inReplyTo = null; // リプライ先のステータスID・スクリーン名
173173
174174 //時速表示用
175175 private List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>();
@@ -304,7 +304,7 @@ namespace OpenTween
304304 }
305305
306306 private Stack<ReplyChain> replyChains; //[, ]でのリプライ移動の履歴
307- private Stack<ValueTuple<TabPage, PostClass>> selectPostChains = new Stack<ValueTuple<TabPage, PostClass>>(); //ポスト選択履歴
307+ private Stack<(TabPage, PostClass)> selectPostChains = new Stack<(TabPage, PostClass)>(); //ポスト選択履歴
308308
309309 //検索処理タイプ
310310 internal enum SEARCHTYPE
@@ -317,18 +317,16 @@ namespace OpenTween
317317 private class StatusTextHistory
318318 {
319319 public string status = "";
320- public long? inReplyToId = null;
321- public string inReplyToName = null;
320+ public (long StatusId, string ScreenName)? inReplyTo = null;
322321 public string imageService = ""; //画像投稿サービス名
323322 public IMediaItem[] mediaItems = null;
324323 public StatusTextHistory()
325324 {
326325 }
327- public StatusTextHistory(string status, long? replyToId, string replyToName)
326+ public StatusTextHistory(string status, (long StatusId, string ScreenName)? inReplyTo)
328327 {
329328 this.status = status;
330- this.inReplyToId = replyToId;
331- this.inReplyToName = replyToName;
329+ this.inReplyTo = inReplyTo;
332330 }
333331 }
334332
@@ -1578,7 +1576,7 @@ namespace OpenTween
15781576 {
15791577 return new ListViewSelection
15801578 {
1581- SelectedStatusIds = new long[0],
1579+ SelectedStatusIds = Array.Empty<long>(),
15821580 SelectionMarkStatusId = null,
15831581 FocusedStatusId = null,
15841582 };
@@ -2065,10 +2063,10 @@ namespace OpenTween
20652063 else if (TargetPost.IsReply)
20662064 //自分宛返信
20672065 cl = _clAtSelf;
2068- else if (BasePost.ReplyToList.Any(x => x.Item1 == TargetPost.UserId))
2066+ else if (BasePost.ReplyToList.Any(x => x.UserId == TargetPost.UserId))
20692067 //返信先
20702068 cl = _clAtFromTarget;
2071- else if (TargetPost.ReplyToList.Any(x => x.Item1 == BasePost.UserId))
2069+ else if (TargetPost.ReplyToList.Any(x => x.UserId == BasePost.UserId))
20722070 //その人への返信
20732071 cl = _clAtTarget;
20742072 else if (TargetPost.ScreenName.Equals(BasePost.ScreenName, StringComparison.OrdinalIgnoreCase))
@@ -2118,9 +2116,7 @@ namespace OpenTween
21182116 return;
21192117 }
21202118
2121- var inReplyToStatusId = this.inReplyTo?.Item1;
2122- var inReplyToScreenName = this.inReplyTo?.Item2;
2123- _history[_history.Count - 1] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
2119+ _history[_history.Count - 1] = new StatusTextHistory(StatusText.Text, this.inReplyTo);
21242120
21252121 if (SettingManager.Common.Nicoms)
21262122 {
@@ -2148,24 +2144,24 @@ namespace OpenTween
21482144 // auto_populate_reply_metadata や attachment_url を使用しなくても 140 字以内に
21492145 // 収まる場合はこれらのオプションを使用せずに投稿する
21502146 status.Text = statusTextCompat;
2151- status.InReplyToStatusId = this.inReplyTo?.Item1;
2147+ status.InReplyToStatusId = this.inReplyTo?.StatusId;
21522148 }
21532149 else
21542150 {
21552151 status.Text = this.FormatStatusTextExtended(this.StatusText.Text, out var autoPopulatedUserIds, out var attachmentUrl);
2156- status.InReplyToStatusId = this.inReplyTo?.Item1;
2152+ status.InReplyToStatusId = this.inReplyTo?.StatusId;
21572153
21582154 status.AttachmentUrl = attachmentUrl;
21592155
21602156 // リプライ先がセットされていても autoPopulatedUserIds が空の場合は auto_populate_reply_metadata を有効にしない
21612157 // (非公式 RT の場合など)
2162- var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Item1] : null;
2158+ var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Value.StatusId] : null;
21632159 if (replyToPost != null && autoPopulatedUserIds.Length != 0)
21642160 {
21652161 status.AutoPopulateReplyMetadata = true;
21662162
21672163 // ReplyToList のうち autoPopulatedUserIds に含まれていないユーザー ID を抽出
2168- status.ExcludeReplyUserIds = replyToPost.ReplyToList.Select(x => x.Item1).Except(autoPopulatedUserIds)
2164+ status.ExcludeReplyUserIds = replyToPost.ReplyToList.Select(x => x.UserId).Except(autoPopulatedUserIds)
21692165 .ToArray();
21702166 }
21712167 }
@@ -4566,7 +4562,7 @@ namespace OpenTween
45664562 {
45674563 List<long> _autoPopulatedUserIds = new List<long>();
45684564
4569- var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Item1] : null;
4565+ var replyToPost = this.inReplyTo != null ? this._statuses[this.inReplyTo.Value.StatusId] : null;
45704566 if (replyToPost != null)
45714567 {
45724568 if (statusText.StartsWith($"@{replyToPost.ScreenName} ", StringComparison.Ordinal))
@@ -4574,12 +4570,12 @@ namespace OpenTween
45744570 statusText = statusText.Substring(replyToPost.ScreenName.Length + 2);
45754571 _autoPopulatedUserIds.Add(replyToPost.UserId);
45764572
4577- foreach (var reply in replyToPost.ReplyToList)
4573+ foreach (var (userId, screenName) in replyToPost.ReplyToList)
45784574 {
4579- if (statusText.StartsWith($"@{reply.Item2} ", StringComparison.Ordinal))
4575+ if (statusText.StartsWith($"@{screenName} ", StringComparison.Ordinal))
45804576 {
4581- statusText = statusText.Substring(reply.Item2.Length + 2);
4582- _autoPopulatedUserIds.Add(reply.Item1);
4577+ statusText = statusText.Substring(screenName.Length + 2);
4578+ _autoPopulatedUserIds.Add(userId);
45834579 }
45844580 }
45854581 }
@@ -4669,7 +4665,7 @@ namespace OpenTween
46694665 disableFooter = true;
46704666
46714667 // 自分宛のリプライの場合は先頭の「@screen_name 」の部分を除去する (in_reply_to_status_id は維持される)
4672- if (this.inReplyTo != null && this.inReplyTo.Item2 == this.tw.Username)
4668+ if (this.inReplyTo != null && this.inReplyTo.Value.ScreenName == this.tw.Username)
46734669 {
46744670 var mentionSelf = $"@{this.tw.Username} ";
46754671 if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase))
@@ -5716,7 +5712,7 @@ namespace OpenTween
57165712 }
57175713 }
57185714
5719- private ShortcutCommand[] shortcutCommands = new ShortcutCommand[0];
5715+ private ShortcutCommand[] shortcutCommands = Array.Empty<ShortcutCommand>();
57205716
57215717 private void InitializeShortcuts()
57225718 {
@@ -5965,19 +5961,13 @@ namespace OpenTween
59655961 .FocusedOn(FocusedControl.StatusText)
59665962 .Do(() => {
59675963 if (!string.IsNullOrWhiteSpace(StatusText.Text))
5968- {
5969- var inReplyToStatusId = this.inReplyTo?.Item1;
5970- var inReplyToScreenName = this.inReplyTo?.Item2;
5971- _history[_hisIdx] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
5972- }
5964+ _history[_hisIdx] = new StatusTextHistory(StatusText.Text, this.inReplyTo);
5965+
59735966 _hisIdx -= 1;
59745967 if (_hisIdx < 0) _hisIdx = 0;
59755968
59765969 var historyItem = this._history[this._hisIdx];
5977- if (historyItem.inReplyToId != null)
5978- this.inReplyTo = Tuple.Create(historyItem.inReplyToId.Value, historyItem.inReplyToName);
5979- else
5980- this.inReplyTo = null;
5970+ this.inReplyTo = historyItem.inReplyTo;
59815971 StatusText.Text = historyItem.status;
59825972 StatusText.SelectionStart = StatusText.Text.Length;
59835973 }),
@@ -5986,19 +5976,13 @@ namespace OpenTween
59865976 .FocusedOn(FocusedControl.StatusText)
59875977 .Do(() => {
59885978 if (!string.IsNullOrWhiteSpace(StatusText.Text))
5989- {
5990- var inReplyToStatusId = this.inReplyTo?.Item1;
5991- var inReplyToScreenName = this.inReplyTo?.Item2;
5992- _history[_hisIdx] = new StatusTextHistory(StatusText.Text, inReplyToStatusId, inReplyToScreenName);
5993- }
5979+ _history[_hisIdx] = new StatusTextHistory(StatusText.Text, this.inReplyTo);
5980+
59945981 _hisIdx += 1;
59955982 if (_hisIdx > _history.Count - 1) _hisIdx = _history.Count - 1;
59965983
59975984 var historyItem = this._history[this._hisIdx];
5998- if (historyItem.inReplyToId != null)
5999- this.inReplyTo = Tuple.Create(historyItem.inReplyToId.Value, historyItem.inReplyToName);
6000- else
6001- this.inReplyTo = null;
5985+ this.inReplyTo = historyItem.inReplyTo;
60025986 StatusText.Text = historyItem.status;
60035987 StatusText.SelectionStart = StatusText.Text.Length;
60045988 }),
@@ -6602,10 +6586,10 @@ namespace OpenTween
66026586 post.RetweetedBy == _anchorPost.ScreenName ||
66036587 post.ScreenName == _anchorPost.RetweetedBy ||
66046588 (!string.IsNullOrEmpty(post.RetweetedBy) && post.RetweetedBy == _anchorPost.RetweetedBy) ||
6605- _anchorPost.ReplyToList.Any(x => x.Item1 == post.UserId) ||
6606- _anchorPost.ReplyToList.Any(x => x.Item1 == post.RetweetedByUserId) ||
6607- post.ReplyToList.Any(x => x.Item1 == _anchorPost.UserId) ||
6608- post.ReplyToList.Any(x => x.Item1 == _anchorPost.RetweetedByUserId))
6589+ _anchorPost.ReplyToList.Any(x => x.UserId == post.UserId) ||
6590+ _anchorPost.ReplyToList.Any(x => x.UserId == post.RetweetedByUserId) ||
6591+ post.ReplyToList.Any(x => x.UserId == _anchorPost.UserId) ||
6592+ post.ReplyToList.Any(x => x.UserId == _anchorPost.RetweetedByUserId))
66096593 {
66106594 SelectListItem(_curList, idx);
66116595 _curList.EnsureVisible(idx);
@@ -6983,7 +6967,7 @@ namespace OpenTween
69836967 private void TrimPostChain()
69846968 {
69856969 if (this.selectPostChains.Count <= 2000) return;
6986- var p = new Stack<ValueTuple<TabPage, PostClass>>(2000);
6970+ var p = new Stack<(TabPage, PostClass)>(2000);
69876971 for (int i = 0; i < 2000; i++)
69886972 {
69896973 p.Push(this.selectPostChains.Pop());
@@ -7191,7 +7175,7 @@ namespace OpenTween
71917175
71927176 var tabs = this.ListTab.TabPages.Cast<TabPage>()
71937177 .Select(x => this._statuses.Tabs[x.Text])
7194- .Concat(new[] { this._statuses.GetTabByType(MyCommon.TabUsageType.Mute) });
7178+ .Append(this._statuses.GetTabByType(MyCommon.TabUsageType.Mute));
71957179
71967180 foreach (var tab in tabs)
71977181 {
@@ -7510,7 +7494,7 @@ namespace OpenTween
75107494 //空の場合
75117495 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
75127496 var inReplyToScreenName = this._curPost.ScreenName;
7513- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
7497+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
75147498
75157499 // ステータステキストが入力されていない場合先頭に@ユーザー名を追加する
75167500 StatusText.Text = "@" + _curPost.ScreenName + " ";
@@ -7524,12 +7508,12 @@ namespace OpenTween
75247508 //1件選んでEnter or DoubleClick
75257509 if (StatusText.Text.Contains("@" + _curPost.ScreenName + " "))
75267510 {
7527- if (this.inReplyTo?.Item2 == _curPost.ScreenName)
7511+ if (this.inReplyTo?.ScreenName == _curPost.ScreenName)
75287512 {
75297513 //返信先書き換え
75307514 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
75317515 var inReplyToScreenName = this._curPost.ScreenName;
7532- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
7516+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
75337517 }
75347518 return;
75357519 }
@@ -7547,7 +7531,7 @@ namespace OpenTween
75477531 // 単独リプライ
75487532 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
75497533 var inReplyToScreenName = this._curPost.ScreenName;
7550- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
7534+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
75517535 StatusText.Text = "@" + _curPost.ScreenName + " " + StatusText.Text;
75527536 }
75537537 }
@@ -7640,16 +7624,16 @@ namespace OpenTween
76407624 }
76417625 if (isAll)
76427626 {
7643- foreach (string nm in post.ReplyToList.Select(x => x.Item2))
7627+ foreach (var (_, screenName) in post.ReplyToList)
76447628 {
7645- if (!ids.Contains("@" + nm + " ") &&
7646- !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
7629+ if (!ids.Contains("@" + screenName + " ") &&
7630+ !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
76477631 {
7648- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
7632+ Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
76497633 if (m.Success)
76507634 ids += "@" + m.Result("${id}") + " ";
76517635 else
7652- ids += "@" + nm + " ";
7636+ ids += "@" + screenName + " ";
76537637 }
76547638 }
76557639 }
@@ -7695,16 +7679,16 @@ namespace OpenTween
76957679 {
76967680 ids += "@" + post.ScreenName + " ";
76977681 }
7698- foreach (string nm in post.ReplyToList.Select(x => x.Item2))
7682+ foreach (var (_, screenName) in post.ReplyToList)
76997683 {
7700- if (!ids.Contains("@" + nm + " ") &&
7701- !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
7684+ if (!ids.Contains("@" + screenName + " ") &&
7685+ !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase))
77027686 {
7703- Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + nm + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
7687+ Match m = Regex.Match(post.TextFromApi, "[@@](?<id>" + screenName + ")([^a-zA-Z0-9]|$)", RegexOptions.IgnoreCase);
77047688 if (m.Success)
77057689 ids += "@" + m.Result("${id}") + " ";
77067690 else
7707- ids += "@" + nm + " ";
7691+ ids += "@" + screenName + " ";
77087692 }
77097693 }
77107694 if (!string.IsNullOrEmpty(post.RetweetedBy))
@@ -7720,7 +7704,7 @@ namespace OpenTween
77207704 //未入力の場合のみ返信先付加
77217705 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
77227706 var inReplyToScreenName = this._curPost.ScreenName;
7723- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
7707+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
77247708
77257709 StatusText.Text = ids;
77267710 StatusText.SelectionStart = ids.Length;
@@ -8896,7 +8880,7 @@ namespace OpenTween
88968880
88978881 if (m != null)
88988882 {
8899- var inReplyToScreenName = this.inReplyTo.Item2;
8883+ var inReplyToScreenName = this.inReplyTo.Value.ScreenName;
89008884 if (StatusText.StartsWith("@", StringComparison.Ordinal))
89018885 {
89028886 if (StatusText.StartsWith("@" + inReplyToScreenName, StringComparison.Ordinal)) return;
@@ -10461,7 +10445,7 @@ namespace OpenTween
1046110445 // 投稿時に in_reply_to_status_id を付加する
1046210446 var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId;
1046310447 var inReplyToScreenName = this._curPost.ScreenName;
10464- this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName);
10448+ this.inReplyTo = (inReplyToStatusId, inReplyToScreenName);
1046510449
1046610450 StatusText.Text += " RT @" + _curPost.ScreenName + ": " + rtdata;
1046710451
--- a/OpenTween/TweetDetailsView.cs
+++ b/OpenTween/TweetDetailsView.cs
@@ -148,7 +148,7 @@ namespace OpenTween
148148 sb.AppendFormat("IsRead : {0}<br>", post.IsRead);
149149 sb.AppendFormat("IsReply : {0}<br>", post.IsReply);
150150
151- foreach (string nm in post.ReplyToList.Select(x => x.Item2))
151+ foreach (string nm in post.ReplyToList.Select(x => x.ScreenName))
152152 {
153153 sb.AppendFormat("ReplyToList : {0}<br>", nm);
154154 }
--- a/OpenTween/Twitter.cs
+++ b/OpenTween/Twitter.cs
@@ -159,7 +159,7 @@ namespace OpenTween
159159 delegate void GetIconImageDelegate(PostClass post);
160160 private readonly object LockObj = new object();
161161 private ISet<long> followerId = new HashSet<long>();
162- private long[] noRTId = new long[0];
162+ private long[] noRTId = Array.Empty<long>();
163163
164164 //プロパティからアクセスされる共通情報
165165 private List<string> _hashList = new List<string>();
@@ -806,7 +806,7 @@ namespace OpenTween
806806 post.Source = string.Intern(sourceText);
807807 post.SourceUri = sourceUri;
808808
809- post.IsReply = post.RetweetedId == null && post.ReplyToList.Any(x => x.Item1 == this.UserId);
809+ post.IsReply = post.RetweetedId == null && post.ReplyToList.Any(x => x.UserId == this.UserId);
810810 post.IsExcludeReply = false;
811811
812812 if (post.IsMe)
@@ -830,7 +830,7 @@ namespace OpenTween
830830 var urls = entities.OfType<TwitterEntityUrl>().Select(x => x.ExpandedUrl);
831831
832832 if (quotedStatusLink != null)
833- urls = urls.Concat(new[] { quotedStatusLink.Expanded });
833+ urls = urls.Append(quotedStatusLink.Expanded);
834834
835835 return GetQuoteTweetStatusIds(urls);
836836 }
@@ -1457,7 +1457,7 @@ namespace OpenTween
14571457 if (MyCommon._endingFlag) return;
14581458
14591459 var cursor = -1L;
1460- var newFollowerIds = new HashSet<long>();
1460+ var newFollowerIds = Enumerable.Empty<long>();
14611461 do
14621462 {
14631463 var ret = await this.Api.FollowersIds(cursor)
@@ -1466,11 +1466,11 @@ namespace OpenTween
14661466 if (ret.Ids == null)
14671467 throw new WebApiException("ret.ids == null");
14681468
1469- newFollowerIds.UnionWith(ret.Ids);
1469+ newFollowerIds = newFollowerIds.Concat(ret.Ids);
14701470 cursor = ret.NextCursor;
14711471 } while (cursor != 0);
14721472
1473- this.followerId = newFollowerIds;
1473+ this.followerId = newFollowerIds.ToHashSet();
14741474 TabInformations.GetInstance().RefreshOwl(this.followerId);
14751475
14761476 this.GetFollowersSuccess = true;
@@ -1587,7 +1587,7 @@ namespace OpenTween
15871587 }
15881588 }
15891589
1590- private void ExtractEntities(TwitterEntities entities, List<Tuple<long, string>> AtList, List<MediaInfo> media)
1590+ private void ExtractEntities(TwitterEntities entities, List<(long UserId, string ScreenName)> AtList, List<MediaInfo> media)
15911591 {
15921592 if (entities != null)
15931593 {
@@ -1602,7 +1602,7 @@ namespace OpenTween
16021602 {
16031603 foreach (var ent in entities.UserMentions)
16041604 {
1605- AtList.Add(Tuple.Create(ent.Id, ent.ScreenName));
1605+ AtList.Add((ent.Id, ent.ScreenName));
16061606 }
16071607 }
16081608 if (entities.Media != null)
@@ -1712,19 +1712,20 @@ namespace OpenTween
17121712 if (MyCommon._endingFlag) return;
17131713
17141714 var cursor = -1L;
1715- var newBlockIds = new HashSet<long>();
1715+ var newBlockIds = Enumerable.Empty<long>();
17161716 do
17171717 {
17181718 var ret = await this.Api.BlocksIds(cursor)
17191719 .ConfigureAwait(false);
17201720
1721- newBlockIds.UnionWith(ret.Ids);
1721+ newBlockIds = newBlockIds.Concat(ret.Ids);
17221722 cursor = ret.NextCursor;
17231723 } while (cursor != 0);
17241724
1725- newBlockIds.Remove(this.UserId); // 元のソースにあったので一応残しておく
1725+ var blockIdsSet = newBlockIds.ToHashSet();
1726+ blockIdsSet.Remove(this.UserId); // 元のソースにあったので一応残しておく
17261727
1727- TabInformations.GetInstance().BlockIds = newBlockIds;
1728+ TabInformations.GetInstance().BlockIds = blockIdsSet;
17281729 }
17291730
17301731 /// <summary>
@@ -1738,7 +1739,7 @@ namespace OpenTween
17381739 var ids = await TwitterIds.GetAllItemsAsync(x => this.Api.MutesUsersIds(x))
17391740 .ConfigureAwait(false);
17401741
1741- TabInformations.GetInstance().MuteUserIds = new HashSet<long>(ids);
1742+ TabInformations.GetInstance().MuteUserIds = ids.ToHashSet();
17421743 }
17431744
17441745 public string[] GetHashList()
--- a/OpenTween/app.manifest
+++ b/OpenTween/app.manifest
@@ -1,19 +1,19 @@
11 <?xml version="1.0" encoding="utf-8"?>
2-<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
33 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
44 <security>
55 <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
66 <!-- UAC マニフェスト オプション
7- Windows のユーザー アカウント制御のレベルを変更するには、
8- requestedExecutionLevel ノードを以下のいずれかで置換します。
7+ Windows のユーザー アカウント制御のレベルを変更するには、
8+ requestedExecutionLevel ノードを以下のいずれかで置換します。
99
1010 <requestedExecutionLevel level="asInvoker" uiAccess="false" />
1111 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
1212 <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
1313
14- requestedExecutionLevel ノードを指定すると、ファイルおよびレジストリの仮想化は無効になります。
15- 旧バージョンとの互換性のためにファイルおよびレジストリの仮想化を
16- 使用する場合は、requestedExecutionLevel ノードを削除します。
14+ requestedExecutionLevel 要素を指定すると、ファイルおよびレジストリの仮想化が無効にされます。
15+ アプリケーションが下位互換性を保つためにこの仮想化を要求する場合、この要素を
16+ 削除します。
1717 -->
1818 <requestedExecutionLevel level="asInvoker" uiAccess="false" />
1919 </requestedPrivileges>
@@ -22,8 +22,9 @@
2222
2323 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
2424 <application>
25- <!--このアプリケーションが動作するように設計されている、Windows のすべてのバージョンの一覧。
26- Windows は最も互換性の高い環境を自動的に選択します。-->
25+ <!-- このアプリケーションがテストされ、協働するようテストされた Windows バージョンの
26+ 一覧。適切な要素をコメント解除すると、最も互換性のある環境を Windows が
27+ 自動的に選択します。-->
2728
2829 <!-- Windows 7 -->
2930 <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
@@ -39,6 +40,16 @@
3940 </application>
4041 </compatibility>
4142
43+ <!-- アプリケーションが DPI 対応であり、それ以上の DPI で Windows によって自動的にスケーリングされないことを
44+ 示します。Windows Presentation Foundation (WPF) アプリケーションは自動的に DPI に対応し、オプトインする必要は
45+ ありません。さらに、この設定にオプトインする .NET Framework 4.6 を対象とする Windows Forms アプリケーションは、
46+ app.config ファイルで 'EnableWindowsFormsHighDpiAutoResizing' 設定を 'true' に設定する必要があります。-->
47+ <application xmlns="urn:schemas-microsoft-com:asm.v3">
48+ <windowsSettings>
49+ <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
50+ </windowsSettings>
51+ </application>
52+
4253 <!-- Windows のコモン コントロールとダイアログのテーマを有効にします (Windows XP 以降) -->
4354 <!-- <dependency>
4455 <dependentAssembly>
@@ -53,11 +64,4 @@
5364 </dependentAssembly>
5465 </dependency>-->
5566
56- <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
57- <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
58- <!-- DPI 対応であることを宣言 -->
59- <dpiAware>true</dpiAware>
60- </asmv3:windowsSettings>
61- </asmv3:application>
62-
63-</asmv1:assembly>
67+</assembly>
Show on old repository browser