From a123542a9fabe5972b4dfdd6951c3965bbe4d717 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Thu, 16 Feb 2017 21:36:47 +0900 Subject: [PATCH] =?utf8?q?SettingCommon.Instance=E3=83=97=E3=83=AD?= =?utf8?q?=E3=83=91=E3=83=86=E3=82=A3=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween.Tests/TwitterTest.cs | 44 ++++++++++++++--------------- OpenTween/EventViewerDialog.cs | 5 ++-- OpenTween/Models/DirectMessagesTabModel.cs | 5 ++-- OpenTween/Models/FavoritesTabModel.cs | 5 ++-- OpenTween/Models/HomeTabModel.cs | 7 +++-- OpenTween/Models/ListTimelineTabModel.cs | 5 ++-- OpenTween/Models/MentionsTabModel.cs | 5 ++-- OpenTween/Models/PublicSearchTabModel.cs | 5 ++-- OpenTween/Models/RelatedPostsTabModel.cs | 5 ++-- OpenTween/Models/TabInformations.cs | 3 +- OpenTween/Models/TabModel.cs | 5 ++-- OpenTween/Models/UserTimelineTabModel.cs | 5 ++-- OpenTween/MyCommon.cs | 3 +- OpenTween/Setting/SettingCommon.cs | 3 -- OpenTween/Thumbnail/MapThumb.cs | 3 +- OpenTween/Thumbnail/MapThumbGoogle.cs | 9 +++--- OpenTween/Thumbnail/MapThumbOSM.cs | 7 +++-- OpenTween/TweetDetailsView.cs | 4 +-- OpenTween/Twitter.cs | 45 +++++++++++++++--------------- 19 files changed, 93 insertions(+), 80 deletions(-) diff --git a/OpenTween.Tests/TwitterTest.cs b/OpenTween.Tests/TwitterTest.cs index 4ca8985d..75d55b05 100644 --- a/OpenTween.Tests/TwitterTest.cs +++ b/OpenTween.Tests/TwitterTest.cs @@ -212,18 +212,18 @@ namespace OpenTween var oldInstance = SettingManagerTest.Common; SettingManagerTest.Common = new SettingCommon(); - var timeline = SettingCommon.Instance.CountApi; - var reply = SettingCommon.Instance.CountApiReply; + var timeline = SettingManager.Common.CountApi; + var reply = SettingManager.Common.CountApiReply; var dm = 20; // DMは固定値 - var more = SettingCommon.Instance.MoreCountApi; - var startup = SettingCommon.Instance.FirstCountApi; - var favorite = SettingCommon.Instance.FavoritesCountApi; - var list = SettingCommon.Instance.ListCountApi; - var search = SettingCommon.Instance.SearchCountApi; - var usertl = SettingCommon.Instance.UserTimelineCountApi; + var more = SettingManager.Common.MoreCountApi; + var startup = SettingManager.Common.FirstCountApi; + var favorite = SettingManager.Common.FavoritesCountApi; + var list = SettingManager.Common.ListCountApi; + var search = SettingManager.Common.SearchCountApi; + var usertl = SettingManager.Common.UserTimelineCountApi; // デフォルト値チェック - Assert.Equal(false, SettingCommon.Instance.UseAdditionalCount); + Assert.Equal(false, SettingManager.Common.UseAdditionalCount); Assert.Equal(60, timeline); Assert.Equal(40, reply); Assert.Equal(200, more); @@ -256,17 +256,17 @@ namespace OpenTween var oldInstance = SettingManagerTest.Common; SettingManagerTest.Common = new SettingCommon(); - var timeline = SettingCommon.Instance.CountApi; - var reply = SettingCommon.Instance.CountApiReply; + var timeline = SettingManager.Common.CountApi; + var reply = SettingManager.Common.CountApiReply; var dm = 20; // DMは固定値 - var more = SettingCommon.Instance.MoreCountApi; - var startup = SettingCommon.Instance.FirstCountApi; - var favorite = SettingCommon.Instance.FavoritesCountApi; - var list = SettingCommon.Instance.ListCountApi; - var search = SettingCommon.Instance.SearchCountApi; - var usertl = SettingCommon.Instance.UserTimelineCountApi; + var more = SettingManager.Common.MoreCountApi; + var startup = SettingManager.Common.FirstCountApi; + var favorite = SettingManager.Common.FavoritesCountApi; + var list = SettingManager.Common.ListCountApi; + var search = SettingManager.Common.SearchCountApi; + var usertl = SettingManager.Common.UserTimelineCountApi; - SettingCommon.Instance.UseAdditionalCount = true; + SettingManager.Common.UseAdditionalCount = true; // Timeline Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Timeline, false, false)); @@ -287,7 +287,7 @@ namespace OpenTween Assert.Equal(favorite, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Favorites, true, false)); Assert.Equal(favorite, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Favorites, false, true)); - SettingCommon.Instance.FavoritesCountApi = 0; + SettingManager.Common.FavoritesCountApi = 0; Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Favorites, false, false)); Assert.Equal(more, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.Favorites, true, false)); @@ -298,7 +298,7 @@ namespace OpenTween Assert.Equal(list, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.List, true, false)); Assert.Equal(list, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.List, false, true)); - SettingCommon.Instance.ListCountApi = 0; + SettingManager.Common.ListCountApi = 0; Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.List, false, false)); Assert.Equal(more, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.List, true, false)); @@ -309,7 +309,7 @@ namespace OpenTween Assert.Equal(search, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.PublicSearch, true, false)); Assert.Equal(search, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.PublicSearch, false, true)); - SettingCommon.Instance.SearchCountApi = 0; + SettingManager.Common.SearchCountApi = 0; Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.PublicSearch, false, false)); Assert.Equal(search, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.PublicSearch, true, false)); //MoreCountApiの値がPublicSearchの最大値に制限される @@ -320,7 +320,7 @@ namespace OpenTween Assert.Equal(usertl, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, true, false)); Assert.Equal(usertl, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, false, true)); - SettingCommon.Instance.UserTimelineCountApi = 0; + SettingManager.Common.UserTimelineCountApi = 0; Assert.Equal(timeline, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, false, false)); Assert.Equal(more, Twitter.GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, true, false)); diff --git a/OpenTween/EventViewerDialog.cs b/OpenTween/EventViewerDialog.cs index d0546578..1d004817 100644 --- a/OpenTween/EventViewerDialog.cs +++ b/OpenTween/EventViewerDialog.cs @@ -36,6 +36,7 @@ using System.Windows.Forms; using System.Text.RegularExpressions; using System.IO; using System.Globalization; +using OpenTween.Setting; namespace OpenTween { @@ -94,7 +95,7 @@ namespace OpenTween _curTab = TabEventType.SelectedTab; CreateFilterdEventSource(); EventList.EndUpdate(); - this.TopMost = SettingCommon.Instance.AlwaysTop; + this.TopMost = SettingManager.Common.AlwaysTop; } private async void EventList_DoubleClick(object sender, EventArgs e) @@ -268,7 +269,7 @@ namespace OpenTween } } } - this.TopMost = SettingCommon.Instance.AlwaysTop; + this.TopMost = SettingManager.Common.AlwaysTop; } private void SaveEventLog(List source, StreamWriter sw) diff --git a/OpenTween/Models/DirectMessagesTabModel.cs b/OpenTween/Models/DirectMessagesTabModel.cs index f2426a29..976cbe75 100644 --- a/OpenTween/Models/DirectMessagesTabModel.cs +++ b/OpenTween/Models/DirectMessagesTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -49,10 +50,10 @@ namespace OpenTween.Models public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress progress) { bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report(string.Format(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText8, backward ? -1 : 1)); diff --git a/OpenTween/Models/FavoritesTabModel.cs b/OpenTween/Models/FavoritesTabModel.cs index 924e1a50..ed0367f0 100644 --- a/OpenTween/Models/FavoritesTabModel.cs +++ b/OpenTween/Models/FavoritesTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -49,10 +50,10 @@ namespace OpenTween.Models public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress progress) { bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText19); diff --git a/OpenTween/Models/HomeTabModel.cs b/OpenTween/Models/HomeTabModel.cs index 49691249..ba935797 100644 --- a/OpenTween/Models/HomeTabModel.cs +++ b/OpenTween/Models/HomeTabModel.cs @@ -32,6 +32,7 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -63,10 +64,10 @@ namespace OpenTween.Models public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress progress) { bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report(string.Format(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText5, backward ? -1 : 1)); @@ -74,7 +75,7 @@ namespace OpenTween.Models .ConfigureAwait(false); // 新着時未読クリア - if (SettingCommon.Instance.ReadOldPosts) + if (SettingManager.Common.ReadOldPosts) TabInformations.GetInstance().SetReadHomeTab(); TabInformations.GetInstance().DistributePosts(); diff --git a/OpenTween/Models/ListTimelineTabModel.cs b/OpenTween/Models/ListTimelineTabModel.cs index 22861b83..2e59847e 100644 --- a/OpenTween/Models/ListTimelineTabModel.cs +++ b/OpenTween/Models/ListTimelineTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -52,10 +53,10 @@ namespace OpenTween.Models return; bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report("List refreshing..."); diff --git a/OpenTween/Models/MentionsTabModel.cs b/OpenTween/Models/MentionsTabModel.cs index 93bc7aba..5ff69665 100644 --- a/OpenTween/Models/MentionsTabModel.cs +++ b/OpenTween/Models/MentionsTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -49,10 +50,10 @@ namespace OpenTween.Models public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress progress) { bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report(string.Format(Properties.Resources.GetTimelineWorker_RunWorkerCompletedText4, backward ? -1 : 1)); diff --git a/OpenTween/Models/PublicSearchTabModel.cs b/OpenTween/Models/PublicSearchTabModel.cs index 554133eb..c2e64231 100644 --- a/OpenTween/Models/PublicSearchTabModel.cs +++ b/OpenTween/Models/PublicSearchTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -71,10 +72,10 @@ namespace OpenTween.Models return; bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report("Search refreshing..."); diff --git a/OpenTween/Models/RelatedPostsTabModel.cs b/OpenTween/Models/RelatedPostsTabModel.cs index 8b29b90a..a16baddc 100644 --- a/OpenTween/Models/RelatedPostsTabModel.cs +++ b/OpenTween/Models/RelatedPostsTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -54,10 +55,10 @@ namespace OpenTween.Models public override async Task RefreshAsync(Twitter tw, bool _, bool startup, IProgress progress) { bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report("Related refreshing..."); diff --git a/OpenTween/Models/TabInformations.cs b/OpenTween/Models/TabInformations.cs index 49e1f805..22c1be7c 100644 --- a/OpenTween/Models/TabInformations.cs +++ b/OpenTween/Models/TabInformations.cs @@ -33,6 +33,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using OpenTween.Setting; namespace OpenTween.Models { @@ -547,7 +548,7 @@ namespace OpenTween.Models if (Item.IsFav && Item.RetweetedId != null) Item.IsFav = false; //既に持っている公式RTは捨てる - if (Item.RetweetedId != null && SettingCommon.Instance.HideDuplicatedRetweets) + if (Item.RetweetedId != null && SettingManager.Common.HideDuplicatedRetweets) { var retweetCount = this.UpdateRetweetCount(Item); diff --git a/OpenTween/Models/TabModel.cs b/OpenTween/Models/TabModel.cs index eb5bb18c..026cf179 100644 --- a/OpenTween/Models/TabModel.cs +++ b/OpenTween/Models/TabModel.cs @@ -33,6 +33,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using OpenTween.Setting; namespace OpenTween.Models { @@ -242,7 +243,7 @@ namespace OpenTween.Models { get { - if (!this.UnreadManage || !SettingCommon.Instance.UnreadManage) + if (!this.UnreadManage || !SettingManager.Common.UnreadManage) return -1L; if (this.unreadIds.Count == 0) @@ -275,7 +276,7 @@ namespace OpenTween.Models { get { - if (!this.UnreadManage || !SettingCommon.Instance.UnreadManage) + if (!this.UnreadManage || !SettingManager.Common.UnreadManage) return 0; return this.unreadIds.Count; diff --git a/OpenTween/Models/UserTimelineTabModel.cs b/OpenTween/Models/UserTimelineTabModel.cs index 72c13dac..621bb164 100644 --- a/OpenTween/Models/UserTimelineTabModel.cs +++ b/OpenTween/Models/UserTimelineTabModel.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using OpenTween.Setting; namespace OpenTween.Models { @@ -52,10 +53,10 @@ namespace OpenTween.Models return; bool read; - if (!SettingCommon.Instance.UnreadManage) + if (!SettingManager.Common.UnreadManage) read = true; else - read = startup && SettingCommon.Instance.Read; + read = startup && SettingManager.Common.Read; progress.Report("UserTimeline refreshing..."); diff --git a/OpenTween/MyCommon.cs b/OpenTween/MyCommon.cs index 169fc9f0..5bb0c9e6 100644 --- a/OpenTween/MyCommon.cs +++ b/OpenTween/MyCommon.cs @@ -48,6 +48,7 @@ using System.Net.NetworkInformation; using System.Runtime.InteropServices; using OpenTween.Api; using OpenTween.Models; +using OpenTween.Setting; namespace OpenTween { @@ -417,7 +418,7 @@ namespace OpenTween writer.Write(errorReport); } - var settings = SettingCommon.Instance; + var settings = SettingManager.Common; var mainForm = Application.OpenForms.OfType().FirstOrDefault(); ErrorReport report; diff --git a/OpenTween/Setting/SettingCommon.cs b/OpenTween/Setting/SettingCommon.cs index ac7d1cff..4c5cc62f 100644 --- a/OpenTween/Setting/SettingCommon.cs +++ b/OpenTween/Setting/SettingCommon.cs @@ -29,14 +29,11 @@ using System.Xml.Serialization; using System.Collections.Generic; using System.Windows.Forms; using OpenTween.Thumbnail; -using OpenTween.Setting; namespace OpenTween { public class SettingCommon : SettingBase { - public static SettingCommon Instance => SettingManager.Common; - #region "Settingクラス基本" public static SettingCommon Load() { diff --git a/OpenTween/Thumbnail/MapThumb.cs b/OpenTween/Thumbnail/MapThumb.cs index 7663e6d6..ffaf4213 100644 --- a/OpenTween/Thumbnail/MapThumb.cs +++ b/OpenTween/Thumbnail/MapThumb.cs @@ -25,6 +25,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using OpenTween.Models; +using OpenTween.Setting; using OpenTween.Thumbnail.Services; namespace OpenTween.Thumbnail @@ -52,7 +53,7 @@ namespace OpenTween.Thumbnail { Type classType; - MapProvider confValue = SettingCommon.Instance.MapThumbnailProvider; + MapProvider confValue = SettingManager.Common.MapThumbnailProvider; switch (confValue) { case MapProvider.OpenStreetMap: diff --git a/OpenTween/Thumbnail/MapThumbGoogle.cs b/OpenTween/Thumbnail/MapThumbGoogle.cs index fe08a18e..0bb6464f 100644 --- a/OpenTween/Thumbnail/MapThumbGoogle.cs +++ b/OpenTween/Thumbnail/MapThumbGoogle.cs @@ -26,6 +26,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using OpenTween.Models; +using OpenTween.Setting; namespace OpenTween.Thumbnail { @@ -45,9 +46,9 @@ namespace OpenTween.Thumbnail public string CreateStaticMapUrl(double latitude, double longitude) { - var width = SettingCommon.Instance.MapThumbnailWidth; // この辺なんとかならんかなあ - var height = SettingCommon.Instance.MapThumbnailHeight; - var zoom = SettingCommon.Instance.MapThumbnailZoom; + var width = SettingManager.Common.MapThumbnailWidth; // この辺なんとかならんかなあ + var height = SettingManager.Common.MapThumbnailHeight; + var zoom = SettingManager.Common.MapThumbnailZoom; var location = latitude + "," + longitude; var baseUrl = "https://maps.googleapis.com/maps/api/staticmap"; @@ -57,7 +58,7 @@ namespace OpenTween.Thumbnail public string CreateMapLinkUrl(double latitude, double longitude) { - var zoom = SettingCommon.Instance.MapThumbnailZoom; + var zoom = SettingManager.Common.MapThumbnailZoom; var location = latitude + "," + longitude; var baseUrl = "https://maps.google.co.jp/maps"; diff --git a/OpenTween/Thumbnail/MapThumbOSM.cs b/OpenTween/Thumbnail/MapThumbOSM.cs index 4de51fcc..08814bc2 100644 --- a/OpenTween/Thumbnail/MapThumbOSM.cs +++ b/OpenTween/Thumbnail/MapThumbOSM.cs @@ -28,6 +28,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using OpenTween.Models; +using OpenTween.Setting; namespace OpenTween.Thumbnail { @@ -35,8 +36,8 @@ namespace OpenTween.Thumbnail { public override Task GetThumbnailInfoAsync(PostClass.StatusGeo geo) { - var size = new Size(SettingCommon.Instance.MapThumbnailWidth, SettingCommon.Instance.MapThumbnailHeight); - var zoom = SettingCommon.Instance.MapThumbnailZoom; + var size = new Size(SettingManager.Common.MapThumbnailWidth, SettingManager.Common.MapThumbnailHeight); + var zoom = SettingManager.Common.MapThumbnailZoom; var thumb = new OSMThumbnailInfo(geo.Latitude, geo.Longitude, zoom, size) { @@ -48,7 +49,7 @@ namespace OpenTween.Thumbnail public string CreateMapLinkUrl(double latitude, double longitude) { - var zoom = SettingCommon.Instance.MapThumbnailZoom; + var zoom = SettingManager.Common.MapThumbnailZoom; return "http://www.openstreetmap.org/index.html?lat=" + latitude + "&lon=" + longitude + "&zoom=" + zoom + "&mlat=" + latitude + "&mlon=" + longitude; } diff --git a/OpenTween/TweetDetailsView.cs b/OpenTween/TweetDetailsView.cs index ab1c3363..cc8abffa 100644 --- a/OpenTween/TweetDetailsView.cs +++ b/OpenTween/TweetDetailsView.cs @@ -114,7 +114,7 @@ namespace OpenTween NameLabel.Text = nameText; var nameForeColor = SystemColors.ControlText; - if (post.IsOwl && (SettingCommon.Instance.OneWayLove || post.IsDm)) + if (post.IsOwl && (SettingManager.Common.OneWayLove || post.IsDm)) nameForeColor = SettingManager.Local.ColorOWL; if (post.RetweetedId != null) nameForeColor = SettingManager.Local.ColorRetweet; @@ -374,7 +374,7 @@ namespace OpenTween { var translatedText = await bing.TranslateAsync(str, langFrom: null, - langTo: SettingCommon.Instance.TranslateLanguage); + langTo: SettingManager.Common.TranslateLanguage); this.PostBrowser.DocumentText = this.Owner.createDetailHtml(translatedText); } diff --git a/OpenTween/Twitter.cs b/OpenTween/Twitter.cs index 5690b5b9..f3f0951b 100644 --- a/OpenTween/Twitter.cs +++ b/OpenTween/Twitter.cs @@ -51,6 +51,7 @@ using OpenTween.Api.DataModel; using OpenTween.Connection; using OpenTween.Models; using System.Drawing.Imaging; +using OpenTween.Setting; namespace OpenTween { @@ -232,7 +233,7 @@ namespace OpenTween this.ResetApiStatus(); this.Api.Initialize(token, tokenSecret, userId, username); _uname = username.ToLowerInvariant(); - if (SettingCommon.Instance.UserstreamStartup) this.ReconnectUserStream(); + if (SettingManager.Common.UserstreamStartup) this.ReconnectUserStream(); } public string PreProcessUrl(string orgData) @@ -302,7 +303,7 @@ namespace OpenTween } public Task UploadMedia(IMediaItem item) - => this.UploadMedia(item, SettingCommon.Instance.AlphaPNGWorkaround); + => this.UploadMedia(item, SettingManager.Common.AlphaPNGWorkaround); public async Task UploadMedia(IMediaItem item, bool alphaPNGWorkaround) { @@ -543,42 +544,42 @@ namespace OpenTween return 20; } - if (SettingCommon.Instance.UseAdditionalCount) + if (SettingManager.Common.UseAdditionalCount) { switch (type) { case MyCommon.WORKERTYPE.Favorites: - if (SettingCommon.Instance.FavoritesCountApi != 0) - return SettingCommon.Instance.FavoritesCountApi; + if (SettingManager.Common.FavoritesCountApi != 0) + return SettingManager.Common.FavoritesCountApi; break; case MyCommon.WORKERTYPE.List: - if (SettingCommon.Instance.ListCountApi != 0) - return SettingCommon.Instance.ListCountApi; + if (SettingManager.Common.ListCountApi != 0) + return SettingManager.Common.ListCountApi; break; case MyCommon.WORKERTYPE.PublicSearch: - if (SettingCommon.Instance.SearchCountApi != 0) - return SettingCommon.Instance.SearchCountApi; + if (SettingManager.Common.SearchCountApi != 0) + return SettingManager.Common.SearchCountApi; break; case MyCommon.WORKERTYPE.UserTimeline: - if (SettingCommon.Instance.UserTimelineCountApi != 0) - return SettingCommon.Instance.UserTimelineCountApi; + if (SettingManager.Common.UserTimelineCountApi != 0) + return SettingManager.Common.UserTimelineCountApi; break; } - if (more && SettingCommon.Instance.MoreCountApi != 0) + if (more && SettingManager.Common.MoreCountApi != 0) { - return Math.Min(SettingCommon.Instance.MoreCountApi, GetMaxApiResultCount(type)); + return Math.Min(SettingManager.Common.MoreCountApi, GetMaxApiResultCount(type)); } - if (startup && SettingCommon.Instance.FirstCountApi != 0 && type != MyCommon.WORKERTYPE.Reply) + if (startup && SettingManager.Common.FirstCountApi != 0 && type != MyCommon.WORKERTYPE.Reply) { - return Math.Min(SettingCommon.Instance.FirstCountApi, GetMaxApiResultCount(type)); + return Math.Min(SettingManager.Common.FirstCountApi, GetMaxApiResultCount(type)); } } // 上記に当てはまらない場合の共通処理 - var count = SettingCommon.Instance.CountApi; + var count = SettingManager.Common.CountApi; if (type == MyCommon.WORKERTYPE.Reply) - count = SettingCommon.Instance.CountApiReply; + count = SettingManager.Common.CountApiReply; return Math.Min(count, GetMaxApiResultCount(type)); } @@ -985,12 +986,12 @@ namespace OpenTween TwitterStatus[] statuses; if (more) { - statuses = await this.Api.ListsStatuses(tab.ListInfo.Id, count, maxId: tab.OldestId, includeRTs: SettingCommon.Instance.IsListsIncludeRts) + statuses = await this.Api.ListsStatuses(tab.ListInfo.Id, count, maxId: tab.OldestId, includeRTs: SettingManager.Common.IsListsIncludeRts) .ConfigureAwait(false); } else { - statuses = await this.Api.ListsStatuses(tab.ListInfo.Id, count, includeRTs: SettingCommon.Instance.IsListsIncludeRts) + statuses = await this.Api.ListsStatuses(tab.ListInfo.Id, count, includeRTs: SettingManager.Common.IsListsIncludeRts) .ConfigureAwait(false); } @@ -2066,7 +2067,7 @@ namespace OpenTween evt.Target = "@" + tweet.User.ScreenName + ":" + WebUtility.HtmlDecode(tweet.FullText); evt.Id = tweet.Id; - if (SettingCommon.Instance.IsRemoveSameEvent) + if (SettingManager.Common.IsRemoveSameEvent) { if (this.StoredEvent.Any(ev => ev.Username == evt.Username && ev.Eventtype == evt.Eventtype && ev.Target == evt.Target)) return; @@ -2092,7 +2093,7 @@ namespace OpenTween { post.FavoritedCount++; - if (SettingCommon.Instance.FavEventUnread) + if (SettingManager.Common.FavEventUnread) tabinfo.SetReadAllTab(post.StatusId, read: false); } } @@ -2116,7 +2117,7 @@ namespace OpenTween evt.Target = "@" + tweet.User.ScreenName + ":" + WebUtility.HtmlDecode(tweet.FullText); evt.Id = tweet.Id; - if (SettingCommon.Instance.IsRemoveSameEvent) + if (SettingManager.Common.IsRemoveSameEvent) { if (this.StoredEvent.Any(ev => ev.Username == evt.Username && ev.Eventtype == evt.Eventtype && ev.Target == evt.Target)) return; -- 2.11.0