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<TwitterApiConnection>(twitterApi.apiConnection);
+ Assert.IsType<TwitterApiConnection>(twitterApi.ApiConnection);
- var apiConnection = (TwitterApiConnection)twitterApi.apiConnection!;
+ var apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!;
Assert.Equal("*** AccessToken ***", apiConnection.AccessToken);
Assert.Equal("*** AccessSecret ***", apiConnection.AccessSecret);
var oldApiConnection = apiConnection;
Assert.True(oldApiConnection.IsDisposed);
- Assert.IsType<TwitterApiConnection>(twitterApi.apiConnection);
+ Assert.IsType<TwitterApiConnection>(twitterApi.ApiConnection);
- apiConnection = (TwitterApiConnection)twitterApi.apiConnection!;
+ apiConnection = (TwitterApiConnection)twitterApi.ApiConnection!;
Assert.Equal("*** AccessToken2 ***", apiConnection.AccessToken);
Assert.Equal("*** AccessSecret2 ***", apiConnection.AccessSecret);
.ReturnsAsync(Array.Empty<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.StatusesHomeTimeline(200, maxId: 900L, sinceId: 100L)
.ConfigureAwait(false);
.ReturnsAsync(Array.Empty<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.StatusesMentionsTimeline(200, maxId: 900L, sinceId: 100L)
.ConfigureAwait(false);
.ReturnsAsync(Array.Empty<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.StatusesUserTimeline("twitterapi", count: 200, maxId: 900L, sinceId: 100L)
.ConfigureAwait(false);
.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);
.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",
.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<long>())
.IgnoreResponse()
.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()
.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()
.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);
.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);
.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);
.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);
.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()
.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()
.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()
.ReturnsAsync(Array.Empty<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.ListsStatuses(12345L, count: 200, maxId: 900L, sinceId: 100L, includeRTs: true)
.ConfigureAwait(false);
.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);
.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);
.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()
.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()
.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);
.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);
.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);
.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);
.ReturnsAsync(Array.Empty<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.UsersLookup(userIds: new[] { "11111", "22222" })
.ConfigureAwait(false);
.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()
.ReturnsAsync(Array.Empty<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.FavoritesList(200, maxId: 900L, sinceId: 100L)
.ConfigureAwait(false);
.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()
.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()
.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);
.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()
.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()
.ReturnsAsync(Array.Empty<long>());
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);
.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);
.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);
.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);
.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()
.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()
});
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);
.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: "<script>alert(1)</script>")
.IgnoreResponse()
.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()
.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);
.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);
.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()
.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);
.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()
.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);
.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);
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 =>
{
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 =>
{
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 =>
{
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 =>
{
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 =>
{
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 =>
{
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 =>
{
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);
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 =>
{
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 =>
{
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 =>
{
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 =>
{
{
private class TestDebounceTimer : DebounceTimer
{
- public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask);
+ public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask);
public TestDebounceTimer(Func<Task> timerCallback, TimeSpan interval, bool leading, bool trailing)
: base(timerCallback, interval, leading, trailing)
}
protected override ITimer CreateTimer(Func<Task> callback)
- => this.mockTimer = new MockTimer(callback);
+ => this.MockTimer = new MockTimer(callback);
}
[Fact]
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);
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);
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);
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);
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);
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);
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);
{
public class LRUCacheDictionaryTest
{
- private static readonly AnyOrderComparer<string> collComparer = AnyOrderComparer<string>.Instance;
+ private static readonly AnyOrderComparer<string> CollComparer = AnyOrderComparer<string>.Instance;
[Fact]
public void InnerListTest()
["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);
_ = 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);
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アクセス目
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]
dict.Trim();
// 直近に参照された 3, 4 以外のアイテムに対してイベントが発生しているはず
- Assert.Equal(new[] { "key1", "key2" }, removedList, collComparer);
+ Assert.Equal(new[] { "key1", "key2" }, removedList, CollComparer);
}
// ここから下は IDictionary としての機能が正しく動作するかのテスト
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);
}
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);
var ret = dict.Remove(new KeyValuePair<string, string>("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<string, string>("key2", "hogehoge"));
Assert.False(ret);
dict.Remove(new KeyValuePair<string, string>("key2", "value2"));
dict.Remove(new KeyValuePair<string, string>("key3", "value3"));
- Assert.Empty(dict.innerDict);
- Assert.Empty(dict.innerList);
+ Assert.Empty(dict.InnerDict);
+ Assert.Empty(dict.InnerList);
ret = dict.Remove(new KeyValuePair<string, string>("hogehoge", "hogehoge"));
Assert.False(ret);
};
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]
["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);
["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);
class FakeExpandedUrlInfo : PostClass.ExpandedUrlInfo
{
- public TaskCompletionSource<string> fakeResult = new TaskCompletionSource<string>();
+ public TaskCompletionSource<string> FakeResult = new TaskCompletionSource<string>();
public FakeExpandedUrlInfo(string url, string expandedUrl, bool deepExpand)
: base(url, expandedUrl, deepExpand)
}
protected override async Task DeepExpandAsync()
- => this._expandedUrl = await this.fakeResult.Task;
+ => this._expandedUrl = await this.FakeResult.Task;
}
[Fact]
Assert.Equal("<a href=\"http://t.co/aaaaaaa\" title=\"http://bit.ly/abcde\">bit.ly/abcde</a>", 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 による展開が完了した後の状態
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);
[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()
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);
}
{
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)
}
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);
try
{
- @object.PropertyChanged += handler;
+ @object.PropertyChanged += Handler;
testCode();
}
finally
{
- @object.PropertyChanged -= handler;
+ @object.PropertyChanged -= Handler;
}
}
{
private class TestThrottleTimer : ThrottleTimer
{
- public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask);
+ public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask);
public TestThrottleTimer(Func<Task> timerCallback, TimeSpan interval)
: base(timerCallback, interval)
}
protected override ITimer CreateTimer(Func<Task> callback)
- => this.mockTimer = new MockTimer(callback);
+ => this.MockTimer = new MockTimer(callback);
}
[Fact]
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);
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);
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);
{
private class TestTimelineScheduler : TimelineScheduler
{
- public MockTimer mockTimer = new MockTimer(() => Task.CompletedTask);
+ public MockTimer MockTimer = new MockTimer(() => Task.CompletedTask);
public TestTimelineScheduler()
: base()
}
protected override ITimer CreateTimer(Func<Task> callback)
- => this.mockTimer = new MockTimer(callback);
+ => this.MockTimer = new MockTimer(callback);
}
[Fact]
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);
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);
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);
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);
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);
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();
}
// 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();
}
);
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);
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<OTPictureBox>());
+ Assert.Equal(thumbbox.PictureBox, thumbbox.panelPictureBox.Controls.Cast<OTPictureBox>());
Assert.Equal(0, thumbbox.scrollBar.Minimum);
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<ThumbnailInfo>(thumbbox.pictureBox[0].Tag);
- var thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[0].Tag;
+ Assert.IsAssignableFrom<ThumbnailInfo>(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]));
}
}
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<ThumbnailInfo>(thumbbox.pictureBox[0].Tag);
- var thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[0].Tag;
+ Assert.IsAssignableFrom<ThumbnailInfo>(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<ThumbnailInfo>(thumbbox.pictureBox[1].Tag);
- thumbinfo = (ThumbnailInfo)thumbbox.pictureBox[1].Tag;
+ Assert.IsAssignableFrom<ThumbnailInfo>(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]));
}
}
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);
}
}
}
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()
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()
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);
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;
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;
=> ((TwitterApiConnection)this.Connection).CreateOAuthEchoHandler(authServiceProvider, realm);
public void Dispose()
- => this.apiConnection?.Dispose();
+ => this.ApiConnection?.Dispose();
}
}
{
public event EventHandler<IntervalChangedEventArgs>? IntervalChanged;
- internal Twitter tw = null!;
- internal TwitterApi twitterApi = null!;
+ internal Twitter Tw = null!;
+ internal TwitterApi TwitterApi = null!;
public AppendSettingDialog()
{
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;
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);
}
}
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)
{
{
// 同じ設定ファイルを使用する 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))
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();
});
Directory.CreateDirectory(roamingDir);
- MyCommon.settingPath = roamingDir;
+ MyCommon.SettingPath = roamingDir;
/*
* 書き込みが制限されたディレクトリ内で起動された場合の設定ファイルの扱い
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);
}
{
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)
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;
}
{
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();
}
{
if (e.KeyCode == Keys.Tab)
{
- this.inputText = this.TextId.Text + " ";
+ this.InputText = this.TextId.Text + " ";
this.isBack = false;
this.Close();
}
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;
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<T> GetAsync<T>(Uri uri, IDictionary<string, string>? param, string? endpointName)
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)
try
{
- return await this.http.GetStreamAsync(requestUri)
+ return await this.Http.GetStreamAsync(requestUri)
.ConfigureAwait(false);
}
catch (HttpRequestException ex)
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)
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)
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)
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)
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)
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)
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();
}
}
[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]
var nmhdr = Marshal.PtrToStructure<NMHDR>(m.LParam);
// Ctrl+クリックで選択状態を変更した場合にイベントが発生しない問題への対処
- if (nmhdr.code == LVN_ODSTATECHANGED)
+ if (nmhdr.Code == LVN_ODSTATECHANGED)
this.OnSelectedIndexChanged(EventArgs.Empty);
break;
}
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
//
}
}
- private void buttonRuleToggleEnabled_Click(object sender, EventArgs e)
+ private void ButtonRuleToggleEnabled_Click(object sender, EventArgs e)
{
if (this.RuleEnableButtonMode == EnableButtonMode.NotSelected)
return;
if (e.KeyChar == '#')
{
this._hashSupl.ShowDialog();
- if (!MyCommon.IsNullOrEmpty(this._hashSupl.inputText))
+ if (!MyCommon.IsNullOrEmpty(this._hashSupl.InputText))
{
var fHalf = "";
var eHalf = "";
{
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;
}
/// <summary>
/// キャッシュとして URL と取得した画像を対に保持する辞書
/// </summary>
- internal LRUCacheDictionary<string, Task<MemoryImage>> innerDictionary;
+ internal LRUCacheDictionary<string, Task<MemoryImage>> InnerDictionary;
/// <summary>
/// 非同期タスクをキャンセルするためのトークンのもと
public ImageCache()
{
- this.innerDictionary = new LRUCacheDictionary<string, Task<MemoryImage>>(trimLimit: 300, autoTrimCount: 100);
- this.innerDictionary.CacheRemoved += (s, e) => {
+ this.InnerDictionary = new LRUCacheDictionary<string, Task<MemoryImage>>(trimLimit: 300, autoTrimCount: 100);
+ this.InnerDictionary.CacheRemoved += (s, e) => {
// まだ参照されている場合もあるのでDisposeはファイナライザ任せ
this.CacheRemoveCount++;
};
/// 保持しているキャッシュの件数
/// </summary>
public long CacheCount
- => this.innerDictionary.Count;
+ => this.InnerDictionary.Count;
/// <summary>
/// 破棄されたキャッシュの件数
{
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;
}
cancelToken.ThrowIfCancellationRequested();
var imageTask = this.FetchImageAsync(address, cancelToken);
- this.innerDictionary[address] = imageTask;
+ this.InnerDictionary[address] = imageTask;
return imageTask;
}
{
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;
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();
}
}
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
//
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
//
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)
}
public event EventHandler<CacheRemovedEventArgs>? CacheRemoved;
- internal LinkedList<KeyValuePair<TKey, TValue>> innerList;
- internal Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> innerDict;
+ internal LinkedList<KeyValuePair<TKey, TValue>> InnerList;
+ internal Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> InnerDict;
- internal int accessCount = 0;
+ internal int AccessCount = 0;
public LRUCacheDictionary()
: this(trimLimit: int.MaxValue, autoTrimCount: int.MaxValue)
this.TrimLimit = trimLimit;
this.AutoTrimCount = autoTrimCount;
- this.innerList = new LinkedList<KeyValuePair<TKey, TValue>>();
- this.innerDict = new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>();
+ this.InnerList = new LinkedList<KeyValuePair<TKey, TValue>>();
+ this.InnerDict = new Dictionary<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>>();
}
/// <summary>
/// </summary>
protected void UpdateAccess(LinkedListNode<KeyValuePair<TKey, TValue>> node)
{
- this.innerList.Remove(node);
- this.innerList.AddFirst(node);
+ this.InnerList.Remove(node);
+ this.InnerList.AddFirst(node);
}
public bool Trim()
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));
}
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();
}
public void Add(KeyValuePair<TKey, TValue> item)
{
var node = new LinkedListNode<KeyValuePair<TKey, TValue>>(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<TKey, TValue> 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<TValue>.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<TKey, TValue> 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<TValue>.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)
{
this.UpdateAccess(node);
value = node.Value.Value;
- this.accessCount++;
+ this.AccessCount++;
this.AutoTrim();
return true;
}
public ICollection<TKey> Keys
- => this.innerDict.Keys;
+ => this.InnerDict.Keys;
public ICollection<TValue> 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;
{
var pair = new KeyValuePair<TKey, TValue>(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<KeyValuePair<TKey, TValue>>(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<TKey, TValue>[] array, int arrayIndex)
}
public int Count
- => this.innerDict.Count;
+ => this.InnerDict.Count;
public bool IsReadOnly
=> false;
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
- => this.innerDict.Select(x => x.Value.Value).GetEnumerator();
+ => this.InnerDict.Select(x => x.Value.Value).GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
=> this.GetEnumerator();
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
//
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;
// トランザクション用
private readonly object LockObj = new object();
- private static readonly TabInformations _instance = new TabInformations();
+ private static readonly TabInformations Instance = new TabInformations();
// List
private List<ListElement> _lists = new List<ListElement>();
}
public static TabInformations GetInstance()
- => _instance; // singleton
+ => Instance; // singleton
public string SelectedTabName { get; private set; } = "";
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
{
/// <param name="keys">状態を調べるキー</param>
/// <returns><paramref name="keys"/> で指定された修飾キーがすべて押されている状態であれば true。それ以外であれば false。</returns>
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)
{
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/",
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));
<Compile Include="MyLists.Designer.cs">
<DependentUpon>MyLists.cs</DependentUpon>
</Compile>
- <Compile Include="nicoms.cs" />
+ <Compile Include="Nicoms.cs" />
<Compile Include="OpenURL.cs">
<SubType>Form</SubType>
</Compile>
//
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
//
//
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
//
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
//
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
//
//
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
//
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()
}
}
- private void buttonSearchTimeline_Click(object sender, EventArgs e)
+ private void ButtonSearchTimeline_Click(object sender, EventArgs e)
{
if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text))
{
);
}
- private void buttonSearchTimelineNew_Click(object sender, EventArgs e)
+ private void ButtonSearchTimelineNew_Click(object sender, EventArgs e)
{
if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text))
{
);
}
- private void buttonSearchPublic_Click(object sender, EventArgs e)
+ private void ButtonSearchPublic_Click(object sender, EventArgs e)
{
if (MyCommon.IsNullOrEmpty(this.textSearchPublic.Text))
{
);
}
- 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";
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
//
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
//
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
//
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
//
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;
}
}
- private void buttonNotSend_Click(object sender, EventArgs e)
+ private void ButtonNotSend_Click(object sender, EventArgs e)
=> this.DialogResult = DialogResult.Cancel;
}
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
//
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
//
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
//
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
//
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
//
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
//
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
//
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
//
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);
}
}
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
//
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);
}
}
[XmlAnyElement]
public XmlElement[] ExtraElements = Array.Empty<XmlElement>();
- private static readonly object lockObj = new object();
+ private static readonly object LockObj = new object();
protected static T LoadSettings(string FileId)
{
return new T();
}
- lock (lockObj)
+ lock (LockObj)
{
using var fs = new FileStream(settingFilePath, FileMode.Open, FileAccess.Read);
fs.Position = 0;
{
try
{
- lock (lockObj)
+ lock (LockObj)
{
using var fs = new FileStream(backupFile, FileMode.Open, FileAccess.Read);
fs.Position = 0;
var tmpfilePath = GetSettingFilePath("_" + Path.GetRandomFileName());
try
{
- lock (lockObj)
+ lock (LockObj)
{
using (var stream = new FileStream(tmpfilePath, FileMode.Create, FileAccess.Write))
{
=> 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");
}
}
/// </summary>
public class ShortUrl
{
- private static readonly Lazy<ShortUrl> _instance;
+ private static readonly Lazy<ShortUrl> InstanceLazy;
/// <summary>
/// ShortUrl のインスタンスを取得します
/// </summary>
public static ShortUrl Instance
- => _instance.Value;
+ => InstanceLazy.Value;
/// <summary>
/// 短縮 URL の展開を無効にするか否か
};
static ShortUrl()
- => _instance = new Lazy<ShortUrl>(() => new ShortUrl(), true);
+ => InstanceLazy = new Lazy<ShortUrl>(() => new ShortUrl(), true);
[SuppressMessage("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")]
internal ShortUrl()
public static readonly string ApiBase = "https://api.foursquare.com/v2";
- protected HttpClient http
+ protected HttpClient Http
=> this.localHttpClient ?? Networking.Http;
private readonly HttpClient? localHttpClient;
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();
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();
protected IEnumerable<Regex>? UrlRegex = null;
protected AsyncTimer UpdateTimer;
- protected HttpClient http
+ protected HttpClient Http
=> this.localHttpClient ?? Networking.Http;
private readonly HttpClient? localHttpClient;
protected virtual async Task<byte[]> 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();
};
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;
protected virtual async Task<string> 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();
public static readonly Regex UrlPatternRegex =
new Regex(@"^https?://www\.tinami\.com/view/(?<ContentId>\d+)$");
- protected HttpClient http
+ protected HttpClient Http
=> this.localHttpClient ?? Networking.Http;
private readonly ApiKey apiKey;
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();
public static readonly Regex UrlPatternRegex =
new Regex(@"^https?://(?<host>[^.]+\.tumblr\.com|tumblr\.[^.]+\.[^.]+)/post/(?<postId>[0-9]+)(/.*)?");
- protected HttpClient http
+ protected HttpClient Http
=> this.localHttpClient ?? Networking.Http;
private readonly ApiKey tumblrConsumerKey;
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()
public static readonly Regex UrlPatternRegex =
new Regex(@"https?://vimeo\.com/(?<postID>[0-9]+)");
- protected HttpClient http
+ protected HttpClient Http
=> this.localHttpClient ?? Networking.Http;
private readonly HttpClient? localHttpClient;
{
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);
{
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);
}
// (C) 2010 anis774 (@anis774) <http://d.hatena.ne.jp/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),
);
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
);
//
resources.ApplyResources(this.tweetDetailsView, "tweetDetailsView");
this.tweetDetailsView.Name = "tweetDetailsView";
- this.tweetDetailsView.StatusChanged += new System.EventHandler<OpenTween.TweetDetailsViewStatusChengedEventArgs>(this.tweetDetailsView_StatusChanged);
+ this.tweetDetailsView.StatusChanged += new System.EventHandler<OpenTween.TweetDetailsViewStatusChengedEventArgs>(this.TweetDetailsView_StatusChanged);
//
// TableLayoutPanel2
//
resources.ApplyResources(this.tweetThumbnail1, "tweetThumbnail1");
this.tweetThumbnail1.Name = "tweetThumbnail1";
this.tweetThumbnail1.TabStop = false;
- this.tweetThumbnail1.ThumbnailLoading += new System.EventHandler<System.EventArgs>(this.tweetThumbnail1_ThumbnailLoading);
- this.tweetThumbnail1.ThumbnailDoubleClick += new System.EventHandler<OpenTween.ThumbnailDoubleClickEventArgs>(this.tweetThumbnail1_ThumbnailDoubleClick);
- this.tweetThumbnail1.ThumbnailImageSearchClick += new System.EventHandler<OpenTween.ThumbnailImageSearchEventArgs>(this.tweetThumbnail1_ThumbnailImageSearchClick);
+ this.tweetThumbnail1.ThumbnailLoading += new System.EventHandler<System.EventArgs>(this.TweetThumbnail_ThumbnailLoading);
+ this.tweetThumbnail1.ThumbnailDoubleClick += new System.EventHandler<OpenTween.ThumbnailDoubleClickEventArgs>(this.TweetThumbnail_ThumbnailDoubleClick);
+ this.tweetThumbnail1.ThumbnailImageSearchClick += new System.EventHandler<OpenTween.ThumbnailImageSearchEventArgs>(this.TweetThumbnail_ThumbnailImageSearchClick);
//
// MenuStrip1
//
private readonly object _syncObject = new object(); // ロック用
- private const string detailHtmlFormatHeaderMono =
+ private const string DetailHtmlFormatHeaderMono =
"<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\">"
+ "<style type=\"text/css\"><!-- "
+ "body, p, pre {margin: 0;} "
+ ".quote-tweet-link {color: inherit !important; text-decoration: none;}"
+ "--></style>"
+ "</head><body><pre>";
- private const string detailHtmlFormatFooterMono = "</pre></body></html>";
- private const string detailHtmlFormatHeaderColor =
+ private const string DetailHtmlFormatFooterMono = "</pre></body></html>";
+ private const string DetailHtmlFormatHeaderColor =
"<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\">"
+ "<style type=\"text/css\"><!-- "
+ "body, p, pre {margin: 0;} "
+ ".quote-tweet-link {color: inherit !important; text-decoration: none;}"
+ "--></style>"
+ "</head><body><p>";
- private const string detailHtmlFormatFooterColor = "</p></body></html>";
+ private const string DetailHtmlFormatFooterColor = "</p></body></html>";
private string detailHtmlFormatHeader = null!;
private string detailHtmlFormatFooter = null!;
private bool preventSmsCommand = true;
// URL短縮のUndo用
- private struct urlUndo
+ private struct UrlUndo
{
public string Before;
public string After;
}
- private List<urlUndo>? urlUndoBuffer = null;
+ private List<UrlUndo>? urlUndoBuffer = null;
private readonly struct ReplyChain
{
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;
/// <summary>画像投稿サービス名</summary>
- 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;
}
}
this.timelineScheduler.UpdateFunc[TimelineSchedulerTaskType.List] = () => this.InvokeAsync(() => this.RefreshTabAsync<ListTimelineTabModel>());
this.timelineScheduler.UpdateFunc[TimelineSchedulerTaskType.Config] = () => this.InvokeAsync(() => Task.WhenAll(new[]
{
- this.doGetFollowersMenu(),
+ this.DoGetFollowersMenu(),
this.RefreshBlockIdsAsync(),
this.RefreshMuteUserIdsAsync(),
this.RefreshNoRetweetIdsAsync(),
{
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
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);
out var newMentionOrDm,
out var isDelete);
- if (MyCommon._endingFlag) return;
+ if (MyCommon.EndingFlag) return;
// リストに反映&選択状態復元
foreach (var (tab, index) in this._statuses.Tabs.WithIndex())
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;
}
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;
}
{
case DialogResult.Yes:
this.StatusText.Text = "";
- await this.doReTweetOfficial(false);
+ await this.DoReTweetOfficial(false);
return;
case DialogResult.Cancel:
return;
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;
{
this._hookGlobalHotkey.UnregisterAllOriginalHotkey();
this._ignoreConfigSave = true;
- MyCommon._endingFlag = true;
+ MyCommon.EndingFlag = true;
this.timelineScheduler.Enabled = false;
this.TimerRefreshIcon.Enabled = false;
}
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)
}
private async void DeleteStripMenuItem_Click(object sender, EventArgs e)
- => await this.doStatusDelete();
+ => await this.DoStatusDelete();
private void ReadedStripMenuItem_Click(object sender, EventArgs e)
{
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);
this.SaveConfigsAll(false);
if (this.tw.UserId != oldUser.UserId)
- await this.doGetFollowersMenu();
+ await this.DoGetFollowersMenu();
}
/// <summary>
var eHalf = "";
if (dialog.DialogResult == DialogResult.OK)
{
- if (!MyCommon.IsNullOrEmpty(dialog.inputText))
+ if (!MyCommon.IsNullOrEmpty(dialog.InputText))
{
if (selStart > 0)
{
{
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
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 + "\"",
};
this.DispSelectedPost();
}
- public string createDetailHtml(string orgdata)
+ public string CreateDetailHtml(string orgdata)
=> this.detailHtmlFormatHeader + orgdata + this.detailHtmlFormatFooter;
private void DispSelectedPost()
loadTasks.Add(this.tweetThumbnail1.ShowThumbnailAsync(currentPost, token));
}
- async Task delayedTasks()
+ async Task DelayedTasks()
{
try
{
}
// サムネイルの読み込みを待たずに次に選択されたツイートを表示するため await しない
- _ = delayedTasks();
+ _ = DelayedTasks();
}
private async void MatomeMenuItem_Click(object sender, EventArgs e)
.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)),
.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)),
.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)),
.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)
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()),
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);
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)
}
private async void RepliedStatusOpenMenuItem_Click(object sender, EventArgs e)
- => await this.doRepliedStatusOpen();
+ => await this.DoRepliedStatusOpen();
private void SplitContainer2_Panel2_Resize(object sender, EventArgs e)
{
// 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)
{
if (!MyCommon.IsNullOrEmpty(result))
{
- var undotmp = new urlUndo();
+ var undotmp = new UrlUndo();
// 短縮 URL が生成されるまでの間に投稿欄から元の URL が削除されていたら中断する
var origUrlIndex = this.StatusText.Text.IndexOf(tmp, StringComparison.Ordinal);
if (this.urlUndoBuffer == null)
{
- this.urlUndoBuffer = new List<urlUndo>();
+ this.urlUndoBuffer = new List<UrlUndo>();
this.UrlUndoToolStripMenuItem.Enabled = true;
}
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);
// 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)
{
if (this.urlUndoBuffer == null)
{
- this.urlUndoBuffer = new List<urlUndo>();
+ this.urlUndoBuffer = new List<UrlUndo>();
this.UrlUndoToolStripMenuItem.Enabled = true;
}
return true;
}
- private void doUrlUndo()
+ private void DoUrlUndo()
{
if (this.urlUndoBuffer != null)
{
}
private void UrlUndoToolStripMenuItem_Click(object sender, EventArgs e)
- => this.doUrlUndo();
+ => this.DoUrlUndo();
private void NewPostPopMenuItem_CheckStateChanged(object sender, EventArgs e)
{
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)
{
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)
}
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;
if (!post.IsProtect && this._DoFavRetweetFlags)
{
this._DoFavRetweetFlags = false;
- this.doReTweetUnofficial();
+ this.DoReTweetUnofficial();
}
await favoriteTask;
}
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から切り出した文字列を渡す
return !this.tw.Configuration.NonUsernamePaths.Contains(name, StringComparer.InvariantCultureIgnoreCase);
}
- private void doQuoteOfficial()
+ private void DoQuoteOfficial()
{
var post = this.CurrentPost;
if (this.ExistCurrentPost && post != null)
}
}
- private void doReTweetUnofficial()
+ private void DoReTweetUnofficial()
{
// RT @id:内容
var post = this.CurrentPost;
}
private void QuoteStripMenuItem_Click(object sender, EventArgs e)
- => this.doQuoteOfficial();
+ => this.DoQuoteOfficial();
private async void SearchButton_Click(object sender, EventArgs e)
{
}
}
- private async Task doMoveToRTHome()
+ private async Task DoMoveToRTHome()
{
var post = this.CurrentPost;
if (post != null && post.RetweetedId != null)
}
private async void MoveToRTHomeMenuItem_Click(object sender, EventArgs e)
- => await this.doMoveToRTHome();
+ => await this.DoMoveToRTHome();
private void ListManageUserContextToolStripMenuItem_Click(object sender, EventArgs e)
{
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;
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);
}
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)
{
this.tweetDetailsView.Owner = this;
- this._hookGlobalHotkey.HotkeyPressed += this._hookGlobalHotkey_HotkeyPressed;
+ this._hookGlobalHotkey.HotkeyPressed += this.HookGlobalHotkey_HotkeyPressed;
this.gh.NotifyClicked += this.GrowlHelper_Callback;
// メイリオフォント指定時にタブの最小幅が広くなる問題の対策
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)
{
private void TweenRestartMenuItem_Click(object sender, EventArgs e)
{
- MyCommon._endingFlag = true;
+ MyCommon.EndingFlag = true;
try
{
this.Close();
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)
this.MarkSettingCommonModified();
}
- private void tweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e)
+ private void TweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e)
{
if (!MyCommon.IsNullOrEmpty(e.StatusText))
{
}
sb.Append("-----End PostClass Dump<br>");
- 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);
}
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();
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<string> CreateQuoteTweetHtml(long statusId, bool isReply)
langFrom: null,
langTo: SettingManager.Common.TranslateLanguage);
- this.PostBrowser.DocumentText = this.Owner.createDetailHtml(translatedText);
+ this.PostBrowser.DocumentText = this.Owner.CreateDetailHtml(translatedText);
}
catch (WebApiException e)
{
/// </summary>
public static IEnumerable<TwitterEntityUrl> ExtractUrlEntities(string text)
{
- var urlMatches = Regex.Matches(text, Twitter.rgUrl, RegexOptions.IgnoreCase).Cast<Match>();
+ var urlMatches = Regex.Matches(text, Twitter.RgUrl, RegexOptions.IgnoreCase).Cast<Match>();
foreach (var m in urlMatches)
{
var before = m.Groups["before"].Value;
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<Match>();
+ var domainMatches = Regex.Matches(domain, Twitter.UrlValidAsciiDomain, RegexOptions.IgnoreCase).Cast<Match>();
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;
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);
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)));
}
/// <summary>
if (entity.DisplayUrl == null)
{
expandedUrl = MyCommon.ConvertToReadableUrl(targetText);
- return "<a href=\"" + e(entity.Url) + "\" title=\"" + e(expandedUrl) + "\">" + t(e(targetText)) + "</a>";
+ return "<a href=\"" + E(entity.Url) + "\" title=\"" + E(expandedUrl) + "\">" + T(E(targetText)) + "</a>";
}
var linkUrl = entity.Url;
}
}
- return "<a href=\"" + e(linkUrl) + "\" title=\"" + e(titleText) + "\">" + t(e(entity.DisplayUrl)) + "</a>";
+ return "<a href=\"" + E(linkUrl) + "\" title=\"" + E(titleText) + "\">" + T(E(entity.DisplayUrl)) + "</a>";
}
private static string FormatHashtagEntity(string targetText, TwitterEntityHashtag entity)
- => "<a class=\"hashtag\" href=\"https://twitter.com/search?q=%23" + eu(entity.Text) + "\">" + t(e(targetText)) + "</a>";
+ => "<a class=\"hashtag\" href=\"https://twitter.com/search?q=%23" + EU(entity.Text) + "\">" + T(E(targetText)) + "</a>";
private static string FormatMentionEntity(string targetText, TwitterEntityMention entity)
- => "<a class=\"mention\" href=\"https://twitter.com/" + eu(entity.ScreenName) + "\">" + t(e(targetText)) + "</a>";
+ => "<a class=\"mention\" href=\"https://twitter.com/" + EU(entity.ScreenName) + "\">" + T(E(targetText)) + "</a>";
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 "<img class=\"emoji\" src=\"" + e(entity.Url) + "\" alt=\"" + e(entity.Text) + "\" />";
+ return "<img class=\"emoji\" src=\"" + E(entity.Url) + "\" alt=\"" + E(entity.Text) + "\" />";
}
// 長いのでエイリアスとして e(...), eu(...), t(...) でエスケープできるようにする
- private static readonly Func<string, string> e = EscapeHtml;
- private static readonly Func<string, string> eu = Uri.EscapeDataString;
- private static readonly Func<string, string> t = FilterText;
+ private static readonly Func<string, string> E = EscapeHtml;
+ private static readonly Func<string, string> EU = Uri.EscapeDataString;
+ private static readonly Func<string, string> T = FilterText;
private static string EscapeHtml(string text)
{
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
//
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
//
//
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
//
{
public partial class TweetThumbnail : UserControl
{
- protected internal List<OTPictureBox> pictureBox = new List<OTPictureBox>();
+ protected internal List<OTPictureBox> PictureBox = new List<OTPictureBox>();
protected MouseWheelMessageFilter filter = new MouseWheelMessageFilter();
public event EventHandler<EventArgs>? ThumbnailLoading;
public event EventHandler<ThumbnailImageSearchEventArgs>? ThumbnailImageSearchClick;
public ThumbnailInfo Thumbnail
- => (ThumbnailInfo)this.pictureBox[this.scrollBar.Value].Tag;
+ => (ThumbnailInfo)this.PictureBox[this.scrollBar.Value].Tag;
public TweetThumbnail()
=> this.InitializeComponent();
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;
/// <param name="count">表示するサムネイルの数</param>
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();
// メモリリーク対策 (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;
{
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);
}
}
}
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();
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;
}
}
- 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);
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);
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
{
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 = @"(?<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 = @"(?<domain>" + 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 = @"(?<query>\?[a-z0-9!?*'();:&=+$/%#\[\]\-_.,~|]*[a-z0-9_&=#/])?";
- public const string rgUrl = @"(?<before>" + url_valid_preceding_chars + ")" +
+ private const string Qry = @"(?<query>\?[a-z0-9!?*'();:&=+$/%#\[\]\-_.,~|]*[a-z0-9_&=#/])?";
+ public const string RgUrl = @"(?<before>" + UrlValidPrecedingChars + ")" +
"(?<url>(?<protocol>https?://)?" +
- "(?<domain>" + url_valid_domain + ")" +
- "(?::" + url_valid_port_number + ")?" +
- "(?<path>/" + pth + "*)?" +
- qry +
+ "(?<domain>" + UrlValidDomain + ")" +
+ "(?::" + UrlValidPortNumber + ")?" +
+ "(?<path>/" + Pth + "*)?" +
+ Qry +
")";
#endregion
/// <exception cref="WebApiException"/>
public async Task RefreshFollowerIds()
{
- if (MyCommon._endingFlag) return;
+ if (MyCommon.EndingFlag) return;
var cursor = -1L;
var newFollowerIds = Enumerable.Empty<long>();
/// <exception cref="WebApiException"/>
public async Task RefreshNoRetweetIds()
{
- if (MyCommon._endingFlag) return;
+ if (MyCommon.EndingFlag) return;
this.noRTId = await this.Api.NoRetweetIds()
.ConfigureAwait(false);
{
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);
/// <exception cref="WebApiException"/>
public async Task RefreshBlockIds()
{
- if (MyCommon._endingFlag) return;
+ if (MyCommon.EndingFlag) return;
var cursor = -1L;
var newBlockIds = Enumerable.Empty<long>();
/// <exception cref="WebApiException"/>
public async Task RefreshMuteUserIdsAsync()
{
- if (MyCommon._endingFlag) return;
+ if (MyCommon.EndingFlag) return;
var ids = await TwitterIds.GetAllItemsAsync(x => this.Api.MutesUsersIds(x))
.ConfigureAwait(false);
public string RecentPost = "";
public DateTimeUtc PostCreatedAt;
public string PostSource = ""; // html形式 "<a href="http://sourceforge.jp/projects/tween/wiki/FrontPage" rel="nofollow">Tween</a>"
- public bool isFollowing = false;
- public bool isFollowed = false;
public override string ToString()
=> this.ScreenName + " / " + this.Name;
.Concat(TweetExtractor.ExtractEmojiEntities(descriptionText));
var html = TweetFormatter.AutoLinkHtml(descriptionText, mergedEntities);
- html = this.mainForm.createDetailHtml(html);
+ html = this.mainForm.CreateDetailHtml(html);
if (cancellationToken.IsCancellationRequested)
return;
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);