From: Kimura Youichi Date: Wed, 28 Aug 2019 16:59:06 +0000 (+0900) Subject: 式形式のメソッドを使用する (IDE0021, IDE0022, IDE0025, IDE0053) X-Git-Tag: OpenTween_v2.4.0~10^2~6 X-Git-Url: http://git.osdn.net/view?p=opentween%2Fopen-tween.git;a=commitdiff_plain;h=85b21492caa332249fe4edca624e06d404fee409 式形式のメソッドを使用する (IDE0021, IDE0022, IDE0025, IDE0053) --- diff --git a/OpenTween.Tests/AnyOrderComparer.cs b/OpenTween.Tests/AnyOrderComparer.cs index 85134bab..1aa5f8b5 100644 --- a/OpenTween.Tests/AnyOrderComparer.cs +++ b/OpenTween.Tests/AnyOrderComparer.cs @@ -51,8 +51,6 @@ namespace OpenTween } public int GetHashCode(IEnumerable obj) - { - throw new NotImplementedException(); - } + => throw new NotImplementedException(); } } diff --git a/OpenTween.Tests/Api/TwitterApiTest.cs b/OpenTween.Tests/Api/TwitterApiTest.cs index 40f9f8ee..1e68b62e 100644 --- a/OpenTween.Tests/Api/TwitterApiTest.cs +++ b/OpenTween.Tests/Api/TwitterApiTest.cs @@ -38,9 +38,7 @@ namespace OpenTween.Api public class TwitterApiTest { public TwitterApiTest() - { - this.MyCommonSetup(); - } + => this.MyCommonSetup(); private void MyCommonSetup() { diff --git a/OpenTween.Tests/BingTest.cs b/OpenTween.Tests/BingTest.cs index 8cff6c3b..cb1aa925 100644 --- a/OpenTween.Tests/BingTest.cs +++ b/OpenTween.Tests/BingTest.cs @@ -41,17 +41,13 @@ namespace OpenTween [InlineData("sq", 1)] [InlineData("ja", 67)] public void GetLanguageEnumFromIndex_Test(string expected, int index) - { - Assert.Equal(expected, Bing.GetLanguageEnumFromIndex(index)); - } + => Assert.Equal(expected, Bing.GetLanguageEnumFromIndex(index)); [Theory] [InlineData(0, "af")] [InlineData(1, "sq")] [InlineData(67, "ja")] public void GetIndexFromLanguageEnum_Test(int expected, string lang) - { - Assert.Equal(expected, Bing.GetIndexFromLanguageEnum(lang)); - } + => Assert.Equal(expected, Bing.GetIndexFromLanguageEnum(lang)); } } diff --git a/OpenTween.Tests/Connection/LazyJsonTest.cs b/OpenTween.Tests/Connection/LazyJsonTest.cs index 759255d2..bb30d1c8 100644 --- a/OpenTween.Tests/Connection/LazyJsonTest.cs +++ b/OpenTween.Tests/Connection/LazyJsonTest.cs @@ -115,29 +115,19 @@ namespace OpenTween.Connection } public override void Flush() - { - throw new NotSupportedException(); - } + => throw new NotSupportedException(); public override int Read(byte[] buffer, int offset, int count) - { - throw new IOException(); - } + => throw new IOException(); public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } + => throw new NotSupportedException(); public override void SetLength(long value) - { - throw new NotSupportedException(); - } + => throw new NotSupportedException(); public override void Write(byte[] buffer, int offset, int count) - { - throw new NotSupportedException(); - } + => throw new NotSupportedException(); protected override void Dispose(bool disposing) { diff --git a/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs b/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs index 11d2623a..6fbff585 100644 --- a/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs +++ b/OpenTween.Tests/Connection/TwitterApiConnectionTest.cs @@ -41,9 +41,7 @@ namespace OpenTween.Connection public class TwitterApiConnectionTest { public TwitterApiConnectionTest() - { - this.MyCommonSetup(); - } + => this.MyCommonSetup(); private void MyCommonSetup() { diff --git a/OpenTween.Tests/HttpMessageHandlerMock.cs b/OpenTween.Tests/HttpMessageHandlerMock.cs index c3a66367..feb8ae56 100644 --- a/OpenTween.Tests/HttpMessageHandlerMock.cs +++ b/OpenTween.Tests/HttpMessageHandlerMock.cs @@ -35,19 +35,13 @@ namespace OpenTween new Queue>>(); public int QueueCount - { - get { return this.Queue.Count; } - } + => this.Queue.Count; public void Enqueue(Func> handler) - { - this.Queue.Enqueue(handler); - } + => this.Queue.Enqueue(handler); public void Enqueue(Func handler) - { - this.Queue.Enqueue(x => Task.Run(() => handler(x))); - } + => this.Queue.Enqueue(x => Task.Run(() => handler(x))); protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { diff --git a/OpenTween.Tests/LRUCacheDictionaryTest.cs b/OpenTween.Tests/LRUCacheDictionaryTest.cs index 85821079..7bfa148f 100644 --- a/OpenTween.Tests/LRUCacheDictionaryTest.cs +++ b/OpenTween.Tests/LRUCacheDictionaryTest.cs @@ -163,10 +163,7 @@ namespace OpenTween // イベント設定 var removedList = new List(); - dict.CacheRemoved += (s, e) => - { - removedList.Add(e.Item.Key); - }; + dict.CacheRemoved += (s, e) => removedList.Add(e.Item.Key); // 2 個までに縮小 dict.TrimLimit = 2; diff --git a/OpenTween.Tests/MediaSelectorTest.cs b/OpenTween.Tests/MediaSelectorTest.cs index 20ed633c..91b9361b 100644 --- a/OpenTween.Tests/MediaSelectorTest.cs +++ b/OpenTween.Tests/MediaSelectorTest.cs @@ -17,9 +17,7 @@ namespace OpenTween public class MediaSelectorTest { public MediaSelectorTest() - { - this.MyCommonSetup(); - } + => this.MyCommonSetup(); private void MyCommonSetup() { diff --git a/OpenTween.Tests/Models/PostClassTest.cs b/OpenTween.Tests/Models/PostClassTest.cs index 94867c5a..ca42caf6 100644 --- a/OpenTween.Tests/Models/PostClassTest.cs +++ b/OpenTween.Tests/Models/PostClassTest.cs @@ -84,9 +84,7 @@ namespace OpenTween.Models [InlineData(2L, true)] [InlineData(3L, true)] public void GetIsFavTest(long statusId, bool expected) - { - Assert.Equal(expected, PostClassTest.TestCases[statusId].IsFav); - } + => Assert.Equal(expected, PostClassTest.TestCases[statusId].IsFav); [Theory] [InlineData(2L, true)] diff --git a/OpenTween.Tests/Models/PostFilterRuleTest.cs b/OpenTween.Tests/Models/PostFilterRuleTest.cs index a9600775..a4060127 100644 --- a/OpenTween.Tests/Models/PostFilterRuleTest.cs +++ b/OpenTween.Tests/Models/PostFilterRuleTest.cs @@ -31,9 +31,7 @@ namespace OpenTween.Models public class PostFilterRuleTest { public PostFilterRuleTest() - { - PostFilterRule.AutoCompile = true; - } + => PostFilterRule.AutoCompile = true; [Fact] public void EmptyRuleTest() diff --git a/OpenTween.Tests/Models/TabModelTest.cs b/OpenTween.Tests/Models/TabModelTest.cs index 362fd2e1..bf865fb4 100644 --- a/OpenTween.Tests/Models/TabModelTest.cs +++ b/OpenTween.Tests/Models/TabModelTest.cs @@ -682,9 +682,7 @@ namespace OpenTween.Models [InlineData(MyCommon.TabUsageType.PublicSearch, false)] [InlineData(MyCommon.TabUsageType.Related, false)] public void IsDefault_Test(MyCommon.TabUsageType tabType, bool expected) - { - Assert.Equal(expected, tabType.IsDefault()); - } + => Assert.Equal(expected, tabType.IsDefault()); [Theory] [InlineData(MyCommon.TabUsageType.Home, false)] @@ -697,9 +695,7 @@ namespace OpenTween.Models [InlineData(MyCommon.TabUsageType.PublicSearch, false)] [InlineData(MyCommon.TabUsageType.Related, false)] public void IsDistributable_Test(MyCommon.TabUsageType tabType, bool expected) - { - Assert.Equal(expected, tabType.IsDistributable()); - } + => Assert.Equal(expected, tabType.IsDistributable()); [Theory] [InlineData(MyCommon.TabUsageType.Home, false)] @@ -712,8 +708,6 @@ namespace OpenTween.Models [InlineData(MyCommon.TabUsageType.PublicSearch, true)] [InlineData(MyCommon.TabUsageType.Related, true)] public void IsInnerStorage_Test(MyCommon.TabUsageType tabType, bool expected) - { - Assert.Equal(expected, tabType.IsInnerStorage()); - } + => Assert.Equal(expected, tabType.IsInnerStorage()); } } diff --git a/OpenTween.Tests/MyCommonTest.cs b/OpenTween.Tests/MyCommonTest.cs index 41946626..a71ff5aa 100644 --- a/OpenTween.Tests/MyCommonTest.cs +++ b/OpenTween.Tests/MyCommonTest.cs @@ -42,18 +42,14 @@ namespace OpenTween [InlineData("http://日本語.idn.icann.org/", "http://xn--wgv71a119e.idn.icann.org/")] [InlineData("http://例え.テスト/", "http://xn--r8jz45g.xn--zckzah/")] public void IDNEncodeTest(string uri, string expected) - { - Assert.Equal(expected, MyCommon.IDNEncode(uri)); - } + => Assert.Equal(expected, MyCommon.IDNEncode(uri)); [Theory] [InlineData("http://xn--wgv71a119e.idn.icann.org/", "http://日本語.idn.icann.org/")] [InlineData("http://xn--r8jz45g.xn--zckzah/", "http://例え.テスト/")] [InlineData("http://xn--a/", "http://xn--a/")] // 不正なpunycode public void IDNDecodeTest(string uri, string expected) - { - Assert.Equal(expected, MyCommon.IDNDecode(uri)); - } + => Assert.Equal(expected, MyCommon.IDNDecode(uri)); [Theory] [InlineData("http://xn--r8jz45g.xn--zckzah/", "http://例え.テスト/")] @@ -65,9 +61,7 @@ namespace OpenTween [InlineData("http://example.com/%E3%81%82%FF", "http://example.com/あ%FF")] // 不正なUTF-8シーケンス [InlineData("http://example.com/%E3%81%82%ED%A0%80", "http://example.com/あ%ED%A0%80")] // 不正なUTF-8シーケンス (high surrogate) public void ConvertToReadableUrl(string url, string expected) - { - Assert.Equal(expected, MyCommon.ConvertToReadableUrl(url)); - } + => Assert.Equal(expected, MyCommon.ConvertToReadableUrl(url)); [Theory] [InlineData(new int[] { 1, 2, 3, 4 }, 0, 3, new int[] { 2, 3, 4, 1 })] // 左ローテイト? @@ -101,18 +95,14 @@ namespace OpenTween [InlineData(new byte[] { 0x01, 0x02 }, 2, new byte[] { 0x01, 0x02 })] [InlineData(new byte[] { 0x01, 0x02 }, 1, new byte[] { 0x03 })] public void ResizeBytesArrayTest(byte[] bytes, int size, byte[] expected) - { - Assert.Equal(expected, MyCommon.ResizeBytesArray(bytes, size)); - } + => Assert.Equal(expected, MyCommon.ResizeBytesArray(bytes, size)); [Theory] [InlineData("Resources/re.gif", true)] [InlineData("Resources/re1.gif", false)] [InlineData("Resources/re1.png", false)] public void IsAnimatedGifTest(string filename, bool expected) - { - Assert.Equal(expected, MyCommon.IsAnimatedGif(filename)); - } + => Assert.Equal(expected, MyCommon.IsAnimatedGif(filename)); public static readonly TheoryData DateTimeParse_TestCase = new TheoryData { @@ -145,9 +135,7 @@ namespace OpenTween [Theory] [MemberData(nameof(CreateDataFromJson_TestCase))] public void CreateDataFromJsonTest(string json, T expected) - { - Assert.Equal(expected, MyCommon.CreateDataFromJson(json)); - } + => Assert.Equal(expected, MyCommon.CreateDataFromJson(json)); [Theory] [InlineData("hoge123@example.com", true)] @@ -157,9 +145,7 @@ namespace OpenTween [InlineData("foobar.@example.com", false)] [InlineData("foo+bar@example.com", true)] public void IsValidEmailTest(string email, bool expected) - { - Assert.Equal(expected, MyCommon.IsValidEmail(email)); - } + => Assert.Equal(expected, MyCommon.IsValidEmail(email)); [Theory] [InlineData(Keys.Shift, new[] { Keys.Shift }, true)] @@ -169,9 +155,7 @@ namespace OpenTween [InlineData(Keys.Control | Keys.Alt, new[] { Keys.Control, Keys.Alt }, true)] [InlineData(Keys.Control | Keys.Alt, new[] { Keys.Shift }, false)] public void IsKeyDownTest(Keys modifierKeys, Keys[] checkKeys, bool expected) - { - Assert.Equal(expected, MyCommon._IsKeyDown(modifierKeys, checkKeys)); - } + => Assert.Equal(expected, MyCommon._IsKeyDown(modifierKeys, checkKeys)); [Fact] public void GetAssemblyNameTest() @@ -188,9 +172,7 @@ namespace OpenTween [InlineData("%AppName%", "OpenTween")] [InlineData("%AppName% %AppName%", "OpenTween OpenTween")] public void ReplaceAppNameTest(string str, string excepted) - { - Assert.Equal(excepted, MyCommon.ReplaceAppName(str, "OpenTween")); - } + => Assert.Equal(excepted, MyCommon.ReplaceAppName(str, "OpenTween")); [Theory] [InlineData("1.0.0.0", "1.0.0")] @@ -201,9 +183,7 @@ namespace OpenTween [InlineData("1.1.0.0", "1.1.0")] [InlineData("1.9.9.1", "1.9.10-dev")] public void GetReadableVersionTest(string fileVersion, string expected) - { - Assert.Equal(expected, MyCommon.GetReadableVersion(fileVersion)); - } + => Assert.Equal(expected, MyCommon.GetReadableVersion(fileVersion)); public static IEnumerable GetStatusUrlTest1_TestCase { @@ -223,17 +203,13 @@ namespace OpenTween [Theory] [MemberData(nameof(GetStatusUrlTest1_TestCase))] public void GetStatusUrlTest1(PostClass post, string expected) - { - Assert.Equal(expected, MyCommon.GetStatusUrl(post)); - } + => Assert.Equal(expected, MyCommon.GetStatusUrl(post)); [Theory] [InlineData("Favstar_LM", 249493863826350080L, "https://twitter.com/Favstar_LM/status/249493863826350080")] [InlineData("haru067", 200245741443235840L, "https://twitter.com/haru067/status/200245741443235840")] public void GetStatusUrlTest2(string screenName, long statusId, string expected) - { - Assert.Equal(expected, MyCommon.GetStatusUrl(screenName, statusId)); - } + => Assert.Equal(expected, MyCommon.GetStatusUrl(screenName, statusId)); [Fact] public void GetErrorLogPathTest() diff --git a/OpenTween.Tests/OTBaseFormTest.cs b/OpenTween.Tests/OTBaseFormTest.cs index 133c8118..5186a26a 100644 --- a/OpenTween.Tests/OTBaseFormTest.cs +++ b/OpenTween.Tests/OTBaseFormTest.cs @@ -35,14 +35,10 @@ namespace OpenTween private class TestForm : OTBaseForm { } public OTBaseFormTest() - { - this.SetupSynchronizationContext(); - } + => this.SetupSynchronizationContext(); protected void SetupSynchronizationContext() - { - WindowsFormsSynchronizationContext.AutoInstall = false; - } + => WindowsFormsSynchronizationContext.AutoInstall = false; [Fact] public async Task InvokeAsync_Test() @@ -51,7 +47,7 @@ namespace OpenTween { await Task.Run(async () => { - await form.InvokeAsync(() => { form.Text = "hoge"; }); + await form.InvokeAsync(() => form.Text = "hoge"); }); Assert.Equal("hoge", form.Text); diff --git a/OpenTween.Tests/ShortUrlTest.cs b/OpenTween.Tests/ShortUrlTest.cs index 853adaa7..a5a490ad 100644 --- a/OpenTween.Tests/ShortUrlTest.cs +++ b/OpenTween.Tests/ShortUrlTest.cs @@ -427,9 +427,7 @@ namespace OpenTween } private HttpResponseMessage CreateRedirectResponse(string uriStr) - { - return this.CreateRedirectResponse(uriStr, UriKind.Absolute); - } + => this.CreateRedirectResponse(uriStr, UriKind.Absolute); private HttpResponseMessage CreateRedirectResponse(string uriStr, UriKind uriKind) { diff --git a/OpenTween.Tests/TestUtils.cs b/OpenTween.Tests/TestUtils.cs index 58d70fcf..0ca55fd0 100644 --- a/OpenTween.Tests/TestUtils.cs +++ b/OpenTween.Tests/TestUtils.cs @@ -106,9 +106,7 @@ namespace OpenTween } public static void FireEvent(T control, string eventName) where T : Control - { - TestUtils.FireEvent(control, eventName, EventArgs.Empty); - } + => TestUtils.FireEvent(control, eventName, EventArgs.Empty); public static void FireEvent(T control, string eventName, EventArgs e) where T : Control { diff --git a/OpenTween.Tests/Thumbnail/Services/ImgAzyobuziNetTest.cs b/OpenTween.Tests/Thumbnail/Services/ImgAzyobuziNetTest.cs index 57b2492e..903e0352 100644 --- a/OpenTween.Tests/Thumbnail/Services/ImgAzyobuziNetTest.cs +++ b/OpenTween.Tests/Thumbnail/Services/ImgAzyobuziNetTest.cs @@ -52,9 +52,7 @@ namespace OpenTween.Thumbnail.Services } public string GetApiBase() - { - return this.ApiBase; - } + => this.ApiBase; protected override Task FetchRegexAsync(string apiBase) { diff --git a/OpenTween.Tests/Thumbnail/Services/MetaThumbnailServiceTest.cs b/OpenTween.Tests/Thumbnail/Services/MetaThumbnailServiceTest.cs index 01a176a5..8515d165 100644 --- a/OpenTween.Tests/Thumbnail/Services/MetaThumbnailServiceTest.cs +++ b/OpenTween.Tests/Thumbnail/Services/MetaThumbnailServiceTest.cs @@ -45,9 +45,7 @@ namespace OpenTween.Thumbnail.Services } protected override Task FetchImageUrlAsync(string url, CancellationToken token) - { - return Task.FromResult(this.FakeHtml); - } + => Task.FromResult(this.FakeHtml); } [Fact] diff --git a/OpenTween.Tests/Thumbnail/Services/TinamiTest.cs b/OpenTween.Tests/Thumbnail/Services/TinamiTest.cs index 2826ebb4..b68ce1fe 100644 --- a/OpenTween.Tests/Thumbnail/Services/TinamiTest.cs +++ b/OpenTween.Tests/Thumbnail/Services/TinamiTest.cs @@ -47,9 +47,7 @@ namespace OpenTween.Thumbnail.Services } protected override Task FetchContentInfoApiAsync(string contentId, CancellationToken token) - { - return Task.FromResult(XDocument.Parse(this.FakeXml)); - } + => Task.FromResult(XDocument.Parse(this.FakeXml)); } [Fact] diff --git a/OpenTween.Tests/TweetThumbnailTest.cs b/OpenTween.Tests/TweetThumbnailTest.cs index 46542033..7dc94584 100644 --- a/OpenTween.Tests/TweetThumbnailTest.cs +++ b/OpenTween.Tests/TweetThumbnailTest.cs @@ -74,9 +74,7 @@ namespace OpenTween class MockThumbnailInfo : ThumbnailInfo { public override Task LoadThumbnailImageAsync(HttpClient http, CancellationToken cancellationToken) - { - return Task.FromResult(TestUtils.CreateDummyImage()); - } + => Task.FromResult(TestUtils.CreateDummyImage()); } } diff --git a/OpenTween.Tests/TwitterTest.cs b/OpenTween.Tests/TwitterTest.cs index 8392c3f4..77edce97 100644 --- a/OpenTween.Tests/TwitterTest.cs +++ b/OpenTween.Tests/TwitterTest.cs @@ -66,9 +66,7 @@ namespace OpenTween [InlineData("http://twitter.com/messages/compose?recipient_id=514241801", true)] [InlineData("https://twitter.com/messages/compose?recipient_id=514241801&text=%E3%81%BB%E3%81%92", true)] public void AttachmentUrlRegexTest(string url, bool isMatch) - { - Assert.Equal(isMatch, Twitter.AttachmentUrlRegex.IsMatch(url)); - } + => Assert.Equal(isMatch, Twitter.AttachmentUrlRegex.IsMatch(url)); [Theory] [InlineData("http://favstar.fm/users/twitterapi/status/22634515958", new[] { "22634515958" })] diff --git a/OpenTween/Api/DataModel/GeoJson.cs b/OpenTween/Api/DataModel/GeoJson.cs index 02db1e3a..2956ab41 100644 --- a/OpenTween/Api/DataModel/GeoJson.cs +++ b/OpenTween/Api/DataModel/GeoJson.cs @@ -42,9 +42,7 @@ namespace OpenTween.Api.DataModel public double[] Coordinates { get; set; } public GeoJsonPoint() - { - this.Type = "Point"; - } + => this.Type = "Point"; } [DataContract] @@ -54,8 +52,6 @@ namespace OpenTween.Api.DataModel public double[][][] Coordinates { get; set; } public GeoJsonPolygon() - { - this.Type = "Polygon"; - } + => this.Type = "Polygon"; } } diff --git a/OpenTween/Api/DataModel/TwitterConfiguration.cs b/OpenTween/Api/DataModel/TwitterConfiguration.cs index 9250fe37..900f6719 100644 --- a/OpenTween/Api/DataModel/TwitterConfiguration.cs +++ b/OpenTween/Api/DataModel/TwitterConfiguration.cs @@ -63,9 +63,7 @@ namespace OpenTween.Api.DataModel /// public static TwitterConfiguration ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); /// /// 設定が取得できるまでの間に代わりに使用する適当な値を返します diff --git a/OpenTween/Api/DataModel/TwitterError.cs b/OpenTween/Api/DataModel/TwitterError.cs index 5ec5b203..c570ead4 100644 --- a/OpenTween/Api/DataModel/TwitterError.cs +++ b/OpenTween/Api/DataModel/TwitterError.cs @@ -38,9 +38,7 @@ namespace OpenTween.Api.DataModel /// public static TwitterError ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] diff --git a/OpenTween/Api/DataModel/TwitterFriendship.cs b/OpenTween/Api/DataModel/TwitterFriendship.cs index 25bd8e20..40298dd0 100644 --- a/OpenTween/Api/DataModel/TwitterFriendship.cs +++ b/OpenTween/Api/DataModel/TwitterFriendship.cs @@ -99,8 +99,6 @@ namespace OpenTween.Api.DataModel /// public static TwitterFriendship ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterList.cs b/OpenTween/Api/DataModel/TwitterList.cs index 777e3aef..955083f4 100644 --- a/OpenTween/Api/DataModel/TwitterList.cs +++ b/OpenTween/Api/DataModel/TwitterList.cs @@ -72,14 +72,10 @@ namespace OpenTween.Api.DataModel /// public static TwitterList ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); /// public static TwitterList[] ParseJsonArray(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterPageable.cs b/OpenTween/Api/DataModel/TwitterPageable.cs index ee1c059b..3b58b859 100644 --- a/OpenTween/Api/DataModel/TwitterPageable.cs +++ b/OpenTween/Api/DataModel/TwitterPageable.cs @@ -74,15 +74,11 @@ namespace OpenTween.Api.DataModel [IgnoreDataMember] public override long[] Items - { - get { return this.Ids; } - } + => this.Ids; /// public static TwitterIds ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] @@ -93,15 +89,11 @@ namespace OpenTween.Api.DataModel [IgnoreDataMember] public override TwitterUser[] Items - { - get { return this.Users; } - } + => this.Users; /// public static TwitterUsers ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] @@ -112,14 +104,10 @@ namespace OpenTween.Api.DataModel [IgnoreDataMember] public override TwitterList[] Items - { - get { return this.Lists; } - } + => this.Lists; /// public static TwitterLists ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterRateLimits.cs b/OpenTween/Api/DataModel/TwitterRateLimits.cs index 5a3538f6..6b0d881d 100644 --- a/OpenTween/Api/DataModel/TwitterRateLimits.cs +++ b/OpenTween/Api/DataModel/TwitterRateLimits.cs @@ -59,8 +59,6 @@ namespace OpenTween.Api.DataModel /// public static TwitterRateLimits ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterSearchResult.cs b/OpenTween/Api/DataModel/TwitterSearchResult.cs index b5856004..3b60b243 100644 --- a/OpenTween/Api/DataModel/TwitterSearchResult.cs +++ b/OpenTween/Api/DataModel/TwitterSearchResult.cs @@ -70,8 +70,6 @@ namespace OpenTween.Api.DataModel /// public static TwitterSearchResult ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterStatus.cs b/OpenTween/Api/DataModel/TwitterStatus.cs index 27ee9669..27e4f483 100644 --- a/OpenTween/Api/DataModel/TwitterStatus.cs +++ b/OpenTween/Api/DataModel/TwitterStatus.cs @@ -162,15 +162,11 @@ namespace OpenTween.Api.DataModel /// public static TwitterStatus ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); /// public static TwitterStatus[] ParseJsonArray(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] @@ -378,15 +374,11 @@ namespace OpenTween.Api.DataModel /// public static TwitterStatusCompat ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); /// public static TwitterStatusCompat[] ParseJsonArray(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] @@ -433,14 +425,10 @@ namespace OpenTween.Api.DataModel /// public static TwitterDirectMessage ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); /// public static TwitterDirectMessage[] ParseJsonArray(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Api/DataModel/TwitterStreamEvent.cs b/OpenTween/Api/DataModel/TwitterStreamEvent.cs index 2469c137..da1fa0bd 100644 --- a/OpenTween/Api/DataModel/TwitterStreamEvent.cs +++ b/OpenTween/Api/DataModel/TwitterStreamEvent.cs @@ -45,9 +45,7 @@ namespace OpenTween.Api.DataModel /// public static TwitterStreamEvent ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } [DataContract] @@ -58,8 +56,6 @@ namespace OpenTween.Api.DataModel /// public static new TwitterStreamEvent ParseJson(string json) - { - return MyCommon.CreateDataFromJson>(json); - } + => MyCommon.CreateDataFromJson>(json); } } diff --git a/OpenTween/Api/DataModel/TwitterTextConfiguration.cs b/OpenTween/Api/DataModel/TwitterTextConfiguration.cs index dea717ed..d0c04888 100644 --- a/OpenTween/Api/DataModel/TwitterTextConfiguration.cs +++ b/OpenTween/Api/DataModel/TwitterTextConfiguration.cs @@ -62,9 +62,7 @@ namespace OpenTween.Api.DataModel /// public static TwitterTextConfiguration ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); public static TwitterTextConfiguration DefaultConfiguration() { diff --git a/OpenTween/Api/DataModel/TwitterUser.cs b/OpenTween/Api/DataModel/TwitterUser.cs index 78a0449f..655561b9 100644 --- a/OpenTween/Api/DataModel/TwitterUser.cs +++ b/OpenTween/Api/DataModel/TwitterUser.cs @@ -112,8 +112,6 @@ namespace OpenTween.Api.DataModel /// public static TwitterUser ParseJson(string json) - { - return MyCommon.CreateDataFromJson(json); - } + => MyCommon.CreateDataFromJson(json); } } diff --git a/OpenTween/Models/PostFilterRule.cs b/OpenTween/Models/PostFilterRule.cs index c583dab0..17b7679d 100644 --- a/OpenTween/Models/PostFilterRule.cs +++ b/OpenTween/Models/PostFilterRule.cs @@ -689,23 +689,19 @@ namespace OpenTween.Models /// この振り分けルールにマッチ条件が含まれているかを返します /// public bool HasMatchConditions() - { - return !string.IsNullOrEmpty(this.FilterName) || + => !string.IsNullOrEmpty(this.FilterName) || this.FilterBody.Any(x => !string.IsNullOrEmpty(x)) || !string.IsNullOrEmpty(this.FilterSource) || this.FilterRt; - } /// /// この振り分けルールに除外条件が含まれているかを返します /// public bool HasExcludeConditions() - { - return !string.IsNullOrEmpty(this.ExFilterName) || + => !string.IsNullOrEmpty(this.ExFilterName) || this.ExFilterBody.Any(x => !string.IsNullOrEmpty(x)) || !string.IsNullOrEmpty(this.ExFilterSource) || this.ExFilterRt; - } public override bool Equals(object obj) => this.Equals(obj as PostFilterRule); @@ -751,13 +747,11 @@ namespace OpenTween.Models } public override int GetHashCode() - { - return this.FilterName?.GetHashCode() ?? 0 ^ + => this.FilterName?.GetHashCode() ?? 0 ^ this.FilterSource?.GetHashCode() ?? 0 ^ this.FilterBody.Select(x => x?.GetHashCode() ?? 0).Sum() ^ this.ExFilterName?.GetHashCode() ?? 0 ^ this.ExFilterSource?.GetHashCode() ?? 0 ^ this.ExFilterBody.Select(x => x?.GetHashCode() ?? 0).Sum(); - } } } diff --git a/OpenTween/Setting/SettingLocal.cs b/OpenTween/Setting/SettingLocal.cs index a54a63a0..44e16281 100644 --- a/OpenTween/Setting/SettingLocal.cs +++ b/OpenTween/Setting/SettingLocal.cs @@ -337,11 +337,9 @@ namespace OpenTween /// 指定されたスケールと SettingLocal.ScaleDimension のスケールとの拡大比を返します /// public SizeF GetConfigScaleFactor(SizeF currentSizeDimension) - { - return new SizeF( + => new SizeF( currentSizeDimension.Width / this.ScaleDimension.Width, currentSizeDimension.Height / this.ScaleDimension.Height); - } public void Dispose() { diff --git a/OpenTween/Thumbnail/ThumbnailInfo.cs b/OpenTween/Thumbnail/ThumbnailInfo.cs index 20d41f8c..f15ef54f 100644 --- a/OpenTween/Thumbnail/ThumbnailInfo.cs +++ b/OpenTween/Thumbnail/ThumbnailInfo.cs @@ -100,14 +100,12 @@ namespace OpenTween.Thumbnail => this.Equals(obj as ThumbnailInfo); public bool Equals(ThumbnailInfo other) - { - return other != null && + => other != null && other.MediaPageUrl == this.MediaPageUrl && other.ThumbnailImageUrl == this.ThumbnailImageUrl && other.TooltipText == this.TooltipText && other.FullSizeImageUrl == this.FullSizeImageUrl && other.IsPlayable == this.IsPlayable; - } public override int GetHashCode() => this.MediaPageUrl.GetHashCode() ^ this.ThumbnailImageUrl.GetHashCode(); diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index 7ffef936..80366ad5 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -6771,14 +6771,14 @@ namespace OpenTween for (var i = postList.Count - 1; i >= 0; i--) { var index = i; - if (postList.FindIndex((pst) => { return pst.Post.StatusId == postList[index].Post.StatusId; }) != index) + if (postList.FindIndex(pst => pst.Post.StatusId == postList[index].Post.StatusId) != index) { postList.RemoveAt(index); } } var currentIndex = this.CurrentTab.SelectedIndex; - var post = postList.FirstOrDefault((pst) => { return pst.Tab == curTabClass && isForward ? pst.Index > currentIndex : pst.Index < currentIndex; }); - if (post == null) post = postList.FirstOrDefault((pst) => { return pst.Tab != curTabClass; }); + var post = postList.FirstOrDefault(pst => pst.Tab == curTabClass && isForward ? pst.Index > currentIndex : pst.Index < currentIndex); + if (post == null) post = postList.FirstOrDefault(pst => pst.Tab != curTabClass); if (post == null) post = postList.First(); var tabIndex = this._statuses.Tabs.IndexOf(post.Tab); this.ListTab.SelectedIndex = tabIndex;