開発に使用するリポジトリ
修订版 | 4add08983956781990d58da360b150197990e5ef (tree) |
---|---|
时间 | 2018-10-14 16:13:20 |
作者 | upsilon <kim.upsilon@bucy...> |
Commiter | GitHub |
Merge pull request #56 from upsilon/dotnet472
.NET Framework 4.7.2 で追加されたメソッド等を使用
@@ -104,7 +104,7 @@ namespace OpenTween.Api | ||
104 | 104 | }, |
105 | 105 | "/statuses/home_timeline") |
106 | 106 | ) |
107 | - .ReturnsAsync(new TwitterStatus[0]); | |
107 | + .ReturnsAsync(Array.Empty<TwitterStatus>()); | |
108 | 108 | |
109 | 109 | twitterApi.apiConnection = mock.Object; |
110 | 110 |
@@ -134,7 +134,7 @@ namespace OpenTween.Api | ||
134 | 134 | }, |
135 | 135 | "/statuses/mentions_timeline") |
136 | 136 | ) |
137 | - .ReturnsAsync(new TwitterStatus[0]); | |
137 | + .ReturnsAsync(Array.Empty<TwitterStatus>()); | |
138 | 138 | |
139 | 139 | twitterApi.apiConnection = mock.Object; |
140 | 140 |
@@ -166,7 +166,7 @@ namespace OpenTween.Api | ||
166 | 166 | }, |
167 | 167 | "/statuses/user_timeline") |
168 | 168 | ) |
169 | - .ReturnsAsync(new TwitterStatus[0]); | |
169 | + .ReturnsAsync(Array.Empty<TwitterStatus>()); | |
170 | 170 | |
171 | 171 | twitterApi.apiConnection = mock.Object; |
172 | 172 |
@@ -261,7 +261,7 @@ namespace OpenTween.Api | ||
261 | 261 | |
262 | 262 | twitterApi.apiConnection = mock.Object; |
263 | 263 | |
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>()) | |
265 | 265 | .IgnoreResponse() |
266 | 266 | .ConfigureAwait(false); |
267 | 267 |
@@ -536,7 +536,7 @@ namespace OpenTween.Api | ||
536 | 536 | }, |
537 | 537 | "/lists/statuses") |
538 | 538 | ) |
539 | - .ReturnsAsync(new TwitterStatus[0]); | |
539 | + .ReturnsAsync(Array.Empty<TwitterStatus>()); | |
540 | 540 | |
541 | 541 | twitterApi.apiConnection = mock.Object; |
542 | 542 |
@@ -718,7 +718,7 @@ namespace OpenTween.Api | ||
718 | 718 | } |
719 | 719 | }") |
720 | 720 | ) |
721 | - .Returns(Task.FromResult(0)); | |
721 | + .Returns(Task.CompletedTask); | |
722 | 722 | |
723 | 723 | twitterApi.apiConnection = mock.Object; |
724 | 724 |
@@ -795,7 +795,7 @@ namespace OpenTween.Api | ||
795 | 795 | }, |
796 | 796 | "/users/lookup") |
797 | 797 | ) |
798 | - .ReturnsAsync(new TwitterUser[0]); | |
798 | + .ReturnsAsync(Array.Empty<TwitterUser>()); | |
799 | 799 | |
800 | 800 | twitterApi.apiConnection = mock.Object; |
801 | 801 |
@@ -851,7 +851,7 @@ namespace OpenTween.Api | ||
851 | 851 | }, |
852 | 852 | "/favorites/list") |
853 | 853 | ) |
854 | - .ReturnsAsync(new TwitterStatus[0]); | |
854 | + .ReturnsAsync(Array.Empty<TwitterStatus>()); | |
855 | 855 | |
856 | 856 | twitterApi.apiConnection = mock.Object; |
857 | 857 |
@@ -995,7 +995,7 @@ namespace OpenTween.Api | ||
995 | 995 | null, |
996 | 996 | "/friendships/no_retweets/ids") |
997 | 997 | ) |
998 | - .ReturnsAsync(new long[0]); | |
998 | + .ReturnsAsync(Array.Empty<long>()); | |
999 | 999 | |
1000 | 1000 | twitterApi.apiConnection = mock.Object; |
1001 | 1001 |
@@ -1313,7 +1313,7 @@ namespace OpenTween.Api | ||
1313 | 1313 | }, |
1314 | 1314 | new Dictionary<string, IMediaItem> { { "media", media } }) |
1315 | 1315 | ) |
1316 | - .Returns(Task.FromResult(0)); | |
1316 | + .Returns(Task.CompletedTask); | |
1317 | 1317 | |
1318 | 1318 | twitterApi.apiConnection = mock.Object; |
1319 | 1319 |
@@ -1387,7 +1387,7 @@ namespace OpenTween.Api | ||
1387 | 1387 | new Uri("https://upload.twitter.com/1.1/media/metadata/create.json", UriKind.Absolute), |
1388 | 1388 | "{\"media_id\": \"12345\", \"alt_text\": {\"text\": \"hogehoge\"}}") |
1389 | 1389 | ) |
1390 | - .Returns(Task.FromResult(0)); | |
1390 | + .Returns(Task.CompletedTask); | |
1391 | 1391 | |
1392 | 1392 | twitterApi.apiConnection = mock.Object; |
1393 | 1393 |
@@ -51,7 +51,7 @@ namespace OpenTween | ||
51 | 51 | [Fact] |
52 | 52 | public void InitHashtagHistory_EmptyTest() |
53 | 53 | { |
54 | - var hashtags = new string[0]; | |
54 | + var hashtags = Array.Empty<string>(); | |
55 | 55 | |
56 | 56 | using (var atDialog = new AtIdSupplement()) |
57 | 57 | using (var hashDialog = new HashtagManage(atDialog, hashtags, "", false, false, false)) |
@@ -67,7 +67,7 @@ namespace OpenTween | ||
67 | 67 | public void AddHashtag_Test() |
68 | 68 | { |
69 | 69 | 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)) | |
71 | 71 | { |
72 | 72 | hashDialog.RunSilent = true; |
73 | 73 |
@@ -86,7 +86,7 @@ namespace OpenTween | ||
86 | 86 | public void AddHashtag_FullWidthTest() |
87 | 87 | { |
88 | 88 | 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)) | |
90 | 90 | { |
91 | 91 | hashDialog.RunSilent = true; |
92 | 92 |
@@ -107,7 +107,7 @@ namespace OpenTween | ||
107 | 107 | // ハッシュタグを表す「#」の直後に結合文字 (濁点など) が続いた場合に対するテスト |
108 | 108 | |
109 | 109 | 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)) | |
111 | 111 | { |
112 | 112 | hashDialog.RunSilent = true; |
113 | 113 |
@@ -127,7 +127,7 @@ namespace OpenTween | ||
127 | 127 | public void AddHashtag_MultipleTest() |
128 | 128 | { |
129 | 129 | 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)) | |
131 | 131 | { |
132 | 132 | hashDialog.RunSilent = true; |
133 | 133 |
@@ -146,7 +146,7 @@ namespace OpenTween | ||
146 | 146 | public void AddHashtag_InvalidTest() |
147 | 147 | { |
148 | 148 | 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)) | |
150 | 150 | { |
151 | 151 | hashDialog.RunSilent = true; |
152 | 152 |
@@ -265,7 +265,7 @@ namespace OpenTween | ||
265 | 265 | public void EditModeSwitch_Test() |
266 | 266 | { |
267 | 267 | 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)) | |
269 | 269 | { |
270 | 270 | hashDialog.RunSilent = true; |
271 | 271 |
@@ -191,7 +191,7 @@ namespace OpenTween.Models | ||
191 | 191 | InReplyToUser = "hogehoge", |
192 | 192 | InReplyToUserId = 100L, |
193 | 193 | IsReply = true, |
194 | - ReplyToList = new List<Tuple<long, string>> { Tuple.Create(100L, "hogehoge") }, | |
194 | + ReplyToList = { (100L, "hogehoge") }, | |
195 | 195 | }; |
196 | 196 | |
197 | 197 | post.IsDeleted = true; |
@@ -75,7 +75,7 @@ namespace OpenTween | ||
75 | 75 | [Fact] |
76 | 76 | public void GetUrlFromDataObject_UnknownFormatTest() |
77 | 77 | { |
78 | - using (var memstream = new MemoryStream(new byte[0])) | |
78 | + using (var memstream = new MemoryStream(Array.Empty<byte>())) | |
79 | 79 | { |
80 | 80 | var data = new DataObject("application/x-hogehoge", memstream); |
81 | 81 |
@@ -104,6 +104,7 @@ namespace OpenTween.Connection | ||
104 | 104 | Networking.initialized = true; |
105 | 105 | |
106 | 106 | ServicePointManager.Expect100Continue = false; |
107 | + ServicePointManager.CheckCertificateRevocationList = true; | |
107 | 108 | |
108 | 109 | // Win7 では SystemDefault が SSL3.0 または TLS1.0 のため、明示的にバージョンを引き上げる必要がある |
109 | 110 | if (IsWindows7) |
@@ -461,7 +461,7 @@ namespace OpenTween.Connection | ||
461 | 461 | private void Networking_WebProxyChanged(object sender, EventArgs e) |
462 | 462 | => this.InitializeHttpClients(); |
463 | 463 | |
464 | - public static async Task<Tuple<string, string>> GetRequestTokenAsync() | |
464 | + public static async Task<(string Token, string TokenSecret)> GetRequestTokenAsync() | |
465 | 465 | { |
466 | 466 | var param = new Dictionary<string, string> |
467 | 467 | { |
@@ -470,14 +470,14 @@ namespace OpenTween.Connection | ||
470 | 470 | var response = await GetOAuthTokenAsync(new Uri("https://api.twitter.com/oauth/request_token"), param, oauthToken: null) |
471 | 471 | .ConfigureAwait(false); |
472 | 472 | |
473 | - return Tuple.Create(response["oauth_token"], response["oauth_token_secret"]); | |
473 | + return (response["oauth_token"], response["oauth_token_secret"]); | |
474 | 474 | } |
475 | 475 | |
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) | |
477 | 477 | { |
478 | 478 | var param = new Dictionary<string, string> |
479 | 479 | { |
480 | - ["oauth_token"] = requestToken.Item1, | |
480 | + ["oauth_token"] = requestToken.Token, | |
481 | 481 | }; |
482 | 482 | |
483 | 483 | if (screenName != null) |
@@ -486,7 +486,7 @@ namespace OpenTween.Connection | ||
486 | 486 | return new Uri("https://api.twitter.com/oauth/authorize?" + MyCommon.BuildQueryString(param)); |
487 | 487 | } |
488 | 488 | |
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) | |
490 | 490 | { |
491 | 491 | var param = new Dictionary<string, string> |
492 | 492 | { |
@@ -499,11 +499,11 @@ namespace OpenTween.Connection | ||
499 | 499 | } |
500 | 500 | |
501 | 501 | 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) | |
503 | 503 | { |
504 | 504 | HttpClient authorizeClient; |
505 | 505 | if (oauthToken != null) |
506 | - authorizeClient = InitializeHttpClient(oauthToken.Item1, oauthToken.Item2); | |
506 | + authorizeClient = InitializeHttpClient(oauthToken.Value.Token, oauthToken.Value.TokenSecret); | |
507 | 507 | else |
508 | 508 | authorizeClient = InitializeHttpClient("", ""); |
509 | 509 |
@@ -39,6 +39,6 @@ namespace OpenTween.Models | ||
39 | 39 | } |
40 | 40 | |
41 | 41 | public override Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress) |
42 | - => Task.FromResult(0); // 何もしない | |
42 | + => Task.CompletedTask; // 何もしない | |
43 | 43 | } |
44 | 44 | } |
@@ -45,6 +45,6 @@ namespace OpenTween.Models | ||
45 | 45 | } |
46 | 46 | |
47 | 47 | public override Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress) |
48 | - => Task.FromResult(0); // 何もしない | |
48 | + => Task.CompletedTask; // 何もしない | |
49 | 49 | } |
50 | 50 | } |
@@ -102,7 +102,7 @@ namespace OpenTween.Models | ||
102 | 102 | private long? _InReplyToStatusId; |
103 | 103 | public string Source { get; set; } |
104 | 104 | public Uri SourceUri { get; set; } |
105 | - public List<Tuple<long, string>> ReplyToList { get; set; } | |
105 | + public List<(long UserId, string ScreenName)> ReplyToList { get; set; } | |
106 | 106 | public bool IsMe { get; set; } |
107 | 107 | public bool IsDm { get; set; } |
108 | 108 | public long UserId { get; set; } |
@@ -153,7 +153,7 @@ namespace OpenTween.Models | ||
153 | 153 | if (deepExpand) |
154 | 154 | this.ExpandTask = this.DeepExpandAsync(); |
155 | 155 | else |
156 | - this.ExpandTask = Task.FromResult(0); | |
156 | + this.ExpandTask = Task.CompletedTask; | |
157 | 157 | } |
158 | 158 | |
159 | 159 | protected virtual async Task DeepExpandAsync() |
@@ -191,9 +191,9 @@ namespace OpenTween.Models | ||
191 | 191 | { |
192 | 192 | RetweetedBy = ""; |
193 | 193 | 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>(); | |
197 | 197 | } |
198 | 198 | |
199 | 199 | public string TextSingleLine |
@@ -288,7 +288,7 @@ namespace OpenTween.Models | ||
288 | 288 | this.InReplyToUser = ""; |
289 | 289 | this.InReplyToUserId = null; |
290 | 290 | this.IsReply = false; |
291 | - this.ReplyToList = new List<Tuple<long, string>>(); | |
291 | + this.ReplyToList = new List<(long, string)>(); | |
292 | 292 | this._states = States.None; |
293 | 293 | } |
294 | 294 | _IsDeleted = value; |
@@ -431,7 +431,7 @@ namespace OpenTween.Models | ||
431 | 431 | public PostClass Clone() |
432 | 432 | { |
433 | 433 | var clone = (PostClass)this.MemberwiseClone(); |
434 | - clone.ReplyToList = new List<Tuple<long, string>>(this.ReplyToList); | |
434 | + clone.ReplyToList = new List<(long, string)>(this.ReplyToList); | |
435 | 435 | clone.Media = new List<MediaInfo>(this.Media); |
436 | 436 | clone.QuoteStatusIds = this.QuoteStatusIds.ToArray(); |
437 | 437 | clone.ExpandedUrls = this.ExpandedUrls.Select(x => x.Clone()).ToArray(); |
@@ -93,7 +93,7 @@ namespace OpenTween.Models | ||
93 | 93 | get => this._FilterBody; |
94 | 94 | set => this.SetProperty(ref this._FilterBody, value ?? throw new ArgumentNullException(nameof(value))); |
95 | 95 | } |
96 | - private string[] _FilterBody = new string[0]; | |
96 | + private string[] _FilterBody = Array.Empty<string>(); | |
97 | 97 | |
98 | 98 | [XmlArray("ExBodyFilterArray")] |
99 | 99 | public string[] ExFilterBody |
@@ -101,7 +101,7 @@ namespace OpenTween.Models | ||
101 | 101 | get => this._ExFilterBody; |
102 | 102 | set => this.SetProperty(ref this._ExFilterBody, value ?? throw new ArgumentNullException(nameof(value))); |
103 | 103 | } |
104 | - private string[] _ExFilterBody = new string[0]; | |
104 | + private string[] _ExFilterBody = Array.Empty<string>(); | |
105 | 105 | |
106 | 106 | [XmlElement("SearchBoth")] |
107 | 107 | public bool UseNameField |
@@ -311,7 +311,7 @@ namespace OpenTween.Models | ||
311 | 311 | lock (this.LockObj) |
312 | 312 | { |
313 | 313 | soundFile = ""; |
314 | - notifyPosts = new PostClass[0]; | |
314 | + notifyPosts = Array.Empty<PostClass>(); | |
315 | 315 | newMentionOrDm = false; |
316 | 316 | isDeletePost = false; |
317 | 317 |
@@ -45,10 +45,10 @@ namespace OpenTween | ||
45 | 45 | private readonly string contextScreenName; |
46 | 46 | |
47 | 47 | /// <summary>自分が所有しているリスト</summary> |
48 | - private ListElement[] ownedLists = new ListElement[0]; | |
48 | + private ListElement[] ownedLists = Array.Empty<ListElement>(); | |
49 | 49 | |
50 | 50 | /// <summary>操作対象のユーザーが追加されているリストのID</summary> |
51 | - private long[] addedListIds = new long[0]; | |
51 | + private long[] addedListIds = Array.Empty<long>(); | |
52 | 52 | |
53 | 53 | public MyLists() |
54 | 54 | => this.InitializeComponent(); |
@@ -73,7 +73,7 @@ namespace OpenTween | ||
73 | 73 | /// <summary> |
74 | 74 | /// 振り分けルール (<see cref="MyCommon.TabUsageType.UserDefined"/> で使用) |
75 | 75 | /// </summary> |
76 | - public PostFilterRule[] FilterArray { get; set; } = new PostFilterRule[0]; | |
76 | + public PostFilterRule[] FilterArray { get; set; } = Array.Empty<PostFilterRule>(); | |
77 | 77 | |
78 | 78 | /// <summary> |
79 | 79 | /// 表示するユーザーのスクリーンネーム (<see cref="MyCommon.TabUsageType.UserTimeline"/> で使用) |
@@ -66,8 +66,8 @@ namespace OpenTween | ||
66 | 66 | |
67 | 67 | private ShortcutCommand() |
68 | 68 | { |
69 | - this.Shortcuts = new Keys[0]; | |
70 | - this.command = () => Task.FromResult(0); | |
69 | + this.Shortcuts = Array.Empty<Keys>(); | |
70 | + this.command = () => Task.CompletedTask; | |
71 | 71 | this.onlyWhen = () => true; |
72 | 72 | this.FocusedOn = FocusedControl.None; |
73 | 73 | this.NotFocusedOn = FocusedControl.None; |
@@ -166,14 +166,11 @@ namespace OpenTween | ||
166 | 166 | return this.instance; |
167 | 167 | } |
168 | 168 | |
169 | - /// <summary>何もしないタスク</summary> | |
170 | - private static Task noOpTask = Task.FromResult(0); | |
171 | - | |
172 | 169 | /// <summary> |
173 | 170 | /// Action を Func<Task> に変換します |
174 | 171 | /// </summary> |
175 | 172 | private static Func<Task> SynchronousTask(Action action) |
176 | - => () => { action(); return noOpTask; }; | |
173 | + => () => { action(); return Task.CompletedTask; }; | |
177 | 174 | } |
178 | 175 | } |
179 | 176 | } |
@@ -97,7 +97,7 @@ namespace OpenTween.Thumbnail.Services | ||
97 | 97 | |
98 | 98 | var item = xElm.XPathSelectElement("/response/posts/item[1]"); |
99 | 99 | if (item == null) |
100 | - return new ThumbnailInfo[0]; | |
100 | + return Array.Empty<ThumbnailInfo>(); | |
101 | 101 | |
102 | 102 | var postUrlElm = item.Element("post_url"); |
103 | 103 |
@@ -169,7 +169,7 @@ namespace OpenTween | ||
169 | 169 | private int _hisIdx; //発言履歴カレントインデックス |
170 | 170 | |
171 | 171 | //発言投稿時のAPI引数(発言編集時に設定。手書きreplyでは設定されない) |
172 | - private Tuple<long, string> inReplyTo = null; // リプライ先のステータスID・スクリーン名 | |
172 | + private (long StatusId, string ScreenName)? inReplyTo = null; // リプライ先のステータスID・スクリーン名 | |
173 | 173 | |
174 | 174 | //時速表示用 |
175 | 175 | private List<DateTimeUtc> _postTimestamps = new List<DateTimeUtc>(); |
@@ -304,7 +304,7 @@ namespace OpenTween | ||
304 | 304 | } |
305 | 305 | |
306 | 306 | 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)>(); //ポスト選択履歴 | |
308 | 308 | |
309 | 309 | //検索処理タイプ |
310 | 310 | internal enum SEARCHTYPE |
@@ -317,18 +317,16 @@ namespace OpenTween | ||
317 | 317 | private class StatusTextHistory |
318 | 318 | { |
319 | 319 | public string status = ""; |
320 | - public long? inReplyToId = null; | |
321 | - public string inReplyToName = null; | |
320 | + public (long StatusId, string ScreenName)? inReplyTo = null; | |
322 | 321 | public string imageService = ""; //画像投稿サービス名 |
323 | 322 | public IMediaItem[] mediaItems = null; |
324 | 323 | public StatusTextHistory() |
325 | 324 | { |
326 | 325 | } |
327 | - public StatusTextHistory(string status, long? replyToId, string replyToName) | |
326 | + public StatusTextHistory(string status, (long StatusId, string ScreenName)? inReplyTo) | |
328 | 327 | { |
329 | 328 | this.status = status; |
330 | - this.inReplyToId = replyToId; | |
331 | - this.inReplyToName = replyToName; | |
329 | + this.inReplyTo = inReplyTo; | |
332 | 330 | } |
333 | 331 | } |
334 | 332 |
@@ -1578,7 +1576,7 @@ namespace OpenTween | ||
1578 | 1576 | { |
1579 | 1577 | return new ListViewSelection |
1580 | 1578 | { |
1581 | - SelectedStatusIds = new long[0], | |
1579 | + SelectedStatusIds = Array.Empty<long>(), | |
1582 | 1580 | SelectionMarkStatusId = null, |
1583 | 1581 | FocusedStatusId = null, |
1584 | 1582 | }; |
@@ -2065,10 +2063,10 @@ namespace OpenTween | ||
2065 | 2063 | else if (TargetPost.IsReply) |
2066 | 2064 | //自分宛返信 |
2067 | 2065 | cl = _clAtSelf; |
2068 | - else if (BasePost.ReplyToList.Any(x => x.Item1 == TargetPost.UserId)) | |
2066 | + else if (BasePost.ReplyToList.Any(x => x.UserId == TargetPost.UserId)) | |
2069 | 2067 | //返信先 |
2070 | 2068 | cl = _clAtFromTarget; |
2071 | - else if (TargetPost.ReplyToList.Any(x => x.Item1 == BasePost.UserId)) | |
2069 | + else if (TargetPost.ReplyToList.Any(x => x.UserId == BasePost.UserId)) | |
2072 | 2070 | //その人への返信 |
2073 | 2071 | cl = _clAtTarget; |
2074 | 2072 | else if (TargetPost.ScreenName.Equals(BasePost.ScreenName, StringComparison.OrdinalIgnoreCase)) |
@@ -2118,9 +2116,7 @@ namespace OpenTween | ||
2118 | 2116 | return; |
2119 | 2117 | } |
2120 | 2118 | |
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); | |
2124 | 2120 | |
2125 | 2121 | if (SettingManager.Common.Nicoms) |
2126 | 2122 | { |
@@ -2148,24 +2144,24 @@ namespace OpenTween | ||
2148 | 2144 | // auto_populate_reply_metadata や attachment_url を使用しなくても 140 字以内に |
2149 | 2145 | // 収まる場合はこれらのオプションを使用せずに投稿する |
2150 | 2146 | status.Text = statusTextCompat; |
2151 | - status.InReplyToStatusId = this.inReplyTo?.Item1; | |
2147 | + status.InReplyToStatusId = this.inReplyTo?.StatusId; | |
2152 | 2148 | } |
2153 | 2149 | else |
2154 | 2150 | { |
2155 | 2151 | 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; | |
2157 | 2153 | |
2158 | 2154 | status.AttachmentUrl = attachmentUrl; |
2159 | 2155 | |
2160 | 2156 | // リプライ先がセットされていても autoPopulatedUserIds が空の場合は auto_populate_reply_metadata を有効にしない |
2161 | 2157 | // (非公式 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; | |
2163 | 2159 | if (replyToPost != null && autoPopulatedUserIds.Length != 0) |
2164 | 2160 | { |
2165 | 2161 | status.AutoPopulateReplyMetadata = true; |
2166 | 2162 | |
2167 | 2163 | // 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) | |
2169 | 2165 | .ToArray(); |
2170 | 2166 | } |
2171 | 2167 | } |
@@ -4566,7 +4562,7 @@ namespace OpenTween | ||
4566 | 4562 | { |
4567 | 4563 | List<long> _autoPopulatedUserIds = new List<long>(); |
4568 | 4564 | |
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; | |
4570 | 4566 | if (replyToPost != null) |
4571 | 4567 | { |
4572 | 4568 | if (statusText.StartsWith($"@{replyToPost.ScreenName} ", StringComparison.Ordinal)) |
@@ -4574,12 +4570,12 @@ namespace OpenTween | ||
4574 | 4570 | statusText = statusText.Substring(replyToPost.ScreenName.Length + 2); |
4575 | 4571 | _autoPopulatedUserIds.Add(replyToPost.UserId); |
4576 | 4572 | |
4577 | - foreach (var reply in replyToPost.ReplyToList) | |
4573 | + foreach (var (userId, screenName) in replyToPost.ReplyToList) | |
4578 | 4574 | { |
4579 | - if (statusText.StartsWith($"@{reply.Item2} ", StringComparison.Ordinal)) | |
4575 | + if (statusText.StartsWith($"@{screenName} ", StringComparison.Ordinal)) | |
4580 | 4576 | { |
4581 | - statusText = statusText.Substring(reply.Item2.Length + 2); | |
4582 | - _autoPopulatedUserIds.Add(reply.Item1); | |
4577 | + statusText = statusText.Substring(screenName.Length + 2); | |
4578 | + _autoPopulatedUserIds.Add(userId); | |
4583 | 4579 | } |
4584 | 4580 | } |
4585 | 4581 | } |
@@ -4669,7 +4665,7 @@ namespace OpenTween | ||
4669 | 4665 | disableFooter = true; |
4670 | 4666 | |
4671 | 4667 | // 自分宛のリプライの場合は先頭の「@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) | |
4673 | 4669 | { |
4674 | 4670 | var mentionSelf = $"@{this.tw.Username} "; |
4675 | 4671 | if (statusText.StartsWith(mentionSelf, StringComparison.OrdinalIgnoreCase)) |
@@ -5716,7 +5712,7 @@ namespace OpenTween | ||
5716 | 5712 | } |
5717 | 5713 | } |
5718 | 5714 | |
5719 | - private ShortcutCommand[] shortcutCommands = new ShortcutCommand[0]; | |
5715 | + private ShortcutCommand[] shortcutCommands = Array.Empty<ShortcutCommand>(); | |
5720 | 5716 | |
5721 | 5717 | private void InitializeShortcuts() |
5722 | 5718 | { |
@@ -5965,19 +5961,13 @@ namespace OpenTween | ||
5965 | 5961 | .FocusedOn(FocusedControl.StatusText) |
5966 | 5962 | .Do(() => { |
5967 | 5963 | 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 | + | |
5973 | 5966 | _hisIdx -= 1; |
5974 | 5967 | if (_hisIdx < 0) _hisIdx = 0; |
5975 | 5968 | |
5976 | 5969 | 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; | |
5981 | 5971 | StatusText.Text = historyItem.status; |
5982 | 5972 | StatusText.SelectionStart = StatusText.Text.Length; |
5983 | 5973 | }), |
@@ -5986,19 +5976,13 @@ namespace OpenTween | ||
5986 | 5976 | .FocusedOn(FocusedControl.StatusText) |
5987 | 5977 | .Do(() => { |
5988 | 5978 | 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 | + | |
5994 | 5981 | _hisIdx += 1; |
5995 | 5982 | if (_hisIdx > _history.Count - 1) _hisIdx = _history.Count - 1; |
5996 | 5983 | |
5997 | 5984 | 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; | |
6002 | 5986 | StatusText.Text = historyItem.status; |
6003 | 5987 | StatusText.SelectionStart = StatusText.Text.Length; |
6004 | 5988 | }), |
@@ -6602,10 +6586,10 @@ namespace OpenTween | ||
6602 | 6586 | post.RetweetedBy == _anchorPost.ScreenName || |
6603 | 6587 | post.ScreenName == _anchorPost.RetweetedBy || |
6604 | 6588 | (!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)) | |
6609 | 6593 | { |
6610 | 6594 | SelectListItem(_curList, idx); |
6611 | 6595 | _curList.EnsureVisible(idx); |
@@ -6983,7 +6967,7 @@ namespace OpenTween | ||
6983 | 6967 | private void TrimPostChain() |
6984 | 6968 | { |
6985 | 6969 | if (this.selectPostChains.Count <= 2000) return; |
6986 | - var p = new Stack<ValueTuple<TabPage, PostClass>>(2000); | |
6970 | + var p = new Stack<(TabPage, PostClass)>(2000); | |
6987 | 6971 | for (int i = 0; i < 2000; i++) |
6988 | 6972 | { |
6989 | 6973 | p.Push(this.selectPostChains.Pop()); |
@@ -7191,7 +7175,7 @@ namespace OpenTween | ||
7191 | 7175 | |
7192 | 7176 | var tabs = this.ListTab.TabPages.Cast<TabPage>() |
7193 | 7177 | .Select(x => this._statuses.Tabs[x.Text]) |
7194 | - .Concat(new[] { this._statuses.GetTabByType(MyCommon.TabUsageType.Mute) }); | |
7178 | + .Append(this._statuses.GetTabByType(MyCommon.TabUsageType.Mute)); | |
7195 | 7179 | |
7196 | 7180 | foreach (var tab in tabs) |
7197 | 7181 | { |
@@ -7510,7 +7494,7 @@ namespace OpenTween | ||
7510 | 7494 | //空の場合 |
7511 | 7495 | var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId; |
7512 | 7496 | var inReplyToScreenName = this._curPost.ScreenName; |
7513 | - this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName); | |
7497 | + this.inReplyTo = (inReplyToStatusId, inReplyToScreenName); | |
7514 | 7498 | |
7515 | 7499 | // ステータステキストが入力されていない場合先頭に@ユーザー名を追加する |
7516 | 7500 | StatusText.Text = "@" + _curPost.ScreenName + " "; |
@@ -7524,12 +7508,12 @@ namespace OpenTween | ||
7524 | 7508 | //1件選んでEnter or DoubleClick |
7525 | 7509 | if (StatusText.Text.Contains("@" + _curPost.ScreenName + " ")) |
7526 | 7510 | { |
7527 | - if (this.inReplyTo?.Item2 == _curPost.ScreenName) | |
7511 | + if (this.inReplyTo?.ScreenName == _curPost.ScreenName) | |
7528 | 7512 | { |
7529 | 7513 | //返信先書き換え |
7530 | 7514 | var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId; |
7531 | 7515 | var inReplyToScreenName = this._curPost.ScreenName; |
7532 | - this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName); | |
7516 | + this.inReplyTo = (inReplyToStatusId, inReplyToScreenName); | |
7533 | 7517 | } |
7534 | 7518 | return; |
7535 | 7519 | } |
@@ -7547,7 +7531,7 @@ namespace OpenTween | ||
7547 | 7531 | // 単独リプライ |
7548 | 7532 | var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId; |
7549 | 7533 | var inReplyToScreenName = this._curPost.ScreenName; |
7550 | - this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName); | |
7534 | + this.inReplyTo = (inReplyToStatusId, inReplyToScreenName); | |
7551 | 7535 | StatusText.Text = "@" + _curPost.ScreenName + " " + StatusText.Text; |
7552 | 7536 | } |
7553 | 7537 | } |
@@ -7640,16 +7624,16 @@ namespace OpenTween | ||
7640 | 7624 | } |
7641 | 7625 | if (isAll) |
7642 | 7626 | { |
7643 | - foreach (string nm in post.ReplyToList.Select(x => x.Item2)) | |
7627 | + foreach (var (_, screenName) in post.ReplyToList) | |
7644 | 7628 | { |
7645 | - if (!ids.Contains("@" + nm + " ") && | |
7646 | - !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase)) | |
7629 | + if (!ids.Contains("@" + screenName + " ") && | |
7630 | + !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase)) | |
7647 | 7631 | { |
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); | |
7649 | 7633 | if (m.Success) |
7650 | 7634 | ids += "@" + m.Result("${id}") + " "; |
7651 | 7635 | else |
7652 | - ids += "@" + nm + " "; | |
7636 | + ids += "@" + screenName + " "; | |
7653 | 7637 | } |
7654 | 7638 | } |
7655 | 7639 | } |
@@ -7695,16 +7679,16 @@ namespace OpenTween | ||
7695 | 7679 | { |
7696 | 7680 | ids += "@" + post.ScreenName + " "; |
7697 | 7681 | } |
7698 | - foreach (string nm in post.ReplyToList.Select(x => x.Item2)) | |
7682 | + foreach (var (_, screenName) in post.ReplyToList) | |
7699 | 7683 | { |
7700 | - if (!ids.Contains("@" + nm + " ") && | |
7701 | - !nm.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase)) | |
7684 | + if (!ids.Contains("@" + screenName + " ") && | |
7685 | + !screenName.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase)) | |
7702 | 7686 | { |
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); | |
7704 | 7688 | if (m.Success) |
7705 | 7689 | ids += "@" + m.Result("${id}") + " "; |
7706 | 7690 | else |
7707 | - ids += "@" + nm + " "; | |
7691 | + ids += "@" + screenName + " "; | |
7708 | 7692 | } |
7709 | 7693 | } |
7710 | 7694 | if (!string.IsNullOrEmpty(post.RetweetedBy)) |
@@ -7720,7 +7704,7 @@ namespace OpenTween | ||
7720 | 7704 | //未入力の場合のみ返信先付加 |
7721 | 7705 | var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId; |
7722 | 7706 | var inReplyToScreenName = this._curPost.ScreenName; |
7723 | - this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName); | |
7707 | + this.inReplyTo = (inReplyToStatusId, inReplyToScreenName); | |
7724 | 7708 | |
7725 | 7709 | StatusText.Text = ids; |
7726 | 7710 | StatusText.SelectionStart = ids.Length; |
@@ -8896,7 +8880,7 @@ namespace OpenTween | ||
8896 | 8880 | |
8897 | 8881 | if (m != null) |
8898 | 8882 | { |
8899 | - var inReplyToScreenName = this.inReplyTo.Item2; | |
8883 | + var inReplyToScreenName = this.inReplyTo.Value.ScreenName; | |
8900 | 8884 | if (StatusText.StartsWith("@", StringComparison.Ordinal)) |
8901 | 8885 | { |
8902 | 8886 | if (StatusText.StartsWith("@" + inReplyToScreenName, StringComparison.Ordinal)) return; |
@@ -10461,7 +10445,7 @@ namespace OpenTween | ||
10461 | 10445 | // 投稿時に in_reply_to_status_id を付加する |
10462 | 10446 | var inReplyToStatusId = this._curPost.RetweetedId ?? this._curPost.StatusId; |
10463 | 10447 | var inReplyToScreenName = this._curPost.ScreenName; |
10464 | - this.inReplyTo = Tuple.Create(inReplyToStatusId, inReplyToScreenName); | |
10448 | + this.inReplyTo = (inReplyToStatusId, inReplyToScreenName); | |
10465 | 10449 | |
10466 | 10450 | StatusText.Text += " RT @" + _curPost.ScreenName + ": " + rtdata; |
10467 | 10451 |
@@ -148,7 +148,7 @@ namespace OpenTween | ||
148 | 148 | sb.AppendFormat("IsRead : {0}<br>", post.IsRead); |
149 | 149 | sb.AppendFormat("IsReply : {0}<br>", post.IsReply); |
150 | 150 | |
151 | - foreach (string nm in post.ReplyToList.Select(x => x.Item2)) | |
151 | + foreach (string nm in post.ReplyToList.Select(x => x.ScreenName)) | |
152 | 152 | { |
153 | 153 | sb.AppendFormat("ReplyToList : {0}<br>", nm); |
154 | 154 | } |
@@ -159,7 +159,7 @@ namespace OpenTween | ||
159 | 159 | delegate void GetIconImageDelegate(PostClass post); |
160 | 160 | private readonly object LockObj = new object(); |
161 | 161 | private ISet<long> followerId = new HashSet<long>(); |
162 | - private long[] noRTId = new long[0]; | |
162 | + private long[] noRTId = Array.Empty<long>(); | |
163 | 163 | |
164 | 164 | //プロパティからアクセスされる共通情報 |
165 | 165 | private List<string> _hashList = new List<string>(); |
@@ -806,7 +806,7 @@ namespace OpenTween | ||
806 | 806 | post.Source = string.Intern(sourceText); |
807 | 807 | post.SourceUri = sourceUri; |
808 | 808 | |
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); | |
810 | 810 | post.IsExcludeReply = false; |
811 | 811 | |
812 | 812 | if (post.IsMe) |
@@ -830,7 +830,7 @@ namespace OpenTween | ||
830 | 830 | var urls = entities.OfType<TwitterEntityUrl>().Select(x => x.ExpandedUrl); |
831 | 831 | |
832 | 832 | if (quotedStatusLink != null) |
833 | - urls = urls.Concat(new[] { quotedStatusLink.Expanded }); | |
833 | + urls = urls.Append(quotedStatusLink.Expanded); | |
834 | 834 | |
835 | 835 | return GetQuoteTweetStatusIds(urls); |
836 | 836 | } |
@@ -1457,7 +1457,7 @@ namespace OpenTween | ||
1457 | 1457 | if (MyCommon._endingFlag) return; |
1458 | 1458 | |
1459 | 1459 | var cursor = -1L; |
1460 | - var newFollowerIds = new HashSet<long>(); | |
1460 | + var newFollowerIds = Enumerable.Empty<long>(); | |
1461 | 1461 | do |
1462 | 1462 | { |
1463 | 1463 | var ret = await this.Api.FollowersIds(cursor) |
@@ -1466,11 +1466,11 @@ namespace OpenTween | ||
1466 | 1466 | if (ret.Ids == null) |
1467 | 1467 | throw new WebApiException("ret.ids == null"); |
1468 | 1468 | |
1469 | - newFollowerIds.UnionWith(ret.Ids); | |
1469 | + newFollowerIds = newFollowerIds.Concat(ret.Ids); | |
1470 | 1470 | cursor = ret.NextCursor; |
1471 | 1471 | } while (cursor != 0); |
1472 | 1472 | |
1473 | - this.followerId = newFollowerIds; | |
1473 | + this.followerId = newFollowerIds.ToHashSet(); | |
1474 | 1474 | TabInformations.GetInstance().RefreshOwl(this.followerId); |
1475 | 1475 | |
1476 | 1476 | this.GetFollowersSuccess = true; |
@@ -1587,7 +1587,7 @@ namespace OpenTween | ||
1587 | 1587 | } |
1588 | 1588 | } |
1589 | 1589 | |
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) | |
1591 | 1591 | { |
1592 | 1592 | if (entities != null) |
1593 | 1593 | { |
@@ -1602,7 +1602,7 @@ namespace OpenTween | ||
1602 | 1602 | { |
1603 | 1603 | foreach (var ent in entities.UserMentions) |
1604 | 1604 | { |
1605 | - AtList.Add(Tuple.Create(ent.Id, ent.ScreenName)); | |
1605 | + AtList.Add((ent.Id, ent.ScreenName)); | |
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | if (entities.Media != null) |
@@ -1712,19 +1712,20 @@ namespace OpenTween | ||
1712 | 1712 | if (MyCommon._endingFlag) return; |
1713 | 1713 | |
1714 | 1714 | var cursor = -1L; |
1715 | - var newBlockIds = new HashSet<long>(); | |
1715 | + var newBlockIds = Enumerable.Empty<long>(); | |
1716 | 1716 | do |
1717 | 1717 | { |
1718 | 1718 | var ret = await this.Api.BlocksIds(cursor) |
1719 | 1719 | .ConfigureAwait(false); |
1720 | 1720 | |
1721 | - newBlockIds.UnionWith(ret.Ids); | |
1721 | + newBlockIds = newBlockIds.Concat(ret.Ids); | |
1722 | 1722 | cursor = ret.NextCursor; |
1723 | 1723 | } while (cursor != 0); |
1724 | 1724 | |
1725 | - newBlockIds.Remove(this.UserId); // 元のソースにあったので一応残しておく | |
1725 | + var blockIdsSet = newBlockIds.ToHashSet(); | |
1726 | + blockIdsSet.Remove(this.UserId); // 元のソースにあったので一応残しておく | |
1726 | 1727 | |
1727 | - TabInformations.GetInstance().BlockIds = newBlockIds; | |
1728 | + TabInformations.GetInstance().BlockIds = blockIdsSet; | |
1728 | 1729 | } |
1729 | 1730 | |
1730 | 1731 | /// <summary> |
@@ -1738,7 +1739,7 @@ namespace OpenTween | ||
1738 | 1739 | var ids = await TwitterIds.GetAllItemsAsync(x => this.Api.MutesUsersIds(x)) |
1739 | 1740 | .ConfigureAwait(false); |
1740 | 1741 | |
1741 | - TabInformations.GetInstance().MuteUserIds = new HashSet<long>(ids); | |
1742 | + TabInformations.GetInstance().MuteUserIds = ids.ToHashSet(); | |
1742 | 1743 | } |
1743 | 1744 | |
1744 | 1745 | public string[] GetHashList() |
@@ -1,19 +1,19 @@ | ||
1 | 1 | <?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"> | |
3 | 3 | <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> |
4 | 4 | <security> |
5 | 5 | <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> |
6 | 6 | <!-- UAC マニフェスト オプション |
7 | - Windows のユーザー アカウント制御のレベルを変更するには、 | |
8 | - requestedExecutionLevel ノードを以下のいずれかで置換します。 | |
7 | + Windows のユーザー アカウント制御のレベルを変更するには、 | |
8 | + requestedExecutionLevel ノードを以下のいずれかで置換します。 | |
9 | 9 | |
10 | 10 | <requestedExecutionLevel level="asInvoker" uiAccess="false" /> |
11 | 11 | <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> |
12 | 12 | <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> |
13 | 13 | |
14 | - requestedExecutionLevel ノードを指定すると、ファイルおよびレジストリの仮想化は無効になります。 | |
15 | - 旧バージョンとの互換性のためにファイルおよびレジストリの仮想化を | |
16 | - 使用する場合は、requestedExecutionLevel ノードを削除します。 | |
14 | + requestedExecutionLevel 要素を指定すると、ファイルおよびレジストリの仮想化が無効にされます。 | |
15 | + アプリケーションが下位互換性を保つためにこの仮想化を要求する場合、この要素を | |
16 | + 削除します。 | |
17 | 17 | --> |
18 | 18 | <requestedExecutionLevel level="asInvoker" uiAccess="false" /> |
19 | 19 | </requestedPrivileges> |
@@ -22,8 +22,9 @@ | ||
22 | 22 | |
23 | 23 | <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> |
24 | 24 | <application> |
25 | - <!--このアプリケーションが動作するように設計されている、Windows のすべてのバージョンの一覧。 | |
26 | - Windows は最も互換性の高い環境を自動的に選択します。--> | |
25 | + <!-- このアプリケーションがテストされ、協働するようテストされた Windows バージョンの | |
26 | + 一覧。適切な要素をコメント解除すると、最も互換性のある環境を Windows が | |
27 | + 自動的に選択します。--> | |
27 | 28 | |
28 | 29 | <!-- Windows 7 --> |
29 | 30 | <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> |
@@ -39,6 +40,16 @@ | ||
39 | 40 | </application> |
40 | 41 | </compatibility> |
41 | 42 | |
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 | + | |
42 | 53 | <!-- Windows のコモン コントロールとダイアログのテーマを有効にします (Windows XP 以降) --> |
43 | 54 | <!-- <dependency> |
44 | 55 | <dependentAssembly> |
@@ -53,11 +64,4 @@ | ||
53 | 64 | </dependentAssembly> |
54 | 65 | </dependency>--> |
55 | 66 | |
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> |