From 476f68a26e6af759fa62dd65abbd19407d7aefaa Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Mon, 28 Feb 2022 05:13:28 +0900 Subject: [PATCH] =?utf8?q?=E8=AD=98=E5=88=A5=E5=AD=90=E3=82=92PascalCase?= =?utf8?q?=E3=81=AB=E3=81=99=E3=82=8B=20(SA1300,=20SA1303,=20SA1307,=20SA1?= =?utf8?q?309,=20SA1311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween.Tests/Api/TwitterApiTest.cs | 106 ++++++------ .../Connection/TwitterApiConnectionTest.cs | 24 +-- OpenTween.Tests/DebounceTimerTest.cs | 18 +- OpenTween.Tests/LRUCacheDictionaryTest.cs | 70 ++++---- OpenTween.Tests/Models/PostClassTest.cs | 6 +- OpenTween.Tests/Models/TabInformationTest.cs | 2 +- OpenTween.Tests/MyCommonTest.cs | 2 +- OpenTween.Tests/TabsDialogTest.cs | 2 +- OpenTween.Tests/TestUtils.cs | 12 +- OpenTween.Tests/ThrottleTimerTest.cs | 10 +- OpenTween.Tests/TimelineScheduerTest.cs | 14 +- OpenTween.Tests/ToolStripAPIGaugeTest.cs | 28 ++-- OpenTween.Tests/TweetThumbnailTest.cs | 50 +++--- OpenTween/Api/BitlyApi.cs | 6 +- OpenTween/Api/TwitterApi.cs | 8 +- OpenTween/AppendSettingDialog.cs | 14 +- OpenTween/ApplicationEvents.cs | 10 +- OpenTween/AtIdSupplement.cs | 14 +- OpenTween/Connection/TwitterApiConnection.cs | 38 ++--- OpenTween/DetailsListView.cs | 8 +- OpenTween/FilterDialog.Designer.cs | 2 +- OpenTween/FilterDialog.cs | 2 +- OpenTween/HashtagManage.cs | 6 +- OpenTween/ImageCache.cs | 20 +-- OpenTween/InputDialog.Designer.cs | 4 +- OpenTween/InputDialog.cs | 4 +- OpenTween/LRUCacheDictionary.cs | 76 ++++----- OpenTween/LoginDialog.Designer.cs | 2 +- OpenTween/LoginDialog.cs | 2 +- OpenTween/Models/TabInformations.cs | 4 +- OpenTween/MyCommon.cs | 8 +- OpenTween/{nicoms.cs => Nicoms.cs} | 6 +- OpenTween/OpenTween.csproj | 2 +- OpenTween/SearchWordDialog.Designer.cs | 10 +- OpenTween/SearchWordDialog.cs | 10 +- OpenTween/SendErrorReportForm.Designer.cs | 8 +- OpenTween/SendErrorReportForm.cs | 8 +- OpenTween/Setting/Panel/FontPanel.Designer.cs | 16 +- OpenTween/Setting/Panel/FontPanel.cs | 16 +- OpenTween/Setting/Panel/FontPanel2.Designer.cs | 18 +- OpenTween/Setting/Panel/FontPanel2.cs | 18 +- OpenTween/Setting/SettingBase.cs | 10 +- OpenTween/ShortUrl.cs | 6 +- OpenTween/Thumbnail/Services/FoursquareCheckin.cs | 6 +- OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs | 4 +- .../Thumbnail/Services/MetaThumbnailService.cs | 4 +- OpenTween/Thumbnail/Services/Tinami.cs | 4 +- OpenTween/Thumbnail/Services/Tumblr.cs | 4 +- OpenTween/Thumbnail/Services/Vimeo.cs | 4 +- OpenTween/ToolStripAPIGauge.cs | 22 +-- OpenTween/Tween.Designer.cs | 8 +- OpenTween/Tween.cs | 184 ++++++++++----------- OpenTween/TweetDetailsView.cs | 10 +- OpenTween/TweetExtractor.cs | 8 +- OpenTween/TweetFormatter.cs | 24 +-- OpenTween/TweetThumbnail.Designer.cs | 12 +- OpenTween/TweetThumbnail.cs | 42 ++--- OpenTween/Twitter.cs | 66 ++++---- OpenTween/UserInfo.cs | 2 - OpenTween/UserInfoDialog.cs | 4 +- 60 files changed, 553 insertions(+), 555 deletions(-) rename OpenTween/{nicoms.cs => Nicoms.cs} (96%) diff --git a/OpenTween.Tests/Api/TwitterApiTest.cs b/OpenTween.Tests/Api/TwitterApiTest.cs index 125b754e..52961966 100644 --- a/OpenTween.Tests/Api/TwitterApiTest.cs +++ b/OpenTween.Tests/Api/TwitterApiTest.cs @@ -52,13 +52,13 @@ namespace OpenTween.Api public void Initialize_Test() { using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - Assert.Null(twitterApi.apiConnection); + Assert.Null(twitterApi.ApiConnection); twitterApi.Initialize("*** AccessToken ***", "*** AccessSecret ***", userId: 100L, screenName: "hogehoge"); - Assert.IsType(twitterApi.apiConnection); + Assert.IsType(twitterApi.ApiConnection); - var apiConnection = (TwitterApiConnection)twitterApi.apiConnection!; + var apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!; Assert.Equal("*** AccessToken ***", apiConnection.AccessToken); Assert.Equal("*** AccessSecret ***", apiConnection.AccessSecret); @@ -71,9 +71,9 @@ namespace OpenTween.Api var oldApiConnection = apiConnection; Assert.True(oldApiConnection.IsDisposed); - Assert.IsType(twitterApi.apiConnection); + Assert.IsType(twitterApi.ApiConnection); - apiConnection = (TwitterApiConnection)twitterApi.apiConnection!; + apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!; Assert.Equal("*** AccessToken2 ***", apiConnection.AccessToken); Assert.Equal("*** AccessSecret2 ***", apiConnection.AccessSecret); @@ -101,7 +101,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesHomeTimeline(200, maxId: 900L, sinceId: 100L) .ConfigureAwait(false); @@ -129,7 +129,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesMentionsTimeline(200, maxId: 900L, sinceId: 100L) .ConfigureAwait(false); @@ -159,7 +159,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesUserTimeline("twitterapi", count: 200, maxId: 900L, sinceId: 100L) .ConfigureAwait(false); @@ -185,7 +185,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterStatus { Id = 100L }); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesShow(statusId: 100L) .ConfigureAwait(false); @@ -215,7 +215,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesUpdate( "hogehoge", @@ -249,7 +249,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesUpdate("hogehoge", replyToId: null, mediaIds: null, excludeReplyUserIds: Array.Empty()) .IgnoreResponse() @@ -270,7 +270,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L })); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesDestroy(statusId: 100L) .IgnoreResponse() @@ -296,7 +296,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.StatusesRetweet(100L) .IgnoreResponse() @@ -328,7 +328,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterSearchResult()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.SearchTweets("from:twitterapi", "en", count: 200, maxId: 900L, sinceId: 100L) .ConfigureAwait(false); @@ -353,7 +353,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterLists()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsOwnerships("twitterapi", cursor: -1L, count: 100) .ConfigureAwait(false); @@ -378,7 +378,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterLists()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsSubscriptions("twitterapi", cursor: -1L, count: 100) .ConfigureAwait(false); @@ -404,7 +404,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterLists()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsMemberships("twitterapi", cursor: -1L, count: 100, filterToOwnedLists: true) .ConfigureAwait(false); @@ -428,7 +428,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterList())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsCreate("hogehoge", description: "aaaa", @private: true) .IgnoreResponse() @@ -454,7 +454,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterList())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsUpdate(12345L, name: "hogehoge", description: "aaaa", @private: true) .IgnoreResponse() @@ -477,7 +477,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterList())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsDestroy(12345L) .IgnoreResponse() @@ -508,7 +508,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsStatuses(12345L, count: 200, maxId: 900L, sinceId: 100L, includeRTs: true) .ConfigureAwait(false); @@ -535,7 +535,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterUsers()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsMembers(12345L, cursor: -1) .ConfigureAwait(false); @@ -562,7 +562,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterUser()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsMembersShow(12345L, "twitterapi") .ConfigureAwait(false); @@ -588,7 +588,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsMembersCreate(12345L, "twitterapi") .IgnoreResponse() @@ -615,7 +615,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ListsMembersDestroy(12345L, "twitterapi") .IgnoreResponse() @@ -640,7 +640,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterMessageEventList()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.DirectMessagesEventsList(count: 50, cursor: "12345abcdefg") .ConfigureAwait(false); @@ -679,7 +679,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterMessageEventSingle())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.DirectMessagesEventsNew(recipientId: 12345L, text: "hogehoge", mediaId: 67890L) .ConfigureAwait(false); @@ -698,7 +698,7 @@ namespace OpenTween.Api .Returns(Task.CompletedTask); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.DirectMessagesEventsDestroy(eventId: "100") .ConfigureAwait(false); @@ -724,7 +724,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterUser { ScreenName = "twitterapi" }); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.UsersShow(screenName: "twitterapi") .ConfigureAwait(false); @@ -750,7 +750,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.UsersLookup(userIds: new[] { "11111", "22222" }) .ConfigureAwait(false); @@ -773,7 +773,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser { ScreenName = "twitterapi" })); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.UsersReportSpam(screenName: "twitterapi") .IgnoreResponse() @@ -802,7 +802,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FavoritesList(200, maxId: 900L, sinceId: 100L) .ConfigureAwait(false); @@ -825,7 +825,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L })); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FavoritesCreate(statusId: 100L) .IgnoreResponse() @@ -849,7 +849,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterStatus { Id = 100L })); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FavoritesDestroy(statusId: 100L) .IgnoreResponse() @@ -871,7 +871,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterFriendship()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FriendshipsShow(sourceScreenName: "twitter", targetScreenName: "twitterapi") .ConfigureAwait(false); @@ -891,7 +891,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterFriendship())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FriendshipsCreate(screenName: "twitterapi") .IgnoreResponse() @@ -912,7 +912,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterFriendship())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FriendshipsDestroy(screenName: "twitterapi") .IgnoreResponse() @@ -934,7 +934,7 @@ namespace OpenTween.Api .ReturnsAsync(Array.Empty()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.NoRetweetIds() .ConfigureAwait(false); @@ -955,7 +955,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterIds()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.FollowersIds(cursor: -1L) .ConfigureAwait(false); @@ -976,7 +976,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterIds()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MutesUsersIds(cursor: -1L) .ConfigureAwait(false); @@ -997,7 +997,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterIds()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.BlocksIds(cursor: -1L) .ConfigureAwait(false); @@ -1020,7 +1020,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.BlocksCreate(screenName: "twitterapi") .IgnoreResponse() @@ -1044,7 +1044,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.BlocksDestroy(screenName: "twitterapi") .IgnoreResponse() @@ -1074,7 +1074,7 @@ namespace OpenTween.Api }); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.AccountVerifyCredentials() .ConfigureAwait(false); @@ -1105,7 +1105,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.AccountUpdateProfile(name: "Name", url: "http://example.com/", location: "Location", description: "") .IgnoreResponse() @@ -1133,7 +1133,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUser())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.AccountUpdateProfileImage(media) .IgnoreResponse() @@ -1155,7 +1155,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterRateLimits()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.ApplicationRateLimitStatus() .ConfigureAwait(false); @@ -1176,7 +1176,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterConfiguration()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.Configuration() .ConfigureAwait(false); @@ -1201,7 +1201,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUploadMediaInit())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MediaUploadInit(totalBytes: 123456L, mediaType: "image/png", mediaCategory: "dm_image") .IgnoreResponse() @@ -1229,7 +1229,7 @@ namespace OpenTween.Api .Returns(Task.CompletedTask); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MediaUploadAppend(mediaId: 11111L, segmentIndex: 1, media: media) .ConfigureAwait(false); @@ -1252,7 +1252,7 @@ namespace OpenTween.Api .ReturnsAsync(LazyJson.Create(new TwitterUploadMediaResult())); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MediaUploadFinalize(mediaId: 11111L) .IgnoreResponse() @@ -1277,7 +1277,7 @@ namespace OpenTween.Api .ReturnsAsync(new TwitterUploadMediaResult()); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MediaUploadStatus(mediaId: 11111L) .ConfigureAwait(false); @@ -1297,7 +1297,7 @@ namespace OpenTween.Api .Returns(Task.CompletedTask); using var twitterApi = new TwitterApi(ApiKey.Create("fake_consumer_key"), ApiKey.Create("fake_consumer_secret")); - twitterApi.apiConnection = mock.Object; + twitterApi.ApiConnection = mock.Object; await twitterApi.MediaMetadataCreate(mediaId: 12345L, altText: "hogehoge") .ConfigureAwait(false); diff --git a/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs b/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs index e6da5724..8f840e8e 100644 --- a/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs +++ b/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs @@ -57,7 +57,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -96,7 +96,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -134,7 +134,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -175,7 +175,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -203,7 +203,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -234,7 +234,7 @@ namespace OpenTween.Connection using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); using var image = TestUtils.CreateDummyImage(); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { @@ -280,7 +280,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(async x => { @@ -322,7 +322,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.httpUpload = http; + apiConnection.HttpUpload = http; using var image = TestUtils.CreateDummyImage(); using var media = new MemoryImageMediaItem(image); @@ -393,7 +393,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.httpUpload = http; + apiConnection.HttpUpload = http; mockHandler.Enqueue(async x => { @@ -439,7 +439,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(async x => { @@ -471,7 +471,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(async x => { @@ -511,7 +511,7 @@ namespace OpenTween.Connection using var mockHandler = new HttpMessageHandlerMock(); using var http = new HttpClient(mockHandler); using var apiConnection = new TwitterApiConnection(ApiKey.Create(""), ApiKey.Create(""), "", ""); - apiConnection.http = http; + apiConnection.Http = http; mockHandler.Enqueue(x => { diff --git a/OpenTween.Tests/DebounceTimerTest.cs b/OpenTween.Tests/DebounceTimerTest.cs index 6949084b..188e1b0b 100644 --- a/OpenTween.Tests/DebounceTimerTest.cs +++ b/OpenTween.Tests/DebounceTimerTest.cs @@ -32,7 +32,7 @@ namespace OpenTween { private class TestDebounceTimer : DebounceTimer { - public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask); + public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask); public TestDebounceTimer(Func timerCallback, TimeSpan interval, bool leading, bool trailing) : base(timerCallback, interval, leading, trailing) @@ -40,7 +40,7 @@ namespace OpenTween } protected override ITimer CreateTimer(Func callback) - => this.mockTimer = new MockTimer(callback); + => this.MockTimer = new MockTimer(callback); } [Fact] @@ -58,7 +58,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: false, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -113,7 +113,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: false, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -151,7 +151,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: false, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -205,7 +205,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: true, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -260,7 +260,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: true, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -298,7 +298,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: true, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -369,7 +369,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.MaxValue; using var debouncing = new TestDebounceTimer(callback, interval, leading: false, trailing: true); - var mockTimer = debouncing.mockTimer; + var mockTimer = debouncing.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); diff --git a/OpenTween.Tests/LRUCacheDictionaryTest.cs b/OpenTween.Tests/LRUCacheDictionaryTest.cs index 046d6b43..d9d56bd3 100644 --- a/OpenTween.Tests/LRUCacheDictionaryTest.cs +++ b/OpenTween.Tests/LRUCacheDictionaryTest.cs @@ -31,7 +31,7 @@ namespace OpenTween { public class LRUCacheDictionaryTest { - private static readonly AnyOrderComparer collComparer = AnyOrderComparer.Instance; + private static readonly AnyOrderComparer CollComparer = AnyOrderComparer.Instance; [Fact] public void InnerListTest() @@ -43,7 +43,7 @@ namespace OpenTween ["key3"] = "value3", }; - var node = dict.innerList.First; + var node = dict.InnerList.First; Assert.Equal("key3", node.Value.Key); node = node.Next; Assert.Equal("key2", node.Value.Key); @@ -56,7 +56,7 @@ namespace OpenTween _ = dict["key1"]; // 直近に参照した順で並んでいるかテスト - node = dict.innerList.First; + node = dict.InnerList.First; Assert.Equal("key1", node.Value.Key); node = node.Next; Assert.Equal("key3", node.Value.Key); @@ -140,7 +140,7 @@ namespace OpenTween dict["key4"] = "value4"; // 4アクセス目 (この直後にTrim) // 1 -> 2 -> 3 -> 4 の順にアクセスしたため、直近 3 件の 2, 3, 4 だけが残る - Assert.Equal(new[] { "key2", "key3", "key4" }, dict.innerDict.Keys, collComparer); + Assert.Equal(new[] { "key2", "key3", "key4" }, dict.InnerDict.Keys, CollComparer); dict["key5"] = "value5"; // 5アクセス目 dict.Add("key6", "value6"); // 6アクセス目 @@ -148,7 +148,7 @@ namespace OpenTween dict.TryGetValue("key4", out _); // 8アクセス目 (この直後にTrim) // 5 -> 6 -> 2 -> 4 の順でアクセスしたため、直近 3 件の 6, 2, 4 だけが残る - Assert.Equal(new[] { "key6", "key2", "key4" }, dict.innerDict.Keys, collComparer); + Assert.Equal(new[] { "key6", "key2", "key4" }, dict.InnerDict.Keys, CollComparer); } [Fact] @@ -170,7 +170,7 @@ namespace OpenTween dict.Trim(); // 直近に参照された 3, 4 以外のアイテムに対してイベントが発生しているはず - Assert.Equal(new[] { "key1", "key2" }, removedList, collComparer); + Assert.Equal(new[] { "key1", "key2" }, removedList, CollComparer); } // ここから下は IDictionary としての機能が正しく動作するかのテスト @@ -182,17 +182,17 @@ namespace OpenTween dict.Add("key1", "value1"); - Assert.Single(dict.innerDict); - Assert.True(dict.innerDict.ContainsKey("key1")); - var internalNode = dict.innerDict["key1"]; + Assert.Single(dict.InnerDict); + Assert.True(dict.InnerDict.ContainsKey("key1")); + var internalNode = dict.InnerDict["key1"]; Assert.Equal("key1", internalNode.Value.Key); Assert.Equal("value1", internalNode.Value.Value); dict.Add("key2", "value2"); - Assert.Equal(2, dict.innerDict.Count); - Assert.True(dict.innerDict.ContainsKey("key2")); - internalNode = dict.innerDict["key2"]; + Assert.Equal(2, dict.InnerDict.Count); + Assert.True(dict.InnerDict.ContainsKey("key2")); + internalNode = dict.InnerDict["key2"]; Assert.Equal("key2", internalNode.Value.Key); Assert.Equal("value2", internalNode.Value.Value); } @@ -242,17 +242,17 @@ namespace OpenTween var ret = dict.Remove("key1"); Assert.True(ret); - Assert.Equal(2, dict.innerDict.Count); - Assert.Equal(2, dict.innerList.Count); - Assert.False(dict.innerDict.ContainsKey("key1")); - Assert.True(dict.innerDict.ContainsKey("key2")); - Assert.True(dict.innerDict.ContainsKey("key3")); + Assert.Equal(2, dict.InnerDict.Count); + Assert.Equal(2, dict.InnerList.Count); + Assert.False(dict.InnerDict.ContainsKey("key1")); + Assert.True(dict.InnerDict.ContainsKey("key2")); + Assert.True(dict.InnerDict.ContainsKey("key3")); dict.Remove("key2"); dict.Remove("key3"); - Assert.Empty(dict.innerDict); - Assert.Empty(dict.innerList); + Assert.Empty(dict.InnerDict); + Assert.Empty(dict.InnerList); ret = dict.Remove("hogehoge"); Assert.False(ret); @@ -271,11 +271,11 @@ namespace OpenTween var ret = dict.Remove(new KeyValuePair("key1", "value1")); Assert.True(ret); - Assert.Equal(2, dict.innerDict.Count); - Assert.Equal(2, dict.innerList.Count); - Assert.False(dict.innerDict.ContainsKey("key1")); - Assert.True(dict.innerDict.ContainsKey("key2")); - Assert.True(dict.innerDict.ContainsKey("key3")); + Assert.Equal(2, dict.InnerDict.Count); + Assert.Equal(2, dict.InnerList.Count); + Assert.False(dict.InnerDict.ContainsKey("key1")); + Assert.True(dict.InnerDict.ContainsKey("key2")); + Assert.True(dict.InnerDict.ContainsKey("key3")); ret = dict.Remove(new KeyValuePair("key2", "hogehoge")); Assert.False(ret); @@ -283,8 +283,8 @@ namespace OpenTween dict.Remove(new KeyValuePair("key2", "value2")); dict.Remove(new KeyValuePair("key3", "value3")); - Assert.Empty(dict.innerDict); - Assert.Empty(dict.innerList); + Assert.Empty(dict.InnerDict); + Assert.Empty(dict.InnerList); ret = dict.Remove(new KeyValuePair("hogehoge", "hogehoge")); Assert.False(ret); @@ -318,11 +318,11 @@ namespace OpenTween }; dict["key1"] = "foo"; - Assert.Equal("foo", dict.innerDict["key1"].Value.Value); + Assert.Equal("foo", dict.InnerDict["key1"].Value.Value); dict["hogehoge"] = "bar"; - Assert.True(dict.innerDict.ContainsKey("hogehoge")); - Assert.Equal("bar", dict.innerDict["hogehoge"].Value.Value); + Assert.True(dict.InnerDict.ContainsKey("hogehoge")); + Assert.Equal("bar", dict.InnerDict["hogehoge"].Value.Value); } [Fact] @@ -354,13 +354,13 @@ namespace OpenTween ["key3"] = "value3", }; - Assert.Equal(new[] { "key1", "key2", "key3" }, dict.Keys, collComparer); + Assert.Equal(new[] { "key1", "key2", "key3" }, dict.Keys, CollComparer); dict.Add("foo", "bar"); - Assert.Equal(new[] { "key1", "key2", "key3", "foo" }, dict.Keys, collComparer); + Assert.Equal(new[] { "key1", "key2", "key3", "foo" }, dict.Keys, CollComparer); dict.Remove("key2"); - Assert.Equal(new[] { "key1", "key3", "foo" }, dict.Keys, collComparer); + Assert.Equal(new[] { "key1", "key3", "foo" }, dict.Keys, CollComparer); dict.Clear(); Assert.Empty(dict.Keys); @@ -376,13 +376,13 @@ namespace OpenTween ["key3"] = "value3", }; - Assert.Equal(new[] { "value1", "value2", "value3" }, dict.Values, collComparer); + Assert.Equal(new[] { "value1", "value2", "value3" }, dict.Values, CollComparer); dict.Add("foo", "bar"); - Assert.Equal(new[] { "value1", "value2", "value3", "bar" }, dict.Values, collComparer); + Assert.Equal(new[] { "value1", "value2", "value3", "bar" }, dict.Values, CollComparer); dict.Remove("key2"); - Assert.Equal(new[] { "value1", "value3", "bar" }, dict.Values, collComparer); + Assert.Equal(new[] { "value1", "value3", "bar" }, dict.Values, CollComparer); dict.Clear(); Assert.Empty(dict.Values); diff --git a/OpenTween.Tests/Models/PostClassTest.cs b/OpenTween.Tests/Models/PostClassTest.cs index a29340b7..94bf93d0 100644 --- a/OpenTween.Tests/Models/PostClassTest.cs +++ b/OpenTween.Tests/Models/PostClassTest.cs @@ -399,7 +399,7 @@ namespace OpenTween.Models class FakeExpandedUrlInfo : PostClass.ExpandedUrlInfo { - public TaskCompletionSource fakeResult = new TaskCompletionSource(); + public TaskCompletionSource FakeResult = new TaskCompletionSource(); public FakeExpandedUrlInfo(string url, string expandedUrl, bool deepExpand) : base(url, expandedUrl, deepExpand) @@ -407,7 +407,7 @@ namespace OpenTween.Models } protected override async Task DeepExpandAsync() - => this._expandedUrl = await this.fakeResult.Task; + => this._expandedUrl = await this.FakeResult.Task; } [Fact] @@ -442,7 +442,7 @@ namespace OpenTween.Models Assert.Equal("bit.ly/abcde", post.Text); // bit.ly 展開後の URL は「http://example.com/abcde」 - urlInfo.fakeResult.SetResult("http://example.com/abcde"); + urlInfo.FakeResult.SetResult("http://example.com/abcde"); await urlInfo.ExpandTask; // ExpandedUrlInfo による展開が完了した後の状態 diff --git a/OpenTween.Tests/Models/TabInformationTest.cs b/OpenTween.Tests/Models/TabInformationTest.cs index 8d1259f2..63142f26 100644 --- a/OpenTween.Tests/Models/TabInformationTest.cs +++ b/OpenTween.Tests/Models/TabInformationTest.cs @@ -38,7 +38,7 @@ namespace OpenTween.Models this.tabinfo = this.CreateInstance(); // TabInformation.GetInstance() で取得できるようにする - var field = typeof(TabInformations).GetField("_instance", + var field = typeof(TabInformations).GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.SetField); field.SetValue(null, this.tabinfo); diff --git a/OpenTween.Tests/MyCommonTest.cs b/OpenTween.Tests/MyCommonTest.cs index 66e1118b..55fed128 100644 --- a/OpenTween.Tests/MyCommonTest.cs +++ b/OpenTween.Tests/MyCommonTest.cs @@ -155,7 +155,7 @@ namespace OpenTween [InlineData(Keys.Control | Keys.Alt, new[] { Keys.Control, Keys.Alt }, true)] [InlineData(Keys.Control | Keys.Alt, new[] { Keys.Shift }, false)] public void IsKeyDownTest(Keys modifierKeys, Keys[] checkKeys, bool expected) - => Assert.Equal(expected, MyCommon._IsKeyDown(modifierKeys, checkKeys)); + => Assert.Equal(expected, MyCommon.IsKeyDownInternal(modifierKeys, checkKeys)); [Fact] public void GetAssemblyNameTest() diff --git a/OpenTween.Tests/TabsDialogTest.cs b/OpenTween.Tests/TabsDialogTest.cs index 0b3ca539..429c6902 100644 --- a/OpenTween.Tests/TabsDialogTest.cs +++ b/OpenTween.Tests/TabsDialogTest.cs @@ -47,7 +47,7 @@ namespace OpenTween this.tabinfo.AddTab(new FilterTabModel("MyTab1")); // 一応 TabInformation.GetInstance() でも取得できるようにする - var field = typeof(TabInformations).GetField("_instance", + var field = typeof(TabInformations).GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.SetField); field.SetValue(null, this.tabinfo); } diff --git a/OpenTween.Tests/TestUtils.cs b/OpenTween.Tests/TestUtils.cs index c43e95c5..cbb9e363 100644 --- a/OpenTween.Tests/TestUtils.cs +++ b/OpenTween.Tests/TestUtils.cs @@ -59,12 +59,12 @@ namespace OpenTween { T? raisedEvent = null; - void handler(object s, T e) + void Handler(object s, T e) => raisedEvent = e; try { - attach(handler); + attach(Handler); await testCode().ConfigureAwait(false); if (raisedEvent != null) @@ -72,13 +72,13 @@ namespace OpenTween } finally { - detach(handler); + detach(Handler); } } public static void NotPropertyChanged(INotifyPropertyChanged @object, string propertyName, Action testCode) { - void handler(object s, PropertyChangedEventArgs e) + void Handler(object s, PropertyChangedEventArgs e) { if (s == @object && e.PropertyName == propertyName) throw new Xunit.Sdk.PropertyChangedException(propertyName); @@ -86,12 +86,12 @@ namespace OpenTween try { - @object.PropertyChanged += handler; + @object.PropertyChanged += Handler; testCode(); } finally { - @object.PropertyChanged -= handler; + @object.PropertyChanged -= Handler; } } diff --git a/OpenTween.Tests/ThrottleTimerTest.cs b/OpenTween.Tests/ThrottleTimerTest.cs index 66a51226..695416be 100644 --- a/OpenTween.Tests/ThrottleTimerTest.cs +++ b/OpenTween.Tests/ThrottleTimerTest.cs @@ -33,7 +33,7 @@ namespace OpenTween { private class TestThrottleTimer : ThrottleTimer { - public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask); + public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask); public TestThrottleTimer(Func timerCallback, TimeSpan interval) : base(timerCallback, interval) @@ -41,7 +41,7 @@ namespace OpenTween } protected override ITimer CreateTimer(Func callback) - => this.mockTimer = new MockTimer(callback); + => this.MockTimer = new MockTimer(callback); } [Fact] @@ -59,7 +59,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.FromMinutes(2); using var throttling = new TestThrottleTimer(callback, interval); - var mockTimer = throttling.mockTimer; + var mockTimer = throttling.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -114,7 +114,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.FromMinutes(2); using var throttling = new TestThrottleTimer(callback, interval); - var mockTimer = throttling.mockTimer; + var mockTimer = throttling.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); @@ -152,7 +152,7 @@ namespace OpenTween var interval = TimeSpan.FromMinutes(2); var maxWait = TimeSpan.FromMinutes(2); using var throttling = new TestThrottleTimer(callback, interval); - var mockTimer = throttling.mockTimer; + var mockTimer = throttling.MockTimer; Assert.Equal(0, count); Assert.False(mockTimer.IsTimerRunning); diff --git a/OpenTween.Tests/TimelineScheduerTest.cs b/OpenTween.Tests/TimelineScheduerTest.cs index 087f9ddf..e6bba7fd 100644 --- a/OpenTween.Tests/TimelineScheduerTest.cs +++ b/OpenTween.Tests/TimelineScheduerTest.cs @@ -32,7 +32,7 @@ namespace OpenTween { private class TestTimelineScheduler : TimelineScheduler { - public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask); + public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask); public TestTimelineScheduler() : base() @@ -40,7 +40,7 @@ namespace OpenTween } protected override ITimer CreateTimer(Func callback) - => this.mockTimer = new MockTimer(callback); + => this.MockTimer = new MockTimer(callback); } [Fact] @@ -49,7 +49,7 @@ namespace OpenTween using (TestUtils.FreezeTime(new DateTimeUtc(2022, 1, 1, 0, 0, 0))) { using var scheduler = new TestTimelineScheduler(); - var mockTimer = scheduler.mockTimer; + var mockTimer = scheduler.MockTimer; Assert.False(mockTimer.IsTimerRunning); @@ -80,7 +80,7 @@ namespace OpenTween using (TestUtils.FreezeTime(new DateTimeUtc(2022, 1, 1, 0, 0, 0))) { using var scheduler = new TestTimelineScheduler(); - var mockTimer = scheduler.mockTimer; + var mockTimer = scheduler.MockTimer; Assert.False(mockTimer.IsTimerRunning); @@ -125,7 +125,7 @@ namespace OpenTween using (TestUtils.FreezeTime(new DateTimeUtc(2022, 1, 1, 0, 0, 0))) { using var scheduler = new TestTimelineScheduler(); - var mockTimer = scheduler.mockTimer; + var mockTimer = scheduler.MockTimer; scheduler.Enabled = true; Assert.False(mockTimer.IsTimerRunning); @@ -145,7 +145,7 @@ namespace OpenTween using (TestUtils.FreezeTime(new DateTimeUtc(2022, 1, 1, 0, 0, 0))) { using var scheduler = new TestTimelineScheduler(); - var mockTimer = scheduler.mockTimer; + var mockTimer = scheduler.MockTimer; scheduler.Enabled = true; Assert.False(mockTimer.IsTimerRunning); @@ -161,7 +161,7 @@ namespace OpenTween using (TestUtils.FreezeTime(new DateTimeUtc(2022, 1, 1, 0, 0, 0))) { using var scheduler = new TestTimelineScheduler(); - var mockTimer = scheduler.mockTimer; + var mockTimer = scheduler.MockTimer; scheduler.Enabled = true; Assert.False(mockTimer.IsTimerRunning); diff --git a/OpenTween.Tests/ToolStripAPIGaugeTest.cs b/OpenTween.Tests/ToolStripAPIGaugeTest.cs index 983967a6..c8535b70 100644 --- a/OpenTween.Tests/ToolStripAPIGaugeTest.cs +++ b/OpenTween.Tests/ToolStripAPIGaugeTest.cs @@ -91,18 +91,18 @@ namespace OpenTween toolStrip.GaugeHeight = 5; - Assert.Equal(new Rectangle(0, 0, 100, 5), toolStrip.apiGaugeBounds); - Assert.Equal(new Rectangle(0, 5, 100, 5), toolStrip.timeGaugeBounds); + Assert.Equal(new Rectangle(0, 0, 100, 5), toolStrip.ApiGaugeBounds); + Assert.Equal(new Rectangle(0, 5, 100, 5), toolStrip.TimeGaugeBounds); toolStrip.GaugeHeight = 3; - Assert.Equal(new Rectangle(0, 2, 100, 3), toolStrip.apiGaugeBounds); - Assert.Equal(new Rectangle(0, 5, 100, 3), toolStrip.timeGaugeBounds); + Assert.Equal(new Rectangle(0, 2, 100, 3), toolStrip.ApiGaugeBounds); + Assert.Equal(new Rectangle(0, 5, 100, 3), toolStrip.TimeGaugeBounds); toolStrip.GaugeHeight = 0; - Assert.Equal(Rectangle.Empty, toolStrip.apiGaugeBounds); - Assert.Equal(Rectangle.Empty, toolStrip.timeGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.ApiGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.TimeGaugeBounds); MyCommon.TwitterApiInfo.AccessLimit.Clear(); } @@ -186,19 +186,19 @@ namespace OpenTween // toolStrip.ApiEndpoint の初期値は null - Assert.Equal(Rectangle.Empty, toolStrip.apiGaugeBounds); - Assert.Equal(Rectangle.Empty, toolStrip.timeGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.ApiGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.TimeGaugeBounds); MyCommon.TwitterApiInfo.AccessLimit["endpoint"] = new ApiLimit(150, 60, now + TimeSpan.FromMinutes(3)); toolStrip.ApiEndpoint = "endpoint"; - Assert.Equal(new Rectangle(0, 0, 40, 5), toolStrip.apiGaugeBounds); // 40% (60/150) - Assert.Equal(new Rectangle(0, 5, 20, 5), toolStrip.timeGaugeBounds); // 20% (3/15) + Assert.Equal(new Rectangle(0, 0, 40, 5), toolStrip.ApiGaugeBounds); // 40% (60/150) + Assert.Equal(new Rectangle(0, 5, 20, 5), toolStrip.TimeGaugeBounds); // 20% (3/15) toolStrip.ApiEndpoint = ""; - Assert.Equal(Rectangle.Empty, toolStrip.apiGaugeBounds); - Assert.Equal(Rectangle.Empty, toolStrip.timeGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.ApiGaugeBounds); + Assert.Equal(Rectangle.Empty, toolStrip.TimeGaugeBounds); MyCommon.TwitterApiInfo.AccessLimit.Clear(); } @@ -223,8 +223,8 @@ namespace OpenTween ); toolStrip.ApiEndpoint = "/statuses/user_timeline"; - Assert.Equal(new Rectangle(0, 0, 99, 5), toolStrip.apiGaugeBounds); // 99% (999999999/1000000000) - Assert.Equal(new Rectangle(0, 5, 100, 5), toolStrip.timeGaugeBounds); // 100% (15/15) + Assert.Equal(new Rectangle(0, 0, 99, 5), toolStrip.ApiGaugeBounds); // 99% (999999999/1000000000) + Assert.Equal(new Rectangle(0, 5, 100, 5), toolStrip.TimeGaugeBounds); // 100% (15/15) Assert.Equal("API 999999999/1000000000", toolStrip.Text); Assert.Equal("API rest /statuses/user_timeline 999999999/1000000000" + Environment.NewLine + "(reset after 15 minutes)", toolStrip.ToolTipText); diff --git a/OpenTween.Tests/TweetThumbnailTest.cs b/OpenTween.Tests/TweetThumbnailTest.cs index 0af40799..4aefa50e 100644 --- a/OpenTween.Tests/TweetThumbnailTest.cs +++ b/OpenTween.Tests/TweetThumbnailTest.cs @@ -157,16 +157,16 @@ namespace OpenTween var method = typeof(TweetThumbnail).GetMethod("SetThumbnailCount", BindingFlags.Instance | BindingFlags.NonPublic); method.Invoke(thumbbox, new[] { (object)count }); - Assert.Equal(count, thumbbox.pictureBox.Count); + Assert.Equal(count, thumbbox.PictureBox.Count); var num = 0; - foreach (var picbox in thumbbox.pictureBox) + foreach (var picbox in thumbbox.PictureBox) { Assert.Equal("pictureBox" + num, picbox.Name); num++; } - Assert.Equal(thumbbox.pictureBox, thumbbox.panelPictureBox.Controls.Cast()); + Assert.Equal(thumbbox.PictureBox, thumbbox.panelPictureBox.Controls.Cast()); Assert.Equal(0, thumbbox.scrollBar.Minimum); @@ -197,16 +197,16 @@ namespace OpenTween Assert.Equal(0, thumbbox.scrollBar.Maximum); Assert.False(thumbbox.scrollBar.Enabled); - Assert.Single(thumbbox.pictureBox); - Assert.NotNull(thumbbox.pictureBox[0].Image); + Assert.Single(thumbbox.PictureBox); + Assert.NotNull(thumbbox.PictureBox[0].Image); - Assert.IsAssignableFrom(thumbbox.pictureBox[0].Tag); - var thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[0].Tag; + Assert.IsAssignableFrom(thumbbox.PictureBox[0].Tag); + var thumbinfo = (ThumbnailInfo)thumbbox.PictureBox[0].Tag; Assert.Equal("http://foo.example.com/abcd", thumbinfo.MediaPageUrl); Assert.Equal("http://img.example.com/abcd.png", thumbinfo.ThumbnailImageUrl); - Assert.Equal("", thumbbox.toolTip.GetToolTip(thumbbox.pictureBox[0])); + Assert.Equal("", thumbbox.toolTip.GetToolTip(thumbbox.PictureBox[0])); } } @@ -231,24 +231,24 @@ namespace OpenTween Assert.Equal(1, thumbbox.scrollBar.Maximum); Assert.True(thumbbox.scrollBar.Enabled); - Assert.Equal(2, thumbbox.pictureBox.Count); - Assert.NotNull(thumbbox.pictureBox[0].Image); - Assert.NotNull(thumbbox.pictureBox[1].Image); + Assert.Equal(2, thumbbox.PictureBox.Count); + Assert.NotNull(thumbbox.PictureBox[0].Image); + Assert.NotNull(thumbbox.PictureBox[1].Image); - Assert.IsAssignableFrom(thumbbox.pictureBox[0].Tag); - var thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[0].Tag; + Assert.IsAssignableFrom(thumbbox.PictureBox[0].Tag); + var thumbinfo = (ThumbnailInfo)thumbbox.PictureBox[0].Tag; Assert.Equal("http://foo.example.com/abcd", thumbinfo.MediaPageUrl); Assert.Equal("http://img.example.com/abcd.png", thumbinfo.ThumbnailImageUrl); - Assert.IsAssignableFrom(thumbbox.pictureBox[1].Tag); - thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[1].Tag; + Assert.IsAssignableFrom(thumbbox.PictureBox[1].Tag); + thumbinfo = (ThumbnailInfo)thumbbox.PictureBox[1].Tag; Assert.Equal("http://bar.example.com/efgh", thumbinfo.MediaPageUrl); Assert.Equal("http://img.example.com/efgh.png", thumbinfo.ThumbnailImageUrl); - Assert.Equal("", thumbbox.toolTip.GetToolTip(thumbbox.pictureBox[0])); - Assert.Equal("efgh", thumbbox.toolTip.GetToolTip(thumbbox.pictureBox[1])); + Assert.Equal("", thumbbox.toolTip.GetToolTip(thumbbox.PictureBox[0])); + Assert.Equal("efgh", thumbbox.toolTip.GetToolTip(thumbbox.PictureBox[1])); } } @@ -316,23 +316,23 @@ namespace OpenTween thumbbox.ScrollDown(); Assert.Equal(1, thumbbox.scrollBar.Value); - Assert.False(thumbbox.pictureBox[0].Visible); - Assert.True(thumbbox.pictureBox[1].Visible); + Assert.False(thumbbox.PictureBox[0].Visible); + Assert.True(thumbbox.PictureBox[1].Visible); thumbbox.ScrollDown(); Assert.Equal(1, thumbbox.scrollBar.Value); - Assert.False(thumbbox.pictureBox[0].Visible); - Assert.True(thumbbox.pictureBox[1].Visible); + Assert.False(thumbbox.PictureBox[0].Visible); + Assert.True(thumbbox.PictureBox[1].Visible); thumbbox.ScrollUp(); Assert.Equal(0, thumbbox.scrollBar.Value); - Assert.True(thumbbox.pictureBox[0].Visible); - Assert.False(thumbbox.pictureBox[1].Visible); + Assert.True(thumbbox.PictureBox[0].Visible); + Assert.False(thumbbox.PictureBox[1].Visible); thumbbox.ScrollUp(); Assert.Equal(0, thumbbox.scrollBar.Value); - Assert.True(thumbbox.pictureBox[0].Visible); - Assert.False(thumbbox.pictureBox[1].Visible); + Assert.True(thumbbox.PictureBox[0].Visible); + Assert.False(thumbbox.PictureBox[1].Visible); } } } diff --git a/OpenTween/Api/BitlyApi.cs b/OpenTween/Api/BitlyApi.cs index 8ec9dc03..49dc727d 100644 --- a/OpenTween/Api/BitlyApi.cs +++ b/OpenTween/Api/BitlyApi.cs @@ -48,7 +48,7 @@ namespace OpenTween.Api private readonly ApiKey clientId; private readonly ApiKey clientSecret; - private HttpClient http => this.localHttpClient ?? Networking.Http; + private HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly HttpClient? localHttpClient; public BitlyApi() @@ -90,7 +90,7 @@ namespace OpenTween.Api var requestUri = new Uri(new Uri(ApiBase, endpoint), "?" + MyCommon.BuildQueryString(paramWithToken)); using var request = new HttpRequestMessage(HttpMethod.Get, requestUri); - using var response = await this.http.SendAsync(request) + using var response = await this.Http.SendAsync(request) .ConfigureAwait(false); return await response.Content.ReadAsStringAsync() @@ -121,7 +121,7 @@ namespace OpenTween.Api request.Content = postContent; - using var response = await this.http.SendAsync(request) + using var response = await this.Http.SendAsync(request) .ConfigureAwait(false); var responseBytes = await response.Content.ReadAsByteArrayAsync() .ConfigureAwait(false); diff --git a/OpenTween/Api/TwitterApi.cs b/OpenTween/Api/TwitterApi.cs index 8dcdc196..2c2bda10 100644 --- a/OpenTween/Api/TwitterApi.cs +++ b/OpenTween/Api/TwitterApi.cs @@ -38,9 +38,9 @@ namespace OpenTween.Api public long CurrentUserId { get; private set; } public string CurrentScreenName { get; private set; } = ""; - public IApiConnection Connection => this.apiConnection ?? throw new InvalidOperationException(); + public IApiConnection Connection => this.ApiConnection ?? throw new InvalidOperationException(); - internal IApiConnection? apiConnection; + internal IApiConnection? ApiConnection; private readonly ApiKey consumerKey; private readonly ApiKey consumerSecret; @@ -54,7 +54,7 @@ namespace OpenTween.Api public void Initialize(string accessToken, string accessSecret, long userId, string screenName) { var newInstance = new TwitterApiConnection(this.consumerKey, this.consumerSecret, accessToken, accessSecret); - var oldInstance = Interlocked.Exchange(ref this.apiConnection, newInstance); + var oldInstance = Interlocked.Exchange(ref this.ApiConnection, newInstance); oldInstance?.Dispose(); this.CurrentUserId = userId; @@ -788,6 +788,6 @@ namespace OpenTween.Api => ((TwitterApiConnection)this.Connection).CreateOAuthEchoHandler(authServiceProvider, realm); public void Dispose() - => this.apiConnection?.Dispose(); + => this.ApiConnection?.Dispose(); } } diff --git a/OpenTween/AppendSettingDialog.cs b/OpenTween/AppendSettingDialog.cs index cbeb0cc4..b6afa618 100644 --- a/OpenTween/AppendSettingDialog.cs +++ b/OpenTween/AppendSettingDialog.cs @@ -50,8 +50,8 @@ namespace OpenTween { public event EventHandler? IntervalChanged; - internal Twitter tw = null!; - internal TwitterApi twitterApi = null!; + internal Twitter Tw = null!; + internal TwitterApi TwitterApi = null!; public AppendSettingDialog() { @@ -83,7 +83,7 @@ namespace OpenTween this.ConnectionPanel.LoadConfig(settingCommon); this.NotifyPanel.LoadConfig(settingCommon); - var activeUser = settingCommon.UserAccounts.FirstOrDefault(x => x.UserId == this.tw.UserId); + var activeUser = settingCommon.UserAccounts.FirstOrDefault(x => x.UserId == this.Tw.UserId); if (activeUser != null) { this.BasedPanel.AuthUserCombo.SelectedItem = activeUser; @@ -112,12 +112,12 @@ namespace OpenTween if (userAccountIdx != -1) { var u = settingCommon.UserAccounts[userAccountIdx]; - this.tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId); + this.Tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId); } else { - this.tw.ClearAuthInfo(); - this.tw.Initialize("", "", "", 0); + this.Tw.ClearAuthInfo(); + this.Tw.Initialize("", "", "", 0); } } @@ -141,7 +141,7 @@ namespace OpenTween private void Setting_FormClosing(object sender, FormClosingEventArgs e) { - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; if (this.BasedPanel.AuthUserCombo.SelectedIndex == -1 && e.CloseReason == CloseReason.None) { diff --git a/OpenTween/ApplicationEvents.cs b/OpenTween/ApplicationEvents.cs index 58307025..e7ff30a6 100644 --- a/OpenTween/ApplicationEvents.cs +++ b/OpenTween/ApplicationEvents.cs @@ -84,7 +84,7 @@ namespace OpenTween { // 同じ設定ファイルを使用する OpenTween プロセスの二重起動を防止する - var pt = MyCommon.settingPath.Replace("\\", "/") + "/" + ApplicationSettings.AssemblyName; + var pt = MyCommon.SettingPath.Replace("\\", "/") + "/" + ApplicationSettings.AssemblyName; using var mt = new Mutex(false, pt); if (!mt.WaitOne(0, false)) @@ -307,12 +307,12 @@ namespace OpenTween return false; } - MyCommon.settingPath = Path.GetFullPath(configDir); + MyCommon.SettingPath = Path.GetFullPath(configDir); } else { // OpenTween.exe と同じディレクトリに設定ファイルを配置する - MyCommon.settingPath = Application.StartupPath; + MyCommon.SettingPath = Application.StartupPath; SettingManager.LoadAll(); @@ -333,7 +333,7 @@ namespace OpenTween }); Directory.CreateDirectory(roamingDir); - MyCommon.settingPath = roamingDir; + MyCommon.SettingPath = roamingDir; /* * 書き込みが制限されたディレクトリ内で起動された場合の設定ファイルの扱い @@ -370,7 +370,7 @@ namespace OpenTween if (startupDirFile.Exists) { // StartupPath に設定ファイルが存在し、Roaming 内のファイルよりも新しい場合のみ警告を表示する - var message = string.Format(Properties.Resources.SettingPath_Relocation, Application.StartupPath, MyCommon.settingPath); + var message = string.Format(Properties.Resources.SettingPath_Relocation, Application.StartupPath, MyCommon.SettingPath); MessageBox.Show(message, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information); } diff --git a/OpenTween/AtIdSupplement.cs b/OpenTween/AtIdSupplement.cs index cbeac658..28258117 100644 --- a/OpenTween/AtIdSupplement.cs +++ b/OpenTween/AtIdSupplement.cs @@ -41,8 +41,8 @@ namespace OpenTween { public string StartsWith { get; set; } = ""; - public string inputText = ""; - public bool isBack = false; + public string InputText { get; set; } = ""; + private bool isBack = false; private readonly string startChar = ""; public void AddItem(string id) @@ -76,13 +76,13 @@ namespace OpenTween private void ButtonOK_Click(object sender, EventArgs e) { - this.inputText = this.TextId.Text; + this.InputText = this.TextId.Text; this.isBack = false; } private void ButtonCancel_Click(object sender, EventArgs e) { - this.inputText = ""; + this.InputText = ""; this.isBack = false; } @@ -90,13 +90,13 @@ namespace OpenTween { if (e.KeyCode == Keys.Back && MyCommon.IsNullOrEmpty(this.TextId.Text)) { - this.inputText = ""; + this.InputText = ""; this.isBack = true; this.Close(); } else if (e.KeyCode == Keys.Space || e.KeyCode == Keys.Tab) { - this.inputText = this.TextId.Text + " "; + this.InputText = this.TextId.Text + " "; this.isBack = false; this.Close(); } @@ -152,7 +152,7 @@ namespace OpenTween { if (e.KeyCode == Keys.Tab) { - this.inputText = this.TextId.Text + " "; + this.InputText = this.TextId.Text + " "; this.isBack = false; this.Close(); } diff --git a/OpenTween/Connection/TwitterApiConnection.cs b/OpenTween/Connection/TwitterApiConnection.cs index 59b479d1..bb5c988c 100644 --- a/OpenTween/Connection/TwitterApiConnection.cs +++ b/OpenTween/Connection/TwitterApiConnection.cs @@ -54,9 +54,9 @@ namespace OpenTween.Connection public string AccessToken { get; } public string AccessSecret { get; } - internal HttpClient http = null!; - internal HttpClient httpUpload = null!; - internal HttpClient httpStreaming = null!; + internal HttpClient Http = null!; + internal HttpClient HttpUpload = null!; + internal HttpClient HttpStreaming = null!; private readonly ApiKey consumerKey; private readonly ApiKey consumerSecret; @@ -74,13 +74,13 @@ namespace OpenTween.Connection private void InitializeHttpClients() { - this.http = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret); + this.Http = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret); - this.httpUpload = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret); - this.httpUpload.Timeout = Networking.UploadImageTimeout; + this.HttpUpload = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret); + this.HttpUpload.Timeout = Networking.UploadImageTimeout; - this.httpStreaming = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret, disableGzip: true); - this.httpStreaming.Timeout = Timeout.InfiniteTimeSpan; + this.HttpStreaming = InitializeHttpClient(this.consumerKey, this.consumerSecret, this.AccessToken, this.AccessSecret, disableGzip: true); + this.HttpStreaming.Timeout = Timeout.InfiniteTimeSpan; } public async Task GetAsync(Uri uri, IDictionary? param, string? endpointName) @@ -98,7 +98,7 @@ namespace OpenTween.Connection try { - using var response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + using var response = await this.Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); if (endpointName != null) @@ -161,7 +161,7 @@ namespace OpenTween.Connection try { - return await this.http.GetStreamAsync(requestUri) + return await this.Http.GetStreamAsync(requestUri) .ConfigureAwait(false); } catch (HttpRequestException ex) @@ -184,7 +184,7 @@ namespace OpenTween.Connection try { var request = new HttpRequestMessage(HttpMethod.Get, requestUri); - var response = await this.httpStreaming.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + var response = await this.HttpStreaming.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -214,7 +214,7 @@ namespace OpenTween.Connection HttpResponseMessage? response = null; try { - response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + response = await this.Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -261,7 +261,7 @@ namespace OpenTween.Connection HttpResponseMessage? response = null; try { - response = await this.httpUpload.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + response = await this.HttpUpload.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -307,7 +307,7 @@ namespace OpenTween.Connection try { - using var response = await this.httpUpload.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + using var response = await this.HttpUpload.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -339,7 +339,7 @@ namespace OpenTween.Connection HttpResponseMessage? response = null; try { - response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + response = await this.Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -371,7 +371,7 @@ namespace OpenTween.Connection try { - using var response = await this.http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) + using var response = await this.Http.SendAsync(request, HttpCompletionOption.ResponseHeadersRead) .ConfigureAwait(false); await this.CheckStatusCode(response) @@ -463,9 +463,9 @@ namespace OpenTween.Connection if (disposing) { Networking.WebProxyChanged -= this.Networking_WebProxyChanged; - this.http.Dispose(); - this.httpUpload.Dispose(); - this.httpStreaming.Dispose(); + this.Http.Dispose(); + this.HttpUpload.Dispose(); + this.HttpStreaming.Dispose(); } } diff --git a/OpenTween/DetailsListView.cs b/OpenTween/DetailsListView.cs index df4d0679..c6440d7b 100644 --- a/OpenTween/DetailsListView.cs +++ b/OpenTween/DetailsListView.cs @@ -163,9 +163,9 @@ namespace OpenTween.OpenTweenCustomControl [StructLayout(LayoutKind.Sequential)] private struct NMHDR { - public IntPtr hwndFrom; - public IntPtr idFrom; - public int code; + public IntPtr HwndFrom; + public IntPtr IdFrom; + public int Code; } [DebuggerStepThrough] @@ -231,7 +231,7 @@ namespace OpenTween.OpenTweenCustomControl var nmhdr = Marshal.PtrToStructure(m.LParam); // Ctrl+クリックで選択状態を変更した場合にイベントが発生しない問題への対処 - if (nmhdr.code == LVN_ODSTATECHANGED) + if (nmhdr.Code == LVN_ODSTATECHANGED) this.OnSelectedIndexChanged(EventArgs.Empty); break; } diff --git a/OpenTween/FilterDialog.Designer.cs b/OpenTween/FilterDialog.Designer.cs index 4bf426c0..43b54d59 100644 --- a/OpenTween/FilterDialog.Designer.cs +++ b/OpenTween/FilterDialog.Designer.cs @@ -382,7 +382,7 @@ resources.ApplyResources(this.buttonRuleToggleEnabled, "buttonRuleToggleEnabled"); this.buttonRuleToggleEnabled.Name = "buttonRuleToggleEnabled"; this.buttonRuleToggleEnabled.UseVisualStyleBackColor = true; - this.buttonRuleToggleEnabled.Click += new System.EventHandler(this.buttonRuleToggleEnabled_Click); + this.buttonRuleToggleEnabled.Click += new System.EventHandler(this.ButtonRuleToggleEnabled_Click); // // ListFilters // diff --git a/OpenTween/FilterDialog.cs b/OpenTween/FilterDialog.cs index ef373cbb..3f10a8f4 100644 --- a/OpenTween/FilterDialog.cs +++ b/OpenTween/FilterDialog.cs @@ -1223,7 +1223,7 @@ namespace OpenTween } } - private void buttonRuleToggleEnabled_Click(object sender, EventArgs e) + private void ButtonRuleToggleEnabled_Click(object sender, EventArgs e) { if (this.RuleEnableButtonMode == EnableButtonMode.NotSelected) return; diff --git a/OpenTween/HashtagManage.cs b/OpenTween/HashtagManage.cs index 56c129ea..bb12db0a 100644 --- a/OpenTween/HashtagManage.cs +++ b/OpenTween/HashtagManage.cs @@ -231,7 +231,7 @@ namespace OpenTween if (e.KeyChar == '#') { this._hashSupl.ShowDialog(); - if (!MyCommon.IsNullOrEmpty(this._hashSupl.inputText)) + if (!MyCommon.IsNullOrEmpty(this._hashSupl.InputText)) { var fHalf = ""; var eHalf = ""; @@ -244,8 +244,8 @@ namespace OpenTween { eHalf = this.UseHashText.Text.Substring(selStart); } - this.UseHashText.Text = fHalf + this._hashSupl.inputText + eHalf; - this.UseHashText.SelectionStart = selStart + this._hashSupl.inputText.Length; + this.UseHashText.Text = fHalf + this._hashSupl.InputText + eHalf; + this.UseHashText.SelectionStart = selStart + this._hashSupl.InputText.Length; } e.Handled = true; } diff --git a/OpenTween/ImageCache.cs b/OpenTween/ImageCache.cs index 3a43de96..738a7297 100644 --- a/OpenTween/ImageCache.cs +++ b/OpenTween/ImageCache.cs @@ -39,7 +39,7 @@ namespace OpenTween /// /// キャッシュとして URL と取得した画像を対に保持する辞書 /// - internal LRUCacheDictionary> innerDictionary; + internal LRUCacheDictionary> InnerDictionary; /// /// 非同期タスクをキャンセルするためのトークンのもと @@ -58,8 +58,8 @@ namespace OpenTween public ImageCache() { - this.innerDictionary = new LRUCacheDictionary>(trimLimit: 300, autoTrimCount: 100); - this.innerDictionary.CacheRemoved += (s, e) => { + this.InnerDictionary = new LRUCacheDictionary>(trimLimit: 300, autoTrimCount: 100); + this.InnerDictionary.CacheRemoved += (s, e) => { // まだ参照されている場合もあるのでDisposeはファイナライザ任せ this.CacheRemoveCount++; }; @@ -71,7 +71,7 @@ namespace OpenTween /// 保持しているキャッシュの件数 /// public long CacheCount - => this.innerDictionary.Count; + => this.InnerDictionary.Count; /// /// 破棄されたキャッシュの件数 @@ -92,12 +92,12 @@ namespace OpenTween { lock (this.lockObject) { - this.innerDictionary.TryGetValue(address, out var cachedImageTask); + this.InnerDictionary.TryGetValue(address, out var cachedImageTask); if (cachedImageTask != null) { if (force) - this.innerDictionary.Remove(address); + this.InnerDictionary.Remove(address); else return cachedImageTask; } @@ -105,7 +105,7 @@ namespace OpenTween cancelToken.ThrowIfCancellationRequested(); var imageTask = this.FetchImageAsync(address, cancelToken); - this.innerDictionary[address] = imageTask; + this.InnerDictionary[address] = imageTask; return imageTask; } @@ -131,7 +131,7 @@ namespace OpenTween { lock (this.lockObject) { - if (!this.innerDictionary.TryGetValue(address, out var imageTask) || + if (!this.InnerDictionary.TryGetValue(address, out var imageTask) || imageTask.Status != TaskStatus.RanToCompletion) return null; @@ -161,13 +161,13 @@ namespace OpenTween lock (this.lockObject) { - foreach (var (_, task) in this.innerDictionary) + foreach (var (_, task) in this.InnerDictionary) { if (task.Status == TaskStatus.RanToCompletion) task.Result?.Dispose(); } - this.innerDictionary.Clear(); + this.InnerDictionary.Clear(); this.cancelTokenSource.Dispose(); } } diff --git a/OpenTween/InputDialog.Designer.cs b/OpenTween/InputDialog.Designer.cs index c25e6261..7f0c27c9 100644 --- a/OpenTween/InputDialog.Designer.cs +++ b/OpenTween/InputDialog.Designer.cs @@ -42,7 +42,7 @@ resources.ApplyResources(this.buttonOK, "buttonOK"); this.buttonOK.Name = "buttonOK"; this.buttonOK.UseVisualStyleBackColor = true; - this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + this.buttonOK.Click += new System.EventHandler(this.ButtonOK_Click); // // buttonCancel // @@ -50,7 +50,7 @@ this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.UseVisualStyleBackColor = true; - this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // // tableLayoutPanel1 // diff --git a/OpenTween/InputDialog.cs b/OpenTween/InputDialog.cs index 869fb30f..31b6e679 100644 --- a/OpenTween/InputDialog.cs +++ b/OpenTween/InputDialog.cs @@ -37,10 +37,10 @@ namespace OpenTween protected InputDialog() => this.InitializeComponent(); - private void buttonOK_Click(object sender, EventArgs e) + private void ButtonOK_Click(object sender, EventArgs e) => this.DialogResult = DialogResult.OK; - private void buttonCancel_Click(object sender, EventArgs e) + private void ButtonCancel_Click(object sender, EventArgs e) => this.DialogResult = DialogResult.Cancel; public static DialogResult Show(string text, out string inputText) diff --git a/OpenTween/LRUCacheDictionary.cs b/OpenTween/LRUCacheDictionary.cs index b6012ff0..75858a02 100644 --- a/OpenTween/LRUCacheDictionary.cs +++ b/OpenTween/LRUCacheDictionary.cs @@ -60,10 +60,10 @@ namespace OpenTween } public event EventHandler? CacheRemoved; - internal LinkedList> innerList; - internal Dictionary>> innerDict; + internal LinkedList> InnerList; + internal Dictionary>> InnerDict; - internal int accessCount = 0; + internal int AccessCount = 0; public LRUCacheDictionary() : this(trimLimit: int.MaxValue, autoTrimCount: int.MaxValue) @@ -75,8 +75,8 @@ namespace OpenTween this.TrimLimit = trimLimit; this.AutoTrimCount = autoTrimCount; - this.innerList = new LinkedList>(); - this.innerDict = new Dictionary>>(); + this.InnerList = new LinkedList>(); + this.InnerDict = new Dictionary>>(); } /// @@ -85,8 +85,8 @@ namespace OpenTween /// protected void UpdateAccess(LinkedListNode> node) { - this.innerList.Remove(node); - this.innerList.AddFirst(node); + this.InnerList.Remove(node); + this.InnerList.AddFirst(node); } public bool Trim() @@ -95,9 +95,9 @@ namespace OpenTween for (var i = this.Count; i > this.TrimLimit; i--) { - var node = this.innerList.Last; - this.innerList.Remove(node); - this.innerDict.Remove(node.Value.Key); + var node = this.InnerList.Last; + this.InnerList.Remove(node); + this.InnerDict.Remove(node.Value.Key); this.CacheRemoved?.Invoke(this, new CacheRemovedEventArgs(node.Value)); } @@ -107,9 +107,9 @@ namespace OpenTween internal bool AutoTrim() { - if (this.accessCount < this.AutoTrimCount) return false; + if (this.AccessCount < this.AutoTrimCount) return false; - this.accessCount = 0; // カウンターをリセット + this.AccessCount = 0; // カウンターをリセット return this.Trim(); } @@ -120,49 +120,49 @@ namespace OpenTween public void Add(KeyValuePair item) { var node = new LinkedListNode>(item); - this.innerList.AddFirst(node); - this.innerDict.Add(item.Key, node); + this.InnerList.AddFirst(node); + this.InnerDict.Add(item.Key, node); - this.accessCount++; + this.AccessCount++; this.AutoTrim(); } public bool ContainsKey(TKey key) - => this.innerDict.ContainsKey(key); + => this.InnerDict.ContainsKey(key); public bool Contains(KeyValuePair item) { - if (!this.innerDict.TryGetValue(item.Key, out var node)) return false; + if (!this.InnerDict.TryGetValue(item.Key, out var node)) return false; return EqualityComparer.Default.Equals(node.Value.Value, item.Value); } public bool Remove(TKey key) { - if (!this.innerDict.TryGetValue(key, out var node)) return false; + if (!this.InnerDict.TryGetValue(key, out var node)) return false; - this.innerList.Remove(node); + this.InnerList.Remove(node); - return this.innerDict.Remove(key); + return this.InnerDict.Remove(key); } public bool Remove(KeyValuePair item) { - if (!this.innerDict.TryGetValue(item.Key, out var node)) return false; + if (!this.InnerDict.TryGetValue(item.Key, out var node)) return false; if (!EqualityComparer.Default.Equals(node.Value.Value, item.Value)) return false; - this.innerList.Remove(node); + this.InnerList.Remove(node); - return this.innerDict.Remove(item.Key); + return this.InnerDict.Remove(item.Key); } #pragma warning disable CS8767 public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) #pragma warning restore CS8767 { - var ret = this.innerDict.TryGetValue(key, out var node); + var ret = this.InnerDict.TryGetValue(key, out var node); if (!ret) { @@ -173,26 +173,26 @@ namespace OpenTween this.UpdateAccess(node); value = node.Value.Value; - this.accessCount++; + this.AccessCount++; this.AutoTrim(); return true; } public ICollection Keys - => this.innerDict.Keys; + => this.InnerDict.Keys; public ICollection Values - => this.innerDict.Values.Select(x => x.Value.Value).ToList(); + => this.InnerDict.Values.Select(x => x.Value.Value).ToList(); public TValue this[TKey key] { get { - var node = this.innerDict[key]; + var node = this.InnerDict[key]; this.UpdateAccess(node); - this.accessCount++; + this.AccessCount++; this.AutoTrim(); return node.Value.Value; @@ -201,28 +201,28 @@ namespace OpenTween { var pair = new KeyValuePair(key, value); - if (this.innerDict.TryGetValue(key, out var node)) + if (this.InnerDict.TryGetValue(key, out var node)) { - this.innerList.Remove(node); + this.InnerList.Remove(node); node.Value = pair; } else { node = new LinkedListNode>(pair); - this.innerDict[key] = node; + this.InnerDict[key] = node; } - this.innerList.AddFirst(node); + this.InnerList.AddFirst(node); - this.accessCount++; + this.AccessCount++; this.AutoTrim(); } } public void Clear() { - this.innerList.Clear(); - this.innerDict.Clear(); + this.InnerList.Clear(); + this.InnerDict.Clear(); } public void CopyTo(KeyValuePair[] array, int arrayIndex) @@ -241,13 +241,13 @@ namespace OpenTween } public int Count - => this.innerDict.Count; + => this.InnerDict.Count; public bool IsReadOnly => false; public IEnumerator> GetEnumerator() - => this.innerDict.Select(x => x.Value.Value).GetEnumerator(); + => this.InnerDict.Select(x => x.Value.Value).GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); diff --git a/OpenTween/LoginDialog.Designer.cs b/OpenTween/LoginDialog.Designer.cs index 65cf871f..9e75f759 100644 --- a/OpenTween/LoginDialog.Designer.cs +++ b/OpenTween/LoginDialog.Designer.cs @@ -63,7 +63,7 @@ resources.ApplyResources(this.buttonLogin, "buttonLogin"); this.buttonLogin.Name = "buttonLogin"; this.buttonLogin.UseVisualStyleBackColor = true; - this.buttonLogin.Click += new System.EventHandler(this.buttonLogin_Click); + this.buttonLogin.Click += new System.EventHandler(this.ButtonLogin_Click); // // buttonCancel // diff --git a/OpenTween/LoginDialog.cs b/OpenTween/LoginDialog.cs index e626a6d2..08b00d51 100644 --- a/OpenTween/LoginDialog.cs +++ b/OpenTween/LoginDialog.cs @@ -44,7 +44,7 @@ namespace OpenTween public LoginDialog() => this.InitializeComponent(); - private async void buttonLogin_Click(object sender, EventArgs e) + private async void ButtonLogin_Click(object sender, EventArgs e) { if (this.LoginCallback == null) return; diff --git a/OpenTween/Models/TabInformations.cs b/OpenTween/Models/TabInformations.cs index 81056ac0..9d17e727 100644 --- a/OpenTween/Models/TabInformations.cs +++ b/OpenTween/Models/TabInformations.cs @@ -76,7 +76,7 @@ namespace OpenTween.Models // トランザクション用 private readonly object LockObj = new object(); - private static readonly TabInformations _instance = new TabInformations(); + private static readonly TabInformations Instance = new TabInformations(); // List private List _lists = new List(); @@ -86,7 +86,7 @@ namespace OpenTween.Models } public static TabInformations GetInstance() - => _instance; // singleton + => Instance; // singleton public string SelectedTabName { get; private set; } = ""; diff --git a/OpenTween/MyCommon.cs b/OpenTween/MyCommon.cs index 27e4617e..69135382 100644 --- a/OpenTween/MyCommon.cs +++ b/OpenTween/MyCommon.cs @@ -60,8 +60,8 @@ namespace OpenTween public static class MyCommon { private static readonly object LockObj = new object(); - public static bool _endingFlag; // 終了フラグ - public static string settingPath = null!; + public static bool EndingFlag { get; set; } // 終了フラグ + public static string SettingPath { get; set; } = null!; public enum IconSizes { @@ -740,9 +740,9 @@ namespace OpenTween /// 状態を調べるキー /// で指定された修飾キーがすべて押されている状態であれば true。それ以外であれば false。 public static bool IsKeyDown(params Keys[] keys) - => MyCommon._IsKeyDown(Control.ModifierKeys, keys); + => MyCommon.IsKeyDownInternal(Control.ModifierKeys, keys); - internal static bool _IsKeyDown(Keys modifierKeys, Keys[] targetKeys) + internal static bool IsKeyDownInternal(Keys modifierKeys, Keys[] targetKeys) { foreach (var key in targetKeys) { diff --git a/OpenTween/nicoms.cs b/OpenTween/Nicoms.cs similarity index 96% rename from OpenTween/nicoms.cs rename to OpenTween/Nicoms.cs index a93f7a83..3cac42b1 100644 --- a/OpenTween/nicoms.cs +++ b/OpenTween/Nicoms.cs @@ -30,9 +30,9 @@ using System; namespace OpenTween { - public static class nicoms + public static class Nicoms { - private static readonly string[] _nicovideo = + private static readonly string[] Nicovideo = { "www.nicovideo.jp/watch/", "live.nicovideo.jp/watch/", @@ -64,7 +64,7 @@ namespace OpenTween return url; } - foreach (var nv in _nicovideo) + foreach (var nv in Nicovideo) { if (url.StartsWith(nv, StringComparison.Ordinal)) return string.Format("{0}{1}", "https://nico.ms/", url.Substring(nv.Length)); diff --git a/OpenTween/OpenTween.csproj b/OpenTween/OpenTween.csproj index 5c55c14b..1172309b 100644 --- a/OpenTween/OpenTween.csproj +++ b/OpenTween/OpenTween.csproj @@ -406,7 +406,7 @@ MyLists.cs - + Form diff --git a/OpenTween/SearchWordDialog.Designer.cs b/OpenTween/SearchWordDialog.Designer.cs index d8d9104a..4e3a4e42 100644 --- a/OpenTween/SearchWordDialog.Designer.cs +++ b/OpenTween/SearchWordDialog.Designer.cs @@ -75,7 +75,7 @@ // resources.ApplyResources(this.buttonSearchTimeline, "buttonSearchTimeline"); this.buttonSearchTimeline.Name = "buttonSearchTimeline"; - this.buttonSearchTimeline.Click += new System.EventHandler(this.buttonSearchTimeline_Click); + this.buttonSearchTimeline.Click += new System.EventHandler(this.ButtonSearchTimeline_Click); // // tableLayoutPanel1 // @@ -88,7 +88,7 @@ // resources.ApplyResources(this.buttonSearchTimelineNew, "buttonSearchTimelineNew"); this.buttonSearchTimelineNew.Name = "buttonSearchTimelineNew"; - this.buttonSearchTimelineNew.Click += new System.EventHandler(this.buttonSearchTimelineNew_Click); + this.buttonSearchTimelineNew.Click += new System.EventHandler(this.ButtonSearchTimelineNew_Click); // // tabControl // @@ -98,7 +98,7 @@ this.tabControl.HotTrack = true; this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; - this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); + this.tabControl.SelectedIndexChanged += new System.EventHandler(this.TabControl_SelectedIndexChanged); // // tabPageTimeline // @@ -128,7 +128,7 @@ resources.ApplyResources(this.linkLabelSearchHelp, "linkLabelSearchHelp"); this.linkLabelSearchHelp.Name = "linkLabelSearchHelp"; this.linkLabelSearchHelp.TabStop = true; - this.linkLabelSearchHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelSearchHelp_LinkClicked); + this.linkLabelSearchHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LinkLabelSearchHelp_LinkClicked); // // tableLayoutPanel2 // @@ -140,7 +140,7 @@ // resources.ApplyResources(this.buttonSearchPublic, "buttonSearchPublic"); this.buttonSearchPublic.Name = "buttonSearchPublic"; - this.buttonSearchPublic.Click += new System.EventHandler(this.buttonSearchPublic_Click); + this.buttonSearchPublic.Click += new System.EventHandler(this.ButtonSearchPublic_Click); // // label2 // diff --git a/OpenTween/SearchWordDialog.cs b/OpenTween/SearchWordDialog.cs index 26de0689..efdd3328 100644 --- a/OpenTween/SearchWordDialog.cs +++ b/OpenTween/SearchWordDialog.cs @@ -131,7 +131,7 @@ namespace OpenTween private void SearchWordDialog_Shown(object sender, EventArgs e) => this.ActivateSelectedTabPage(); - private void tabControl_SelectedIndexChanged(object sender, EventArgs e) + private void TabControl_SelectedIndexChanged(object sender, EventArgs e) => this.ActivateSelectedTabPage(); private void ActivateSelectedTabPage() @@ -150,7 +150,7 @@ namespace OpenTween } } - private void buttonSearchTimeline_Click(object sender, EventArgs e) + private void ButtonSearchTimeline_Click(object sender, EventArgs e) { if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text)) { @@ -169,7 +169,7 @@ namespace OpenTween ); } - private void buttonSearchTimelineNew_Click(object sender, EventArgs e) + private void ButtonSearchTimelineNew_Click(object sender, EventArgs e) { if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text)) { @@ -188,7 +188,7 @@ namespace OpenTween ); } - private void buttonSearchPublic_Click(object sender, EventArgs e) + private void ButtonSearchPublic_Click(object sender, EventArgs e) { if (MyCommon.IsNullOrEmpty(this.textSearchPublic.Text)) { @@ -207,7 +207,7 @@ namespace OpenTween ); } - private async void linkLabelSearchHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private async void LinkLabelSearchHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { // 「検索オプションの使い方」ページのURL const string PublicSearchHelpUrl = "https://support.twitter.com/articles/249059"; diff --git a/OpenTween/SendErrorReportForm.Designer.cs b/OpenTween/SendErrorReportForm.Designer.cs index 74b9b9c4..a0957d4b 100644 --- a/OpenTween/SendErrorReportForm.Designer.cs +++ b/OpenTween/SendErrorReportForm.Designer.cs @@ -59,7 +59,7 @@ resources.ApplyResources(this.buttonSendByMail, "buttonSendByMail"); this.buttonSendByMail.Name = "buttonSendByMail"; this.buttonSendByMail.UseVisualStyleBackColor = true; - this.buttonSendByMail.Click += new System.EventHandler(this.buttonSendByMail_Click); + this.buttonSendByMail.Click += new System.EventHandler(this.ButtonSendByMail_Click); // // buttonSendByDM // @@ -67,7 +67,7 @@ resources.ApplyResources(this.buttonSendByDM, "buttonSendByDM"); this.buttonSendByDM.Name = "buttonSendByDM"; this.buttonSendByDM.UseVisualStyleBackColor = true; - this.buttonSendByDM.Click += new System.EventHandler(this.buttonSendByDM_Click); + this.buttonSendByDM.Click += new System.EventHandler(this.ButtonSendByDM_Click); // // bindingSource // @@ -79,7 +79,7 @@ resources.ApplyResources(this.buttonNotSend, "buttonNotSend"); this.buttonNotSend.Name = "buttonNotSend"; this.buttonNotSend.UseVisualStyleBackColor = true; - this.buttonNotSend.Click += new System.EventHandler(this.buttonNotSend_Click); + this.buttonNotSend.Click += new System.EventHandler(this.ButtonNotSend_Click); // // textBoxErrorReport // @@ -103,7 +103,7 @@ resources.ApplyResources(this.buttonReset, "buttonReset"); this.buttonReset.Name = "buttonReset"; this.buttonReset.UseVisualStyleBackColor = true; - this.buttonReset.Click += new System.EventHandler(this.buttonReset_Click); + this.buttonReset.Click += new System.EventHandler(this.ButtonReset_Click); // // pictureBoxIcon // diff --git a/OpenTween/SendErrorReportForm.cs b/OpenTween/SendErrorReportForm.cs index 3c319a86..7bed261d 100644 --- a/OpenTween/SendErrorReportForm.cs +++ b/OpenTween/SendErrorReportForm.cs @@ -60,16 +60,16 @@ namespace OpenTween this.textBoxErrorReport.DeselectAll(); } - private void buttonReset_Click(object sender, EventArgs e) + private void ButtonReset_Click(object sender, EventArgs e) => this.ErrorReport.Reset(); - private async void buttonSendByMail_Click(object sender, EventArgs e) + private async void ButtonSendByMail_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; await this.ErrorReport.SendByMailAsync(); } - private async void buttonSendByDM_Click(object sender, EventArgs e) + private async void ButtonSendByDM_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; @@ -86,7 +86,7 @@ namespace OpenTween } } - private void buttonNotSend_Click(object sender, EventArgs e) + private void ButtonNotSend_Click(object sender, EventArgs e) => this.DialogResult = DialogResult.Cancel; } diff --git a/OpenTween/Setting/Panel/FontPanel.Designer.cs b/OpenTween/Setting/Panel/FontPanel.Designer.cs index 4e711380..0d94170a 100644 --- a/OpenTween/Setting/Panel/FontPanel.Designer.cs +++ b/OpenTween/Setting/Panel/FontPanel.Designer.cs @@ -96,7 +96,7 @@ resources.ApplyResources(this.btnRetweet, "btnRetweet"); this.btnRetweet.Name = "btnRetweet"; this.btnRetweet.UseVisualStyleBackColor = true; - this.btnRetweet.Click += new System.EventHandler(this.btnRetweet_Click); + this.btnRetweet.Click += new System.EventHandler(this.BtnRetweet_Click); // // lblRetweet // @@ -121,7 +121,7 @@ resources.ApplyResources(this.btnDetailLink, "btnDetailLink"); this.btnDetailLink.Name = "btnDetailLink"; this.btnDetailLink.UseVisualStyleBackColor = true; - this.btnDetailLink.Click += new System.EventHandler(this.btnDetailLink_Click); + this.btnDetailLink.Click += new System.EventHandler(this.BtnDetailLink_Click); // // lblDetailLink // @@ -139,7 +139,7 @@ resources.ApplyResources(this.btnUnread, "btnUnread"); this.btnUnread.Name = "btnUnread"; this.btnUnread.UseVisualStyleBackColor = true; - this.btnUnread.Click += new System.EventHandler(this.btnUnread_Click); + this.btnUnread.Click += new System.EventHandler(this.BtnUnread_Click); // // lblUnread // @@ -157,7 +157,7 @@ resources.ApplyResources(this.btnDetailBack, "btnDetailBack"); this.btnDetailBack.Name = "btnDetailBack"; this.btnDetailBack.UseVisualStyleBackColor = true; - this.btnDetailBack.Click += new System.EventHandler(this.btnDetailBack_Click); + this.btnDetailBack.Click += new System.EventHandler(this.BtnDetailBack_Click); // // lblDetailBackcolor // @@ -175,7 +175,7 @@ resources.ApplyResources(this.btnDetail, "btnDetail"); this.btnDetail.Name = "btnDetail"; this.btnDetail.UseVisualStyleBackColor = true; - this.btnDetail.Click += new System.EventHandler(this.btnDetail_Click); + this.btnDetail.Click += new System.EventHandler(this.BtnDetail_Click); // // lblDetail // @@ -201,7 +201,7 @@ resources.ApplyResources(this.btnOWL, "btnOWL"); this.btnOWL.Name = "btnOWL"; this.btnOWL.UseVisualStyleBackColor = true; - this.btnOWL.Click += new System.EventHandler(this.btnOWL_Click); + this.btnOWL.Click += new System.EventHandler(this.BtnOWL_Click); // // lblOWL // @@ -219,7 +219,7 @@ resources.ApplyResources(this.btnFav, "btnFav"); this.btnFav.Name = "btnFav"; this.btnFav.UseVisualStyleBackColor = true; - this.btnFav.Click += new System.EventHandler(this.btnFav_Click); + this.btnFav.Click += new System.EventHandler(this.BtnFav_Click); // // lblFav // @@ -237,7 +237,7 @@ resources.ApplyResources(this.btnListFont, "btnListFont"); this.btnListFont.Name = "btnListFont"; this.btnListFont.UseVisualStyleBackColor = true; - this.btnListFont.Click += new System.EventHandler(this.btnListFont_Click); + this.btnListFont.Click += new System.EventHandler(this.BtnListFont_Click); // // lblListFont // diff --git a/OpenTween/Setting/Panel/FontPanel.cs b/OpenTween/Setting/Panel/FontPanel.cs index 17b7903a..7c99f772 100644 --- a/OpenTween/Setting/Panel/FontPanel.cs +++ b/OpenTween/Setting/Panel/FontPanel.cs @@ -97,28 +97,28 @@ namespace OpenTween.Setting.Panel this.lblRetweet.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Green); } - private void btnListFont_Click(object sender, EventArgs e) + private void BtnListFont_Click(object sender, EventArgs e) => this.ShowFontDialog(this.lblListFont); - private void btnUnread_Click(object sender, EventArgs e) + private void BtnUnread_Click(object sender, EventArgs e) => this.ShowFontDialog(this.lblUnread); - private void btnFav_Click(object sender, EventArgs e) + private void BtnFav_Click(object sender, EventArgs e) => this.ShowForeColorDialog(this.lblFav); - private void btnOWL_Click(object sender, EventArgs e) + private void BtnOWL_Click(object sender, EventArgs e) => this.ShowForeColorDialog(this.lblOWL); - private void btnRetweet_Click(object sender, EventArgs e) + private void BtnRetweet_Click(object sender, EventArgs e) => this.ShowForeColorDialog(this.lblRetweet); - private void btnDetail_Click(object sender, EventArgs e) + private void BtnDetail_Click(object sender, EventArgs e) => this.ShowFontDialog(this.lblDetail); - private void btnDetailLink_Click(object sender, EventArgs e) + private void BtnDetailLink_Click(object sender, EventArgs e) => this.ShowForeColorDialog(this.lblDetailLink); - private void btnDetailBack_Click(object sender, EventArgs e) + private void BtnDetailBack_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblDetailBackcolor); } } diff --git a/OpenTween/Setting/Panel/FontPanel2.Designer.cs b/OpenTween/Setting/Panel/FontPanel2.Designer.cs index b93012d3..8da15525 100644 --- a/OpenTween/Setting/Panel/FontPanel2.Designer.cs +++ b/OpenTween/Setting/Panel/FontPanel2.Designer.cs @@ -145,63 +145,63 @@ resources.ApplyResources(this.btnInputFont, "btnInputFont"); this.btnInputFont.Name = "btnInputFont"; this.btnInputFont.UseVisualStyleBackColor = true; - this.btnInputFont.Click += new System.EventHandler(this.btnInputFont_Click); + this.btnInputFont.Click += new System.EventHandler(this.BtnInputFont_Click); // // btnInputBackcolor // resources.ApplyResources(this.btnInputBackcolor, "btnInputBackcolor"); this.btnInputBackcolor.Name = "btnInputBackcolor"; this.btnInputBackcolor.UseVisualStyleBackColor = true; - this.btnInputBackcolor.Click += new System.EventHandler(this.btnInputBackcolor_Click); + this.btnInputBackcolor.Click += new System.EventHandler(this.BtnInputBackcolor_Click); // // btnAtTo // resources.ApplyResources(this.btnAtTo, "btnAtTo"); this.btnAtTo.Name = "btnAtTo"; this.btnAtTo.UseVisualStyleBackColor = true; - this.btnAtTo.Click += new System.EventHandler(this.btnAtTo_Click); + this.btnAtTo.Click += new System.EventHandler(this.BtnAtTo_Click); // // btnListBack // resources.ApplyResources(this.btnListBack, "btnListBack"); this.btnListBack.Name = "btnListBack"; this.btnListBack.UseVisualStyleBackColor = true; - this.btnListBack.Click += new System.EventHandler(this.btnListBack_Click); + this.btnListBack.Click += new System.EventHandler(this.BtnListBack_Click); // // btnAtFromTarget // resources.ApplyResources(this.btnAtFromTarget, "btnAtFromTarget"); this.btnAtFromTarget.Name = "btnAtFromTarget"; this.btnAtFromTarget.UseVisualStyleBackColor = true; - this.btnAtFromTarget.Click += new System.EventHandler(this.btnAtFromTarget_Click); + this.btnAtFromTarget.Click += new System.EventHandler(this.BtnAtFromTarget_Click); // // btnAtTarget // resources.ApplyResources(this.btnAtTarget, "btnAtTarget"); this.btnAtTarget.Name = "btnAtTarget"; this.btnAtTarget.UseVisualStyleBackColor = true; - this.btnAtTarget.Click += new System.EventHandler(this.btnAtTarget_Click); + this.btnAtTarget.Click += new System.EventHandler(this.BtnAtTarget_Click); // // btnTarget // resources.ApplyResources(this.btnTarget, "btnTarget"); this.btnTarget.Name = "btnTarget"; this.btnTarget.UseVisualStyleBackColor = true; - this.btnTarget.Click += new System.EventHandler(this.btnTarget_Click); + this.btnTarget.Click += new System.EventHandler(this.BtnTarget_Click); // // btnAtSelf // resources.ApplyResources(this.btnAtSelf, "btnAtSelf"); this.btnAtSelf.Name = "btnAtSelf"; this.btnAtSelf.UseVisualStyleBackColor = true; - this.btnAtSelf.Click += new System.EventHandler(this.btnAtSelf_Click); + this.btnAtSelf.Click += new System.EventHandler(this.BtnAtSelf_Click); // // btnSelf // resources.ApplyResources(this.btnSelf, "btnSelf"); this.btnSelf.Name = "btnSelf"; this.btnSelf.UseVisualStyleBackColor = true; - this.btnSelf.Click += new System.EventHandler(this.btnSelf_Click); + this.btnSelf.Click += new System.EventHandler(this.BtnSelf_Click); // // lblInputFont // diff --git a/OpenTween/Setting/Panel/FontPanel2.cs b/OpenTween/Setting/Panel/FontPanel2.cs index 223d713f..a515a4a1 100644 --- a/OpenTween/Setting/Panel/FontPanel2.cs +++ b/OpenTween/Setting/Panel/FontPanel2.cs @@ -92,31 +92,31 @@ namespace OpenTween.Setting.Panel this.lblListBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window); } - private void btnSelf_Click(object sender, EventArgs e) + private void BtnSelf_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblSelf); - private void btnAtSelf_Click(object sender, EventArgs e) + private void BtnAtSelf_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblAtSelf); - private void btnTarget_Click(object sender, EventArgs e) + private void BtnTarget_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblTarget); - private void btnAtTarget_Click(object sender, EventArgs e) + private void BtnAtTarget_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblAtTarget); - private void btnAtFromTarget_Click(object sender, EventArgs e) + private void BtnAtFromTarget_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblAtFromTarget); - private void btnAtTo_Click(object sender, EventArgs e) + private void BtnAtTo_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblAtTo); - private void btnListBack_Click(object sender, EventArgs e) + private void BtnListBack_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblListBackcolor); - private void btnInputBackcolor_Click(object sender, EventArgs e) + private void BtnInputBackcolor_Click(object sender, EventArgs e) => this.ShowBackColorDialog(this.lblInputBackcolor); - private void btnInputFont_Click(object sender, EventArgs e) + private void BtnInputFont_Click(object sender, EventArgs e) => this.ShowFontDialog(this.lblInputFont); } } diff --git a/OpenTween/Setting/SettingBase.cs b/OpenTween/Setting/SettingBase.cs index d54a21b9..9b1f9bb8 100644 --- a/OpenTween/Setting/SettingBase.cs +++ b/OpenTween/Setting/SettingBase.cs @@ -51,7 +51,7 @@ namespace OpenTween [XmlAnyElement] public XmlElement[] ExtraElements = Array.Empty(); - private static readonly object lockObj = new object(); + private static readonly object LockObj = new object(); protected static T LoadSettings(string FileId) { @@ -63,7 +63,7 @@ namespace OpenTween return new T(); } - lock (lockObj) + lock (LockObj) { using var fs = new FileStream(settingFilePath, FileMode.Open, FileAccess.Read); fs.Position = 0; @@ -87,7 +87,7 @@ namespace OpenTween { try { - lock (lockObj) + lock (LockObj) { using var fs = new FileStream(backupFile, FileMode.Open, FileAccess.Read); fs.Position = 0; @@ -125,7 +125,7 @@ namespace OpenTween var tmpfilePath = GetSettingFilePath("_" + Path.GetRandomFileName()); try { - lock (lockObj) + lock (LockObj) { using (var stream = new FileStream(tmpfilePath, FileMode.Create, FileAccess.Write)) { @@ -174,6 +174,6 @@ namespace OpenTween => SaveSettings(Instance, ""); public static string GetSettingFilePath(string FileId) - => Path.Combine(MyCommon.settingPath, typeof(T).Name + FileId + ".xml"); + => Path.Combine(MyCommon.SettingPath, typeof(T).Name + FileId + ".xml"); } } diff --git a/OpenTween/ShortUrl.cs b/OpenTween/ShortUrl.cs index f9c15fb8..ec9a56ba 100644 --- a/OpenTween/ShortUrl.cs +++ b/OpenTween/ShortUrl.cs @@ -47,13 +47,13 @@ namespace OpenTween /// public class ShortUrl { - private static readonly Lazy _instance; + private static readonly Lazy InstanceLazy; /// /// ShortUrl のインスタンスを取得します /// public static ShortUrl Instance - => _instance.Value; + => InstanceLazy.Value; /// /// 短縮 URL の展開を無効にするか否か @@ -136,7 +136,7 @@ namespace OpenTween }; static ShortUrl() - => _instance = new Lazy(() => new ShortUrl(), true); + => InstanceLazy = new Lazy(() => new ShortUrl(), true); [SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] internal ShortUrl() diff --git a/OpenTween/Thumbnail/Services/FoursquareCheckin.cs b/OpenTween/Thumbnail/Services/FoursquareCheckin.cs index b195d917..908219c2 100644 --- a/OpenTween/Thumbnail/Services/FoursquareCheckin.cs +++ b/OpenTween/Thumbnail/Services/FoursquareCheckin.cs @@ -48,7 +48,7 @@ namespace OpenTween.Thumbnail.Services public static readonly string ApiBase = "https://api.foursquare.com/v2"; - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly HttpClient? localHttpClient; @@ -124,7 +124,7 @@ namespace OpenTween.Thumbnail.Services var apiUrl = new Uri(ApiBase + "/checkins/resolve?" + MyCommon.BuildQueryString(query)); - using var response = await this.http.GetAsync(apiUrl, token) + using var response = await this.Http.GetAsync(apiUrl, token) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); @@ -174,7 +174,7 @@ namespace OpenTween.Thumbnail.Services var apiUrl = new Uri(ApiBase + "/checkins/" + checkinIdGroup.Value + "?" + MyCommon.BuildQueryString(query)); - using var response = await this.http.GetAsync(apiUrl, token) + using var response = await this.Http.GetAsync(apiUrl, token) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs b/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs index 700b541d..aea42814 100644 --- a/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs +++ b/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs @@ -55,7 +55,7 @@ namespace OpenTween.Thumbnail.Services protected IEnumerable? UrlRegex = null; protected AsyncTimer UpdateTimer; - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly HttpClient? localHttpClient; @@ -176,7 +176,7 @@ namespace OpenTween.Thumbnail.Services protected virtual async Task FetchRegexAsync(string apiBase) { using var cts = new CancellationTokenSource(millisecondsDelay: 1000); - using var response = await this.http.GetAsync(apiBase + "regex.json", cts.Token) + using var response = await this.Http.GetAsync(apiBase + "regex.json", cts.Token) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/OpenTween/Thumbnail/Services/MetaThumbnailService.cs b/OpenTween/Thumbnail/Services/MetaThumbnailService.cs index d364f9a6..b7499030 100644 --- a/OpenTween/Thumbnail/Services/MetaThumbnailService.cs +++ b/OpenTween/Thumbnail/Services/MetaThumbnailService.cs @@ -47,7 +47,7 @@ namespace OpenTween.Thumbnail.Services }; protected static string[] PropertyNames = { "og:image", "twitter:image", "twitter:image:src" }; - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly HttpClient? localHttpClient; @@ -123,7 +123,7 @@ namespace OpenTween.Thumbnail.Services protected virtual async Task FetchImageUrlAsync(string url, CancellationToken token) { - using var response = await this.http.GetAsync(url, token) + using var response = await this.Http.GetAsync(url, token) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/OpenTween/Thumbnail/Services/Tinami.cs b/OpenTween/Thumbnail/Services/Tinami.cs index d0a4eaa5..a53d744c 100644 --- a/OpenTween/Thumbnail/Services/Tinami.cs +++ b/OpenTween/Thumbnail/Services/Tinami.cs @@ -42,7 +42,7 @@ namespace OpenTween.Thumbnail.Services public static readonly Regex UrlPatternRegex = new Regex(@"^https?://www\.tinami\.com/view/(?\d+)$"); - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly ApiKey apiKey; @@ -106,7 +106,7 @@ namespace OpenTween.Thumbnail.Services var apiUrl = new Uri("http://api.tinami.com/content/info?" + MyCommon.BuildQueryString(query)); - using var response = await this.http.GetAsync(apiUrl, token) + using var response = await this.Http.GetAsync(apiUrl, token) .ConfigureAwait(false); response.EnsureSuccessStatusCode(); diff --git a/OpenTween/Thumbnail/Services/Tumblr.cs b/OpenTween/Thumbnail/Services/Tumblr.cs index f4db07fa..fdcf8775 100644 --- a/OpenTween/Thumbnail/Services/Tumblr.cs +++ b/OpenTween/Thumbnail/Services/Tumblr.cs @@ -43,7 +43,7 @@ namespace OpenTween.Thumbnail.Services public static readonly Regex UrlPatternRegex = new Regex(@"^https?://(?[^.]+\.tumblr\.com|tumblr\.[^.]+\.[^.]+)/post/(?[0-9]+)(/.*)?"); - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly ApiKey tumblrConsumerKey; @@ -83,7 +83,7 @@ namespace OpenTween.Thumbnail.Services try { var apiUrl = string.Format("https://api.tumblr.com/v2/blog/{0}/posts?", host) + MyCommon.BuildQueryString(param); - using var response = await this.http.GetAsync(apiUrl, token) + using var response = await this.Http.GetAsync(apiUrl, token) .ConfigureAwait(false); var jsonBytes = await response.Content.ReadAsByteArrayAsync() diff --git a/OpenTween/Thumbnail/Services/Vimeo.cs b/OpenTween/Thumbnail/Services/Vimeo.cs index 30354ada..4ce91408 100644 --- a/OpenTween/Thumbnail/Services/Vimeo.cs +++ b/OpenTween/Thumbnail/Services/Vimeo.cs @@ -44,7 +44,7 @@ namespace OpenTween.Thumbnail.Services public static readonly Regex UrlPatternRegex = new Regex(@"https?://vimeo\.com/(?[0-9]+)"); - protected HttpClient http + protected HttpClient Http => this.localHttpClient ?? Networking.Http; private readonly HttpClient? localHttpClient; @@ -67,7 +67,7 @@ namespace OpenTween.Thumbnail.Services { var apiUrl = "https://vimeo.com/api/oembed.xml?url=" + Uri.EscapeDataString(url); - var xmlStr = await this.http.GetStringAsync(apiUrl) + var xmlStr = await this.Http.GetStringAsync(apiUrl) .ConfigureAwait(false); var xdoc = XDocument.Parse(xmlStr); diff --git a/OpenTween/ToolStripAPIGauge.cs b/OpenTween/ToolStripAPIGauge.cs index f4450539..5f9ca82e 100644 --- a/OpenTween/ToolStripAPIGauge.cs +++ b/OpenTween/ToolStripAPIGauge.cs @@ -159,11 +159,11 @@ namespace OpenTween { var g = e.Graphics; - if (this.apiGaugeBounds != Rectangle.Empty) - g.FillRectangle(Brushes.LightBlue, this.apiGaugeBounds); + if (this.ApiGaugeBounds != Rectangle.Empty) + g.FillRectangle(Brushes.LightBlue, this.ApiGaugeBounds); - if (this.timeGaugeBounds != Rectangle.Empty) - g.FillRectangle(Brushes.LightPink, this.timeGaugeBounds); + if (this.TimeGaugeBounds != Rectangle.Empty) + g.FillRectangle(Brushes.LightPink, this.TimeGaugeBounds); base.OnPaint(e); } @@ -174,20 +174,20 @@ namespace OpenTween // (C) 2010 anis774 (@anis774) // (C) 2010 Moz (@syo68k) - internal Rectangle apiGaugeBounds = Rectangle.Empty; - internal Rectangle timeGaugeBounds = Rectangle.Empty; + internal Rectangle ApiGaugeBounds = Rectangle.Empty; + internal Rectangle TimeGaugeBounds = Rectangle.Empty; protected virtual void UpdateGaugeBounds() { if (this._ApiLimit == null || this._GaugeHeight < 1) { - this.apiGaugeBounds = Rectangle.Empty; - this.timeGaugeBounds = Rectangle.Empty; + this.ApiGaugeBounds = Rectangle.Empty; + this.TimeGaugeBounds = Rectangle.Empty; return; } var apiGaugeValue = (double)this._ApiLimit.AccessLimitRemain / this._ApiLimit.AccessLimitCount; - this.apiGaugeBounds = new Rectangle( + this.ApiGaugeBounds = new Rectangle( 0, (this.Height - this._GaugeHeight * 2) / 2, (int)(this.Width * apiGaugeValue), @@ -195,9 +195,9 @@ namespace OpenTween ); var timeGaugeValue = this.remainMinutes >= 15 ? 1.00 : this.remainMinutes / 15; - this.timeGaugeBounds = new Rectangle( + this.TimeGaugeBounds = new Rectangle( 0, - this.apiGaugeBounds.Top + this._GaugeHeight, + this.ApiGaugeBounds.Top + this._GaugeHeight, (int)(this.Width * timeGaugeValue), this._GaugeHeight ); diff --git a/OpenTween/Tween.Designer.cs b/OpenTween/Tween.Designer.cs index ca43f159..a5a76aa6 100644 --- a/OpenTween/Tween.Designer.cs +++ b/OpenTween/Tween.Designer.cs @@ -658,7 +658,7 @@ // resources.ApplyResources(this.tweetDetailsView, "tweetDetailsView"); this.tweetDetailsView.Name = "tweetDetailsView"; - this.tweetDetailsView.StatusChanged += new System.EventHandler(this.tweetDetailsView_StatusChanged); + this.tweetDetailsView.StatusChanged += new System.EventHandler(this.TweetDetailsView_StatusChanged); // // TableLayoutPanel2 // @@ -699,9 +699,9 @@ resources.ApplyResources(this.tweetThumbnail1, "tweetThumbnail1"); this.tweetThumbnail1.Name = "tweetThumbnail1"; this.tweetThumbnail1.TabStop = false; - this.tweetThumbnail1.ThumbnailLoading += new System.EventHandler(this.tweetThumbnail1_ThumbnailLoading); - this.tweetThumbnail1.ThumbnailDoubleClick += new System.EventHandler(this.tweetThumbnail1_ThumbnailDoubleClick); - this.tweetThumbnail1.ThumbnailImageSearchClick += new System.EventHandler(this.tweetThumbnail1_ThumbnailImageSearchClick); + this.tweetThumbnail1.ThumbnailLoading += new System.EventHandler(this.TweetThumbnail_ThumbnailLoading); + this.tweetThumbnail1.ThumbnailDoubleClick += new System.EventHandler(this.TweetThumbnail_ThumbnailDoubleClick); + this.tweetThumbnail1.ThumbnailImageSearchClick += new System.EventHandler(this.TweetThumbnail_ThumbnailImageSearchClick); // // MenuStrip1 // diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index 221a3473..d9129b30 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -105,7 +105,7 @@ namespace OpenTween private readonly object _syncObject = new object(); // ロック用 - private const string detailHtmlFormatHeaderMono = + private const string DetailHtmlFormatHeaderMono = "" + "" + "
";
-        private const string detailHtmlFormatFooterMono = "
"; - private const string detailHtmlFormatHeaderColor = + private const string DetailHtmlFormatFooterMono = ""; + private const string DetailHtmlFormatHeaderColor = "" + "" + "

"; - private const string detailHtmlFormatFooterColor = "

"; + private const string DetailHtmlFormatFooterColor = "

"; private string detailHtmlFormatHeader = null!; private string detailHtmlFormatFooter = null!; @@ -373,13 +373,13 @@ namespace OpenTween private bool preventSmsCommand = true; // URL短縮のUndo用 - private struct urlUndo + private struct UrlUndo { public string Before; public string After; } - private List? urlUndoBuffer = null; + private List? urlUndoBuffer = null; private readonly struct ReplyChain { @@ -426,20 +426,20 @@ namespace OpenTween private class StatusTextHistory { - public string status = ""; - public (long StatusId, string ScreenName)? inReplyTo = null; + public string Status { get; } = ""; + public (long StatusId, string ScreenName)? InReplyTo { get; } = null; /// 画像投稿サービス名 - public string imageService = ""; + public string ImageService { get; set; } = ""; - public IMediaItem[]? mediaItems = null; + public IMediaItem[]? MediaItems { get; set; } = null; public StatusTextHistory() { } public StatusTextHistory(string status, (long StatusId, string ScreenName)? inReplyTo) { - this.status = status; - this.inReplyTo = inReplyTo; + this.Status = status; + this.InReplyTo = inReplyTo; } } @@ -1191,7 +1191,7 @@ namespace OpenTween this.timelineScheduler.UpdateFunc[TimelineSchedulerTaskType.List] = () => this.InvokeAsync(() => this.RefreshTabAsync()); this.timelineScheduler.UpdateFunc[TimelineSchedulerTaskType.Config] = () => this.InvokeAsync(() => Task.WhenAll(new[] { - this.doGetFollowersMenu(), + this.DoGetFollowersMenu(), this.RefreshBlockIdsAsync(), this.RefreshMuteUserIdsAsync(), this.RefreshNoRetweetIdsAsync(), @@ -1230,13 +1230,13 @@ namespace OpenTween { if (SettingManager.Common.IsMonospace) { - this.detailHtmlFormatHeader = detailHtmlFormatHeaderMono; - this.detailHtmlFormatFooter = detailHtmlFormatFooterMono; + this.detailHtmlFormatHeader = DetailHtmlFormatHeaderMono; + this.detailHtmlFormatFooter = DetailHtmlFormatFooterMono; } else { - this.detailHtmlFormatHeader = detailHtmlFormatHeaderColor; - this.detailHtmlFormatFooter = detailHtmlFormatFooterColor; + this.detailHtmlFormatHeader = DetailHtmlFormatHeaderColor; + this.detailHtmlFormatFooter = DetailHtmlFormatFooterColor; } this.detailHtmlFormatHeader = this.detailHtmlFormatHeader @@ -1357,15 +1357,15 @@ namespace OpenTween private void RefreshTimelineScheduler() { - static TimeSpan intervalSecondsOrDisabled(int seconds) + static TimeSpan IntervalSecondsOrDisabled(int seconds) => seconds == 0 ? Timeout.InfiniteTimeSpan : TimeSpan.FromSeconds(seconds); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Home] = intervalSecondsOrDisabled(SettingManager.Common.TimelinePeriod); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Mention] = intervalSecondsOrDisabled(SettingManager.Common.ReplyPeriod); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Dm] = intervalSecondsOrDisabled(SettingManager.Common.DMPeriod); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.PublicSearch] = intervalSecondsOrDisabled(SettingManager.Common.PubSearchPeriod); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.User] = intervalSecondsOrDisabled(SettingManager.Common.UserTimelinePeriod); - this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.List] = intervalSecondsOrDisabled(SettingManager.Common.ListsPeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Home] = IntervalSecondsOrDisabled(SettingManager.Common.TimelinePeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Mention] = IntervalSecondsOrDisabled(SettingManager.Common.ReplyPeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Dm] = IntervalSecondsOrDisabled(SettingManager.Common.DMPeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.PublicSearch] = IntervalSecondsOrDisabled(SettingManager.Common.PubSearchPeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.User] = IntervalSecondsOrDisabled(SettingManager.Common.UserTimelinePeriod); + this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.List] = IntervalSecondsOrDisabled(SettingManager.Common.ListsPeriod); this.timelineScheduler.UpdateInterval[TimelineSchedulerTaskType.Config] = TimeSpan.FromHours(6); this.timelineScheduler.UpdateAfterSystemResume = TimeSpan.FromSeconds(30); @@ -1418,7 +1418,7 @@ namespace OpenTween out var newMentionOrDm, out var isDelete); - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; // リストに反映&選択状態復元 foreach (var (tab, index) in this._statuses.Tabs.WithIndex()) @@ -2049,8 +2049,8 @@ namespace OpenTween this._hisIdx = 0; var historyItem = this._history[this._hisIdx]; - this.inReplyTo = historyItem.inReplyTo; - this.StatusText.Text = historyItem.status; + this.inReplyTo = historyItem.InReplyTo; + this.StatusText.Text = historyItem.Status; this.StatusText.SelectionStart = this.StatusText.Text.Length; } @@ -2064,8 +2064,8 @@ namespace OpenTween this._hisIdx = this._history.Count - 1; var historyItem = this._history[this._hisIdx]; - this.inReplyTo = historyItem.inReplyTo; - this.StatusText.Text = historyItem.status; + this.inReplyTo = historyItem.InReplyTo; + this.StatusText.Text = historyItem.Status; this.StatusText.SelectionStart = this.StatusText.Text.Length; } @@ -2091,7 +2091,7 @@ namespace OpenTween { case DialogResult.Yes: this.StatusText.Text = ""; - await this.doReTweetOfficial(false); + await this.DoReTweetOfficial(false); return; case DialogResult.Cancel: return; @@ -2188,13 +2188,13 @@ namespace OpenTween private void EndToolStripMenuItem_Click(object sender, EventArgs e) { - MyCommon._endingFlag = true; + MyCommon.EndingFlag = true; this.Close(); } private void TweenMain_FormClosing(object sender, FormClosingEventArgs e) { - if (!SettingManager.Common.CloseToExit && e.CloseReason == CloseReason.UserClosing && MyCommon._endingFlag == false) + if (!SettingManager.Common.CloseToExit && e.CloseReason == CloseReason.UserClosing && MyCommon.EndingFlag == false) { // _endingFlag=false:フォームの×ボタン e.Cancel = true; @@ -2204,7 +2204,7 @@ namespace OpenTween { this._hookGlobalHotkey.UnregisterAllOriginalHotkey(); this._ignoreConfigSave = true; - MyCommon._endingFlag = true; + MyCommon.EndingFlag = true; this.timelineScheduler.Enabled = false; this.TimerRefreshIcon.Enabled = false; } @@ -3258,7 +3258,7 @@ namespace OpenTween private void DMStripMenuItem_Click(object sender, EventArgs e) => this.MakeReplyOrDirectStatus(false, false); - private async Task doStatusDelete() + private async Task DoStatusDelete() { var posts = this.CurrentTab.SelectedPosts; if (posts.Length == 0) @@ -3379,7 +3379,7 @@ namespace OpenTween } private async void DeleteStripMenuItem_Click(object sender, EventArgs e) - => await this.doStatusDelete(); + => await this.DoStatusDelete(); private void ReadedStripMenuItem_Click(object sender, EventArgs e) { @@ -3456,8 +3456,8 @@ namespace OpenTween settingDialog.ShowInTaskbar = showTaskbarIcon; settingDialog.IntervalChanged += this.TimerInterval_Changed; - settingDialog.tw = this.tw; - settingDialog.twitterApi = this.twitterApi; + settingDialog.Tw = this.tw; + settingDialog.TwitterApi = this.twitterApi; settingDialog.LoadConfig(SettingManager.Common, SettingManager.Local); @@ -3729,7 +3729,7 @@ namespace OpenTween this.SaveConfigsAll(false); if (this.tw.UserId != oldUser.UserId) - await this.doGetFollowersMenu(); + await this.DoGetFollowersMenu(); } /// @@ -4367,7 +4367,7 @@ namespace OpenTween var eHalf = ""; if (dialog.DialogResult == DialogResult.OK) { - if (!MyCommon.IsNullOrEmpty(dialog.inputText)) + if (!MyCommon.IsNullOrEmpty(dialog.InputText)) { if (selStart > 0) { @@ -4377,8 +4377,8 @@ namespace OpenTween { eHalf = owner.Text.Substring(selStart); } - owner.Text = fHalf + dialog.inputText + eHalf; - owner.SelectionStart = selStart + dialog.inputText.Length; + owner.Text = fHalf + dialog.InputText + eHalf; + owner.SelectionStart = selStart + dialog.InputText.Length; } } else @@ -5375,8 +5375,8 @@ namespace OpenTween var pinfo = new ProcessStartInfo { UseShellExecute = true, - WorkingDirectory = MyCommon.settingPath, - FileName = Path.Combine(MyCommon.settingPath, "TweenUp3.exe"), + WorkingDirectory = MyCommon.SettingPath, + FileName = Path.Combine(MyCommon.SettingPath, "TweenUp3.exe"), Arguments = "\"" + Application.StartupPath + "\"", }; @@ -5522,7 +5522,7 @@ namespace OpenTween this.DispSelectedPost(); } - public string createDetailHtml(string orgdata) + public string CreateDetailHtml(string orgdata) => this.detailHtmlFormatHeader + orgdata + this.detailHtmlFormatFooter; private void DispSelectedPost() @@ -5563,7 +5563,7 @@ namespace OpenTween loadTasks.Add(this.tweetThumbnail1.ShowThumbnailAsync(currentPost, token)); } - async Task delayedTasks() + async Task DelayedTasks() { try { @@ -5573,7 +5573,7 @@ namespace OpenTween } // サムネイルの読み込みを待たずに次に選択されたツイートを表示するため await しない - _ = delayedTasks(); + _ = DelayedTasks(); } private async void MatomeMenuItem_Click(object sender, EventArgs e) @@ -5773,7 +5773,7 @@ namespace OpenTween .Do(() => this.MakeReplyOrDirectStatus(isAuto: false, isReply: true)), ShortcutCommand.Create(Keys.Control | Keys.D) - .Do(() => this.doStatusDelete()), + .Do(() => this.DoStatusDelete()), ShortcutCommand.Create(Keys.Control | Keys.M) .Do(() => this.MakeReplyOrDirectStatus(isAuto: false, isReply: false)), @@ -5782,10 +5782,10 @@ namespace OpenTween .Do(() => this.FavoriteChange(FavAdd: true)), ShortcutCommand.Create(Keys.Control | Keys.I) - .Do(() => this.doRepliedStatusOpen()), + .Do(() => this.DoRepliedStatusOpen()), ShortcutCommand.Create(Keys.Control | Keys.Q) - .Do(() => this.doQuoteOfficial()), + .Do(() => this.DoQuoteOfficial()), ShortcutCommand.Create(Keys.Control | Keys.B) .Do(() => this.ReadedStripMenuItem_Click(this.ReadedStripMenuItem, EventArgs.Empty)), @@ -5991,11 +5991,11 @@ namespace OpenTween .Do(() => this.GoBackSelectPostChain()), ShortcutCommand.Create(Keys.Alt | Keys.R) - .Do(() => this.doReTweetOfficial(isConfirm: true)), + .Do(() => this.DoReTweetOfficial(isConfirm: true)), ShortcutCommand.Create(Keys.Alt | Keys.P) .OnlyWhen(() => this.CurrentPost != null) - .Do(() => this.doShowUserStatus(this.CurrentPost!.ScreenName, ShowInputDialog: false)), + .Do(() => this.DoShowUserStatus(this.CurrentPost!.ScreenName, ShowInputDialog: false)), ShortcutCommand.Create(Keys.Alt | Keys.Up) .Do(() => this.tweetDetailsView.ScrollDownPostBrowser(forward: false)), @@ -6041,7 +6041,7 @@ namespace OpenTween .Do(() => this.ImageSelectMenuItem_Click(this.ImageSelectMenuItem, EventArgs.Empty)), ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.H) - .Do(() => this.doMoveToRTHome()), + .Do(() => this.DoMoveToRTHome()), ShortcutCommand.Create(Keys.Control | Keys.Shift | Keys.Up) .FocusedOn(FocusedControl.StatusText) @@ -6157,14 +6157,14 @@ namespace OpenTween ShortcutCommand.Create(Keys.Alt | Keys.Shift | Keys.R) .FocusedOn(FocusedControl.PostBrowser) - .Do(() => this.doReTweetUnofficial()), + .Do(() => this.DoReTweetUnofficial()), ShortcutCommand.Create(Keys.Alt | Keys.Shift | Keys.T) .OnlyWhen(() => this.ExistCurrentPost) .Do(() => this.tweetDetailsView.DoTranslation()), ShortcutCommand.Create(Keys.Alt | Keys.Shift | Keys.R) - .Do(() => this.doReTweetUnofficial()), + .Do(() => this.DoReTweetUnofficial()), ShortcutCommand.Create(Keys.Alt | Keys.Shift | Keys.C, Keys.Alt | Keys.Shift | Keys.Insert) .Do(() => this.CopyUserId()), @@ -8468,7 +8468,7 @@ namespace OpenTween break; case MyCommon.DispTitleEnum.Post: if (this._history != null && this._history.Count > 1) - ttl.Append(this._history[this._history.Count - 2].status.Replace("\r\n", " ")); + ttl.Append(this._history[this._history.Count - 2].Status.Replace("\r\n", " ")); break; case MyCommon.DispTitleEnum.UnreadRepCount: ttl.AppendFormat(Properties.Resources.SetMainWindowTitleText1, this._statuses.MentionTab.UnreadCount + this._statuses.DirectMessageTab.UnreadCount); @@ -8809,7 +8809,7 @@ namespace OpenTween this.MarkSettingLocalModified(); } - private async Task doRepliedStatusOpen() + private async Task DoRepliedStatusOpen() { var currentPost = this.CurrentPost; if (this.ExistCurrentPost && currentPost != null && currentPost.InReplyToUser != null && currentPost.InReplyToStatusId != null) @@ -8838,7 +8838,7 @@ namespace OpenTween } private async void RepliedStatusOpenMenuItem_Click(object sender, EventArgs e) - => await this.doRepliedStatusOpen(); + => await this.DoRepliedStatusOpen(); private void SplitContainer2_Panel2_Resize(object sender, EventArgs e) { @@ -8917,7 +8917,7 @@ namespace OpenTween // nico.ms使用、nicovideoにマッチしたら変換 if (SettingManager.Common.Nicoms && Regex.IsMatch(tmp, nico)) { - result = nicoms.Shorten(tmp); + result = Nicoms.Shorten(tmp); } else if (Converter_Type != MyCommon.UrlConverter.Nicoms) { @@ -8946,7 +8946,7 @@ namespace OpenTween if (!MyCommon.IsNullOrEmpty(result)) { - var undotmp = new urlUndo(); + var undotmp = new UrlUndo(); // 短縮 URL が生成されるまでの間に投稿欄から元の URL が削除されていたら中断する var origUrlIndex = this.StatusText.Text.IndexOf(tmp, StringComparison.Ordinal); @@ -8962,7 +8962,7 @@ namespace OpenTween if (this.urlUndoBuffer == null) { - this.urlUndoBuffer = new List(); + this.urlUndoBuffer = new List(); this.UrlUndoToolStripMenuItem.Enabled = true; } @@ -8985,7 +8985,7 @@ namespace OpenTween var tmp = mt.Result("${url}"); if (tmp.StartsWith("w", StringComparison.OrdinalIgnoreCase)) tmp = "http://" + tmp; - var undotmp = new urlUndo(); + var undotmp = new UrlUndo(); // 選んだURLを選択(?) this.StatusText.Select(this.StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length); @@ -8993,7 +8993,7 @@ namespace OpenTween // nico.ms使用、nicovideoにマッチしたら変換 if (SettingManager.Common.Nicoms && Regex.IsMatch(tmp, nico)) { - result = nicoms.Shorten(tmp); + result = Nicoms.Shorten(tmp); } else if (Converter_Type != MyCommon.UrlConverter.Nicoms) { @@ -9044,7 +9044,7 @@ namespace OpenTween if (this.urlUndoBuffer == null) { - this.urlUndoBuffer = new List(); + this.urlUndoBuffer = new List(); this.UrlUndoToolStripMenuItem.Enabled = true; } @@ -9056,7 +9056,7 @@ namespace OpenTween return true; } - private void doUrlUndo() + private void DoUrlUndo() { if (this.urlUndoBuffer != null) { @@ -9100,7 +9100,7 @@ namespace OpenTween } private void UrlUndoToolStripMenuItem_Click(object sender, EventArgs e) - => this.doUrlUndo(); + => this.DoUrlUndo(); private void NewPostPopMenuItem_CheckStateChanged(object sender, EventArgs e) { @@ -9589,11 +9589,11 @@ namespace OpenTween i += 1; if (i > 24) break; // 120秒間初期処理が終了しなかったら強制的に打ち切る - if (MyCommon._endingFlag) + if (MyCommon.EndingFlag) return; } - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; if (ApplicationSettings.VersionInfoUrl != null) { @@ -9636,19 +9636,19 @@ namespace OpenTween this.timelineScheduler.Enabled = true; } - private async Task doGetFollowersMenu() + private async Task DoGetFollowersMenu() { await this.RefreshFollowerIdsAsync(); this.DispSelectedPost(true); } private async void GetFollowersAllToolStripMenuItem_Click(object sender, EventArgs e) - => await this.doGetFollowersMenu(); + => await this.DoGetFollowersMenu(); private void ReTweetUnofficialStripMenuItem_Click(object sender, EventArgs e) - => this.doReTweetUnofficial(); + => this.DoReTweetUnofficial(); - private async Task doReTweetOfficial(bool isConfirm) + private async Task DoReTweetOfficial(bool isConfirm) { // 公式RT if (this.ExistCurrentPost) @@ -9703,13 +9703,13 @@ namespace OpenTween } private async void ReTweetStripMenuItem_Click(object sender, EventArgs e) - => await this.doReTweetOfficial(true); + => await this.DoReTweetOfficial(true); private async Task FavoritesRetweetOfficial() { if (!this.ExistCurrentPost) return; this._DoFavRetweetFlags = true; - var retweetTask = this.doReTweetOfficial(true); + var retweetTask = this.DoReTweetOfficial(true); if (this._DoFavRetweetFlags) { this._DoFavRetweetFlags = false; @@ -9733,7 +9733,7 @@ namespace OpenTween if (!post.IsProtect && this._DoFavRetweetFlags) { this._DoFavRetweetFlags = false; - this.doReTweetUnofficial(); + this.DoReTweetUnofficial(); } await favoriteTask; @@ -10107,7 +10107,7 @@ namespace OpenTween } private async void OwnStatusMenuItem_Click(object sender, EventArgs e) - => await this.doShowUserStatus(this.tw.Username, false); + => await this.DoShowUserStatus(this.tw.Username, false); // TwitterIDでない固定文字列を調べる(文字列検証のみ 実際に取得はしない) // URLから切り出した文字列を渡す @@ -10120,7 +10120,7 @@ namespace OpenTween return !this.tw.Configuration.NonUsernamePaths.Contains(name, StringComparer.InvariantCultureIgnoreCase); } - private void doQuoteOfficial() + private void DoQuoteOfficial() { var post = this.CurrentPost; if (this.ExistCurrentPost && post != null) @@ -10145,7 +10145,7 @@ namespace OpenTween } } - private void doReTweetUnofficial() + private void DoReTweetUnofficial() { // RT @id:内容 var post = this.CurrentPost; @@ -10177,7 +10177,7 @@ namespace OpenTween } private void QuoteStripMenuItem_Click(object sender, EventArgs e) - => this.doQuoteOfficial(); + => this.DoQuoteOfficial(); private async void SearchButton_Click(object sender, EventArgs e) { @@ -10340,7 +10340,7 @@ namespace OpenTween } } - private async Task doMoveToRTHome() + private async Task DoMoveToRTHome() { var post = this.CurrentPost; if (post != null && post.RetweetedId != null) @@ -10348,7 +10348,7 @@ namespace OpenTween } private async void MoveToRTHomeMenuItem_Click(object sender, EventArgs e) - => await this.doMoveToRTHome(); + => await this.DoMoveToRTHome(); private void ListManageUserContextToolStripMenuItem_Click(object sender, EventArgs e) { @@ -10632,7 +10632,7 @@ namespace OpenTween private async void UserStatusToolStripMenuItem_Click(object sender, EventArgs e) => await this.ShowUserStatus(this.CurrentPost?.ScreenName ?? ""); - private async Task doShowUserStatus(string id, bool ShowInputDialog) + private async Task DoShowUserStatus(string id, bool ShowInputDialog) { TwitterUser? user = null; @@ -10671,10 +10671,10 @@ namespace OpenTween return; } - await this.doShowUserStatus(user); + await this.DoShowUserStatus(user); } - private async Task doShowUserStatus(TwitterUser user) + private async Task DoShowUserStatus(TwitterUser user) { using var userDialog = new UserInfoDialog(this, this.twitterApi); var showUserTask = userDialog.ShowUserAsync(user); @@ -10688,10 +10688,10 @@ namespace OpenTween } internal Task ShowUserStatus(string id, bool ShowInputDialog) - => this.doShowUserStatus(id, ShowInputDialog); + => this.DoShowUserStatus(id, ShowInputDialog); internal Task ShowUserStatus(string id) - => this.doShowUserStatus(id, true); + => this.DoShowUserStatus(id, true); private async void ShowProfileMenuItem_Click(object sender, EventArgs e) { @@ -10761,7 +10761,7 @@ namespace OpenTween this.tweetDetailsView.Owner = this; - this._hookGlobalHotkey.HotkeyPressed += this._hookGlobalHotkey_HotkeyPressed; + this._hookGlobalHotkey.HotkeyPressed += this.HookGlobalHotkey_HotkeyPressed; this.gh.NotifyClicked += this.GrowlHelper_Callback; // メイリオフォント指定時にタブの最小幅が広くなる問題の対策 @@ -10777,7 +10777,7 @@ namespace OpenTween this.InitializeShortcuts(); } - private void _hookGlobalHotkey_HotkeyPressed(object sender, KeyEventArgs e) + private void HookGlobalHotkey_HotkeyPressed(object sender, KeyEventArgs e) { if ((this.WindowState == FormWindowState.Normal || this.WindowState == FormWindowState.Maximized) && this.Visible && Form.ActiveForm == this) { @@ -11024,7 +11024,7 @@ namespace OpenTween private void TweenRestartMenuItem_Click(object sender, EventArgs e) { - MyCommon._endingFlag = true; + MyCommon.EndingFlag = true; try { this.Close(); @@ -11174,13 +11174,13 @@ namespace OpenTween this.AboutMenuItem.Text = MyCommon.ReplaceAppName(this.AboutMenuItem.Text); } - private void tweetThumbnail1_ThumbnailLoading(object sender, EventArgs e) + private void TweetThumbnail_ThumbnailLoading(object sender, EventArgs e) => this.SplitContainer3.Panel2Collapsed = false; - private async void tweetThumbnail1_ThumbnailDoubleClick(object sender, ThumbnailDoubleClickEventArgs e) + private async void TweetThumbnail_ThumbnailDoubleClick(object sender, ThumbnailDoubleClickEventArgs e) => await this.OpenThumbnailPicture(e.Thumbnail); - private async void tweetThumbnail1_ThumbnailImageSearchClick(object sender, ThumbnailImageSearchEventArgs e) + private async void TweetThumbnail_ThumbnailImageSearchClick(object sender, ThumbnailImageSearchEventArgs e) => await MyCommon.OpenInBrowserAsync(this, e.ImageUrl); private async Task OpenThumbnailPicture(ThumbnailInfo thumbnail) @@ -11259,7 +11259,7 @@ namespace OpenTween this.MarkSettingCommonModified(); } - private void tweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e) + private void TweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e) { if (!MyCommon.IsNullOrEmpty(e.StatusText)) { diff --git a/OpenTween/TweetDetailsView.cs b/OpenTween/TweetDetailsView.cs index 2ac51bc2..024b790b 100644 --- a/OpenTween/TweetDetailsView.cs +++ b/OpenTween/TweetDetailsView.cs @@ -177,14 +177,14 @@ namespace OpenTween } sb.Append("-----End PostClass Dump
"); - this.PostBrowser.DocumentText = this.Owner.createDetailHtml(sb.ToString()); + this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(sb.ToString()); return; } using (ControlTransaction.Update(this.PostBrowser)) { this.PostBrowser.DocumentText = - this.Owner.createDetailHtml(post.IsDeleted ? "(DELETED)" : post.Text); + this.Owner.CreateDetailHtml(post.IsDeleted ? "(DELETED)" : post.Text); this.PostBrowser.Document.Window.ScrollTo(0, 0); } @@ -283,7 +283,7 @@ namespace OpenTween var body = post.Text + string.Concat(loadingQuoteHtml) + loadingReplyHtml; using (ControlTransaction.Update(this.PostBrowser)) - this.PostBrowser.DocumentText = this.Owner.createDetailHtml(body); + this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(body); // 引用ツイートを読み込み var loadTweetTasks = quoteStatusIds.Select(x => this.CreateQuoteTweetHtml(x, isReply: false)).ToList(); @@ -300,7 +300,7 @@ namespace OpenTween body = post.Text + string.Concat(quoteHtmls); using (ControlTransaction.Update(this.PostBrowser)) - this.PostBrowser.DocumentText = this.Owner.createDetailHtml(body); + this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(body); } private async Task CreateQuoteTweetHtml(long statusId, bool isReply) @@ -374,7 +374,7 @@ namespace OpenTween langFrom: null, langTo: SettingManager.Common.TranslateLanguage); - this.PostBrowser.DocumentText = this.Owner.createDetailHtml(translatedText); + this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(translatedText); } catch (WebApiException e) { diff --git a/OpenTween/TweetExtractor.cs b/OpenTween/TweetExtractor.cs index 97e0d7b3..ed5dc607 100644 --- a/OpenTween/TweetExtractor.cs +++ b/OpenTween/TweetExtractor.cs @@ -47,7 +47,7 @@ namespace OpenTween ///
public static IEnumerable ExtractUrlEntities(string text) { - var urlMatches = Regex.Matches(text, Twitter.rgUrl, RegexOptions.IgnoreCase).Cast(); + var urlMatches = Regex.Matches(text, Twitter.RgUrl, RegexOptions.IgnoreCase).Cast(); foreach (var m in urlMatches) { var before = m.Groups["before"].Value; @@ -59,17 +59,17 @@ namespace OpenTween var validUrl = false; if (protocol.Length == 0) { - if (Regex.IsMatch(before, Twitter.url_invalid_without_protocol_preceding_chars)) + if (Regex.IsMatch(before, Twitter.UrlInvalidWithoutProtocolPrecedingChars)) continue; string? lasturl = null; var last_url_invalid_match = false; - var domainMatches = Regex.Matches(domain, Twitter.url_valid_ascii_domain, RegexOptions.IgnoreCase).Cast(); + var domainMatches = Regex.Matches(domain, Twitter.UrlValidAsciiDomain, RegexOptions.IgnoreCase).Cast(); foreach (var mm in domainMatches) { lasturl = mm.Value; - last_url_invalid_match = Regex.IsMatch(lasturl, Twitter.url_invalid_short_domain, RegexOptions.IgnoreCase); + last_url_invalid_match = Regex.IsMatch(lasturl, Twitter.UrlInvalidShortDomain, RegexOptions.IgnoreCase); if (!last_url_invalid_match) { validUrl = true; diff --git a/OpenTween/TweetFormatter.cs b/OpenTween/TweetFormatter.cs index a881dee4..7001c1f5 100644 --- a/OpenTween/TweetFormatter.cs +++ b/OpenTween/TweetFormatter.cs @@ -68,7 +68,7 @@ namespace OpenTween continue; // 区間が文字列長を越えている不正なエンティティを無視する if (curIndex != startIndex) - yield return t(e(text.Substring(curIndex, startIndex - curIndex))); + yield return T(E(text.Substring(curIndex, startIndex - curIndex))); var targetText = text.Substring(startIndex, endIndex - startIndex); @@ -81,13 +81,13 @@ namespace OpenTween else if (entity is TwitterEntityEmoji emojiEntity) yield return FormatEmojiEntity(targetText, emojiEntity); else - yield return t(e(targetText)); + yield return T(E(targetText)); curIndex = endIndex; } if (curIndex != text.Length) - yield return t(e(text.Substring(curIndex))); + yield return T(E(text.Substring(curIndex))); } /// @@ -133,7 +133,7 @@ namespace OpenTween if (entity.DisplayUrl == null) { expandedUrl = MyCommon.ConvertToReadableUrl(targetText); - return "" + t(e(targetText)) + ""; + return "" + T(E(targetText)) + ""; } var linkUrl = entity.Url; @@ -154,30 +154,30 @@ namespace OpenTween } } - return "" + t(e(entity.DisplayUrl)) + ""; + return "" + T(E(entity.DisplayUrl)) + ""; } private static string FormatHashtagEntity(string targetText, TwitterEntityHashtag entity) - => "" + t(e(targetText)) + ""; + => "" + T(E(targetText)) + ""; private static string FormatMentionEntity(string targetText, TwitterEntityMention entity) - => "" + t(e(targetText)) + ""; + => "" + T(E(targetText)) + ""; private static string FormatEmojiEntity(string targetText, TwitterEntityEmoji entity) { if (!SettingManager.Local.UseTwemoji) - return t(e(targetText)); + return T(E(targetText)); if (MyCommon.IsNullOrEmpty(entity.Url)) return ""; - return "\"""; + return "\"""; } // 長いのでエイリアスとして e(...), eu(...), t(...) でエスケープできるようにする - private static readonly Func e = EscapeHtml; - private static readonly Func eu = Uri.EscapeDataString; - private static readonly Func t = FilterText; + private static readonly Func E = EscapeHtml; + private static readonly Func EU = Uri.EscapeDataString; + private static readonly Func T = FilterText; private static string EscapeHtml(string text) { diff --git a/OpenTween/TweetThumbnail.Designer.cs b/OpenTween/TweetThumbnail.Designer.cs index 6e49c47c..702d6615 100644 --- a/OpenTween/TweetThumbnail.Designer.cs +++ b/OpenTween/TweetThumbnail.Designer.cs @@ -49,7 +49,7 @@ this.scrollBar.Maximum = 0; this.scrollBar.Name = "scrollBar"; this.toolTip.SetToolTip(this.scrollBar, resources.GetString("scrollBar.ToolTip")); - this.scrollBar.ValueChanged += new System.EventHandler(this.scrollBar_ValueChanged); + this.scrollBar.ValueChanged += new System.EventHandler(this.ScrollBar_ValueChanged); // // panelPictureBox // @@ -68,19 +68,19 @@ this.searchImageSauceNaoMenuItem}); this.contextMenuStrip.Name = "contextMenuStrip"; this.toolTip.SetToolTip(this.contextMenuStrip, resources.GetString("contextMenuStrip.ToolTip")); - this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip_Opening); + this.contextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStrip_Opening); // // openMenuItem // resources.ApplyResources(this.openMenuItem, "openMenuItem"); this.openMenuItem.Name = "openMenuItem"; - this.openMenuItem.Click += new System.EventHandler(this.openMenuItem_Click); + this.openMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // // copyUrlMenuItem // resources.ApplyResources(this.copyUrlMenuItem, "copyUrlMenuItem"); this.copyUrlMenuItem.Name = "copyUrlMenuItem"; - this.copyUrlMenuItem.Click += new System.EventHandler(this.copyUrlMenuItem_Click); + this.copyUrlMenuItem.Click += new System.EventHandler(this.CopyUrlMenuItem_Click); // // toolStripSeparator1 // @@ -91,13 +91,13 @@ // resources.ApplyResources(this.searchImageGoogleMenuItem, "searchImageGoogleMenuItem"); this.searchImageGoogleMenuItem.Name = "searchImageGoogleMenuItem"; - this.searchImageGoogleMenuItem.Click += new System.EventHandler(this.searchSimilarImageMenuItem_Click); + this.searchImageGoogleMenuItem.Click += new System.EventHandler(this.SearchSimilarImageMenuItem_Click); // // searchImageSauceNaoMenuItem // resources.ApplyResources(this.searchImageSauceNaoMenuItem, "searchImageSauceNaoMenuItem"); this.searchImageSauceNaoMenuItem.Name = "searchImageSauceNaoMenuItem"; - this.searchImageSauceNaoMenuItem.Click += new System.EventHandler(this.searchImageSauceNaoMenuItem_Click); + this.searchImageSauceNaoMenuItem.Click += new System.EventHandler(this.SearchImageSauceNaoMenuItem_Click); // // TweetThumbnail // diff --git a/OpenTween/TweetThumbnail.cs b/OpenTween/TweetThumbnail.cs index 97a7d614..4a7e48e6 100644 --- a/OpenTween/TweetThumbnail.cs +++ b/OpenTween/TweetThumbnail.cs @@ -43,7 +43,7 @@ namespace OpenTween { public partial class TweetThumbnail : UserControl { - protected internal List pictureBox = new List(); + protected internal List PictureBox = new List(); protected MouseWheelMessageFilter filter = new MouseWheelMessageFilter(); public event EventHandler? ThumbnailLoading; @@ -51,7 +51,7 @@ namespace OpenTween public event EventHandler? ThumbnailImageSearchClick; public ThumbnailInfo Thumbnail - => (ThumbnailInfo)this.pictureBox[this.scrollBar.Value].Tag; + => (ThumbnailInfo)this.PictureBox[this.scrollBar.Value].Tag; public TweetThumbnail() => this.InitializeComponent(); @@ -84,7 +84,7 @@ namespace OpenTween for (var i = 0; i < thumbnails.Length; i++) { var thumb = thumbnails[i]; - var picbox = this.pictureBox[i]; + var picbox = this.PictureBox[i]; picbox.Tag = thumb; picbox.ContextMenuStrip = this.contextMenuStrip; @@ -128,20 +128,20 @@ namespace OpenTween /// 表示するサムネイルの数 protected void SetThumbnailCount(int count) { - if (count == 0 && this.pictureBox.Count == 0) + if (count == 0 && this.PictureBox.Count == 0) return; using (ControlTransaction.Layout(this.panelPictureBox, false)) { this.panelPictureBox.Controls.Clear(); - foreach (var picbox in this.pictureBox) + foreach (var picbox in this.PictureBox) { var memoryImage = picbox.Image; this.filter.Unregister(picbox); - picbox.MouseWheel -= this.pictureBox_MouseWheel; - picbox.DoubleClick -= this.pictureBox_DoubleClick; + picbox.MouseWheel -= this.PictureBox_MouseWheel; + picbox.DoubleClick -= this.PictureBox_DoubleClick; picbox.Dispose(); memoryImage?.Dispose(); @@ -149,7 +149,7 @@ namespace OpenTween // メモリリーク対策 (http://stackoverflow.com/questions/2792427#2793714) picbox.ContextMenuStrip = null; } - this.pictureBox.Clear(); + this.PictureBox.Clear(); this.scrollBar.Maximum = (count > 0) ? count - 1 : 0; this.scrollBar.Value = 0; @@ -158,13 +158,13 @@ namespace OpenTween { var picbox = this.CreatePictureBox("pictureBox" + i); picbox.Visible = i == 0; - picbox.MouseWheel += this.pictureBox_MouseWheel; - picbox.DoubleClick += this.pictureBox_DoubleClick; + picbox.MouseWheel += this.PictureBox_MouseWheel; + picbox.DoubleClick += this.PictureBox_DoubleClick; this.filter.Register(picbox); this.panelPictureBox.Controls.Add(picbox); - this.pictureBox.Add(picbox); + this.PictureBox.Add(picbox); } } } @@ -211,19 +211,19 @@ namespace OpenTween OTBaseForm.ScaleChildControl(this.scrollBar, factor); } - private void scrollBar_ValueChanged(object sender, EventArgs e) + private void ScrollBar_ValueChanged(object sender, EventArgs e) { using (ControlTransaction.Layout(this, false)) { var value = this.scrollBar.Value; - for (var i = 0; i < this.pictureBox.Count; i++) + for (var i = 0; i < this.PictureBox.Count; i++) { - this.pictureBox[i].Visible = i == value; + this.PictureBox[i].Visible = i == value; } } } - private void pictureBox_MouseWheel(object sender, MouseEventArgs e) + private void PictureBox_MouseWheel(object sender, MouseEventArgs e) { if (e.Delta > 0) this.ScrollUp(); @@ -231,13 +231,13 @@ namespace OpenTween this.ScrollDown(); } - private void pictureBox_DoubleClick(object sender, EventArgs e) + private void PictureBox_DoubleClick(object sender, EventArgs e) { if (((PictureBox)sender).Tag is ThumbnailInfo thumb) this.OpenImage(thumb); } - private void contextMenuStrip_Opening(object sender, CancelEventArgs e) + private void ContextMenuStrip_Opening(object sender, CancelEventArgs e) { var picbox = (OTPictureBox)this.contextMenuStrip.SourceControl; var thumb = (ThumbnailInfo)picbox.Tag; @@ -257,7 +257,7 @@ namespace OpenTween } } - private void searchSimilarImageMenuItem_Click(object sender, EventArgs e) + private void SearchSimilarImageMenuItem_Click(object sender, EventArgs e) { var searchTargetUri = (string)this.searchImageGoogleMenuItem.Tag; var searchUri = this.GetImageSearchUriGoogle(searchTargetUri); @@ -265,7 +265,7 @@ namespace OpenTween this.ThumbnailImageSearchClick?.Invoke(this, new ThumbnailImageSearchEventArgs(searchUri)); } - private void searchImageSauceNaoMenuItem_Click(object sender, EventArgs e) + private void SearchImageSauceNaoMenuItem_Click(object sender, EventArgs e) { var searchTargetUri = (string)this.searchImageSauceNaoMenuItem.Tag; var searchUri = this.GetImageSearchUriSauceNao(searchTargetUri); @@ -273,10 +273,10 @@ namespace OpenTween this.ThumbnailImageSearchClick?.Invoke(this, new ThumbnailImageSearchEventArgs(searchUri)); } - private void openMenuItem_Click(object sender, EventArgs e) + private void OpenMenuItem_Click(object sender, EventArgs e) => this.OpenImage(this.Thumbnail); - private void copyUrlMenuItem_Click(object sender, EventArgs e) + private void CopyUrlMenuItem_Click(object sender, EventArgs e) { try { diff --git a/OpenTween/Twitter.cs b/OpenTween/Twitter.cs index f2c31cdc..17680f49 100644 --- a/OpenTween/Twitter.cs +++ b/OpenTween/Twitter.cs @@ -81,37 +81,37 @@ namespace OpenTween private const string HASHTAG_TERMINATOR = "[^A-Za-z0-9_" + LATIN_ACCENTS + NON_LATIN_HASHTAG_CHARS + CJ_HASHTAG_CHARACTERS + "]"; public const string HASHTAG = "(" + HASHTAG_BOUNDARY + ")(#|#)(" + HASHTAG_ALPHANUMERIC + "*" + HASHTAG_ALPHA + HASHTAG_ALPHANUMERIC + "*)(?=" + HASHTAG_TERMINATOR + "|" + HASHTAG_BOUNDARY + ")"; // URL正規表現 - private const string url_valid_preceding_chars = @"(?:[^A-Za-z0-9@@$##\ufffe\ufeff\uffff\u202a-\u202e]|^)"; - public const string url_invalid_without_protocol_preceding_chars = @"[-_./]$"; - private const string url_invalid_domain_chars = @"\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$\u2000-\u200a\u0009-\u000d\u0020\u0085\u00a0\u1680\u180e\u2028\u2029\u202f\u205f\u3000\ufffe\ufeff\uffff\u202a-\u202e"; - private const string url_valid_domain_chars = @"[^" + url_invalid_domain_chars + "]"; - private const string url_valid_subdomain = @"(?:(?:" + url_valid_domain_chars + @"(?:[_-]|" + url_valid_domain_chars + @")*)?" + url_valid_domain_chars + @"\.)"; - private const string url_valid_domain_name = @"(?:(?:" + url_valid_domain_chars + @"(?:-|" + url_valid_domain_chars + @")*)?" + url_valid_domain_chars + @"\.)"; - private const string url_valid_GTLD = @"(?:(?:aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|xxx)(?=[^0-9a-zA-Z]|$))"; - private const string url_valid_CCTLD = @"(?:(?:ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?=[^0-9a-zA-Z]|$))"; - private const string url_valid_punycode = @"(?:xn--[0-9a-z]+)"; - private const string url_valid_domain = @"(?" + url_valid_subdomain + "*" + url_valid_domain_name + "(?:" + url_valid_GTLD + "|" + url_valid_CCTLD + ")|" + url_valid_punycode + ")"; - public const string url_valid_ascii_domain = @"(?:(?:[a-z0-9" + LATIN_ACCENTS + @"]+)\.)+(?:" + url_valid_GTLD + "|" + url_valid_CCTLD + "|" + url_valid_punycode + ")"; - public const string url_invalid_short_domain = "^" + url_valid_domain_name + url_valid_CCTLD + "$"; - private const string url_valid_port_number = @"[0-9]+"; - - private const string url_valid_general_path_chars = @"[a-z0-9!*';:=+,.$/%#\[\]\-_~|&" + LATIN_ACCENTS + "]"; - private const string url_balance_parens = @"(?:\(" + url_valid_general_path_chars + @"+\))"; - private const string url_valid_path_ending_chars = @"(?:[+\-a-z0-9=_#/" + LATIN_ACCENTS + "]|" + url_balance_parens + ")"; - private const string pth = "(?:" + + private const string UrlValidPrecedingChars = @"(?:[^A-Za-z0-9@@$##\ufffe\ufeff\uffff\u202a-\u202e]|^)"; + public const string UrlInvalidWithoutProtocolPrecedingChars = @"[-_./]$"; + private const string UrlInvalidDomainChars = @"\!'#%&'\(\)*\+,\\\-\.\/:;<=>\?@\[\]\^_{|}~\$\u2000-\u200a\u0009-\u000d\u0020\u0085\u00a0\u1680\u180e\u2028\u2029\u202f\u205f\u3000\ufffe\ufeff\uffff\u202a-\u202e"; + private const string UrlValidDomainChars = @"[^" + UrlInvalidDomainChars + "]"; + private const string UrlValidSubdomain = @"(?:(?:" + UrlValidDomainChars + @"(?:[_-]|" + UrlValidDomainChars + @")*)?" + UrlValidDomainChars + @"\.)"; + private const string UrlValidDomainName = @"(?:(?:" + UrlValidDomainChars + @"(?:-|" + UrlValidDomainChars + @")*)?" + UrlValidDomainChars + @"\.)"; + private const string UrlValidGTLD = @"(?:(?:aero|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|xxx)(?=[^0-9a-zA-Z]|$))"; + private const string UrlValidCCTLD = @"(?:(?:ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw)(?=[^0-9a-zA-Z]|$))"; + private const string UrlValidPunycode = @"(?:xn--[0-9a-z]+)"; + private const string UrlValidDomain = @"(?" + UrlValidSubdomain + "*" + UrlValidDomainName + "(?:" + UrlValidGTLD + "|" + UrlValidCCTLD + ")|" + UrlValidPunycode + ")"; + public const string UrlValidAsciiDomain = @"(?:(?:[a-z0-9" + LATIN_ACCENTS + @"]+)\.)+(?:" + UrlValidGTLD + "|" + UrlValidCCTLD + "|" + UrlValidPunycode + ")"; + public const string UrlInvalidShortDomain = "^" + UrlValidDomainName + UrlValidCCTLD + "$"; + private const string UrlValidPortNumber = @"[0-9]+"; + + private const string UrlValidGeneralPathChars = @"[a-z0-9!*';:=+,.$/%#\[\]\-_~|&" + LATIN_ACCENTS + "]"; + private const string UrlBalanceParens = @"(?:\(" + UrlValidGeneralPathChars + @"+\))"; + private const string UrlValidPathEndingChars = @"(?:[+\-a-z0-9=_#/" + LATIN_ACCENTS + "]|" + UrlBalanceParens + ")"; + private const string Pth = "(?:" + "(?:" + - url_valid_general_path_chars + "*" + - "(?:" + url_balance_parens + url_valid_general_path_chars + "*)*" + - url_valid_path_ending_chars + - ")|(?:@" + url_valid_general_path_chars + "+/)" + + UrlValidGeneralPathChars + "*" + + "(?:" + UrlBalanceParens + UrlValidGeneralPathChars + "*)*" + + UrlValidPathEndingChars + + ")|(?:@" + UrlValidGeneralPathChars + "+/)" + ")"; - private const string qry = @"(?\?[a-z0-9!?*'();:&=+$/%#\[\]\-_.,~|]*[a-z0-9_&=#/])?"; - public const string rgUrl = @"(?" + url_valid_preceding_chars + ")" + + private const string Qry = @"(?\?[a-z0-9!?*'();:&=+$/%#\[\]\-_.,~|]*[a-z0-9_&=#/])?"; + public const string RgUrl = @"(?" + UrlValidPrecedingChars + ")" + "(?(?https?://)?" + - "(?" + url_valid_domain + ")" + - "(?::" + url_valid_port_number + ")?" + - "(?/" + pth + "*)?" + - qry + + "(?" + UrlValidDomain + ")" + + "(?::" + UrlValidPortNumber + ")?" + + "(?/" + Pth + "*)?" + + Qry + ")"; #endregion @@ -1361,7 +1361,7 @@ namespace OpenTween /// public async Task RefreshFollowerIds() { - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; var cursor = -1L; var newFollowerIds = Enumerable.Empty(); @@ -1389,7 +1389,7 @@ namespace OpenTween /// public async Task RefreshNoRetweetIds() { - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; this.noRTId = await this.Api.NoRetweetIds() .ConfigureAwait(false); @@ -1596,7 +1596,7 @@ namespace OpenTween { if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return null; - if (MyCommon._endingFlag) return null; + if (MyCommon.EndingFlag) return null; var limits = await this.Api.ApplicationRateLimitStatus() .ConfigureAwait(false); @@ -1612,7 +1612,7 @@ namespace OpenTween /// public async Task RefreshBlockIds() { - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; var cursor = -1L; var newBlockIds = Enumerable.Empty(); @@ -1637,7 +1637,7 @@ namespace OpenTween /// public async Task RefreshMuteUserIdsAsync() { - if (MyCommon._endingFlag) return; + if (MyCommon.EndingFlag) return; var ids = await TwitterIds.GetAllItemsAsync(x => this.Api.MutesUsersIds(x)) .ConfigureAwait(false); diff --git a/OpenTween/UserInfo.cs b/OpenTween/UserInfo.cs index ad8d69f7..689256a9 100644 --- a/OpenTween/UserInfo.cs +++ b/OpenTween/UserInfo.cs @@ -84,8 +84,6 @@ namespace OpenTween public string RecentPost = ""; public DateTimeUtc PostCreatedAt; public string PostSource = ""; // html形式 "Tween" - public bool isFollowing = false; - public bool isFollowed = false; public override string ToString() => this.ScreenName + " / " + this.Name; diff --git a/OpenTween/UserInfoDialog.cs b/OpenTween/UserInfoDialog.cs index f6db1c49..0cdc1f60 100644 --- a/OpenTween/UserInfoDialog.cs +++ b/OpenTween/UserInfoDialog.cs @@ -178,7 +178,7 @@ namespace OpenTween .Concat(TweetExtractor.ExtractEmojiEntities(descriptionText)); var html = TweetFormatter.AutoLinkHtml(descriptionText, mergedEntities); - html = this.mainForm.createDetailHtml(html); + html = this.mainForm.CreateDetailHtml(html); if (cancellationToken.IsCancellationRequested) return; @@ -257,7 +257,7 @@ namespace OpenTween var mergedEntities = entities.Concat(TweetExtractor.ExtractEmojiEntities(status.FullText)); var html = TweetFormatter.AutoLinkHtml(status.FullText, mergedEntities); - html = this.mainForm.createDetailHtml(html + + html = this.mainForm.CreateDetailHtml(html + " Posted at " + MyCommon.DateTimeParse(status.CreatedAt).ToLocalTimeString() + " via " + status.Source); -- 2.11.0