OSDN Git Service

string.IsNullOrEmpty の nullable annotation あり版のメソッドを追加
authorKimura Youichi <kim.upsilon@bucyou.net>
Mon, 23 Sep 2019 19:12:08 +0000 (04:12 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Tue, 24 Sep 2019 12:57:56 +0000 (21:57 +0900)
VS16.3 に同梱されているRoslynから string.IsNullOrEmpty などのメソッドに対する
アノテーションがハードコードされなくなったため、独自に代替のメソッドを用意する必要がある

38 files changed:
OpenTween/Api/BitlyApi.cs
OpenTween/Api/MicrosoftTranslatorApi.cs
OpenTween/Api/TwitterApi.cs
OpenTween/Api/TwitterApiStatus.cs
OpenTween/Api/TwitterStreamObservable.cs
OpenTween/AppendSettingDialog.cs
OpenTween/ApplicationEvents.cs
OpenTween/AtIdSupplement.cs
OpenTween/Connection/Networking.cs
OpenTween/Connection/OAuthUtility.cs
OpenTween/Connection/TwitterPhoto.cs
OpenTween/EventViewerDialog.cs
OpenTween/FilterDialog.cs
OpenTween/Growl.cs
OpenTween/HashtagManage.cs
OpenTween/ImageListViewItem.cs
OpenTween/ListManage.cs
OpenTween/MediaSelector.cs
OpenTween/Models/MediaInfo.cs
OpenTween/Models/PostFilterRule.cs
OpenTween/Models/PublicSearchTabModel.cs
OpenTween/Models/TabInformations.cs
OpenTween/Models/UserTimelineTabModel.cs
OpenTween/MyCommon.cs
OpenTween/NativeMethods.cs
OpenTween/SearchWordDialog.cs
OpenTween/Setting/Panel/CooperatePanel.cs
OpenTween/Setting/SettingCommon.cs
OpenTween/Setting/SettingLocal.cs
OpenTween/Setting/SettingManager.cs
OpenTween/ShortUrl.cs
OpenTween/Thumbnail/Services/MetaThumbnailService.cs
OpenTween/ToolStripAPIGauge.cs
OpenTween/Tween.cs
OpenTween/TweetDetailsView.cs
OpenTween/TweetFormatter.cs
OpenTween/TweetThumbnail.cs
OpenTween/Twitter.cs

index 92b8ccb..133d494 100644 (file)
@@ -64,7 +64,7 @@ namespace OpenTween.Api
                 ["longUrl"] = srcUri.OriginalString,
             };
 
-            if (!string.IsNullOrEmpty(domain))
+            if (!MyCommon.IsNullOrEmpty(domain))
                 query["domain"] = domain;
 
             var uri = new Uri("/v3/shorten", UriKind.Relative);
@@ -138,7 +138,7 @@ namespace OpenTween.Api
 
         private IEnumerable<KeyValuePair<string, string>> CreateAccessTokenParams()
         {
-            if (string.IsNullOrEmpty(this.EndUserAccessToken))
+            if (MyCommon.IsNullOrEmpty(this.EndUserAccessToken))
             {
                 return new[]
                 {
index 51e8abb..b55835e 100644 (file)
@@ -97,7 +97,7 @@ namespace OpenTween.Api
 
         public async Task UpdateAccessTokenIfExpired()
         {
-            if (!string.IsNullOrEmpty(this.AccessToken) && this.RefreshAccessTokenAt > DateTimeUtc.Now)
+            if (!MyCommon.IsNullOrEmpty(this.AccessToken) && this.RefreshAccessTokenAt > DateTimeUtc.Now)
                 return;
 
             var (accessToken, expiresIn) = await this.GetAccessTokenAsync()
index e812798..f651b8a 100644 (file)
@@ -775,9 +775,9 @@ namespace OpenTween.Api
             var endpoint = new Uri("https://userstream.twitter.com/1.1/user.json");
             var param = new Dictionary<string, string>();
 
-            if (!string.IsNullOrEmpty(replies))
+            if (!MyCommon.IsNullOrEmpty(replies))
                 param["replies"] = replies;
-            if (!string.IsNullOrEmpty(track))
+            if (!MyCommon.IsNullOrEmpty(track))
                 param["track"] = track;
 
             Task<Stream> openStream()
index c26815f..5647541 100644 (file)
@@ -80,7 +80,7 @@ namespace OpenTween.Api
                 return null;
 
             // たまに出てくる空文字列は無視する
-            if (string.IsNullOrEmpty(header[headerName]))
+            if (MyCommon.IsNullOrEmpty(header[headerName]))
                 return null;
 
             switch (header[headerName])
index a7e945a..d9c83fb 100644 (file)
@@ -79,7 +79,7 @@ namespace OpenTween.Api
 
         public static ITwitterStreamMessage ParseLine(string line)
         {
-            if (string.IsNullOrEmpty(line))
+            if (MyCommon.IsNullOrEmpty(line))
                 return new StreamMessageKeepAlive();
 
             if (line.First() != '{' || line.Last() != '}')
index 13f93ed..70838a6 100644 (file)
@@ -284,7 +284,7 @@ namespace OpenTween
             var pinPageUrl = TwitterApiConnection.GetAuthorizeUri(requestToken);
 
             var pin = AuthDialog.DoAuth(this, pinPageUrl);
-            if (string.IsNullOrEmpty(pin))
+            if (MyCommon.IsNullOrEmpty(pin))
                 return null; // キャンセルされた場合
 
             var accessTokenResponse = await TwitterApiConnection.GetAccessTokenAsync(requestToken, pin);
@@ -320,7 +320,7 @@ namespace OpenTween
             var path = this.ActionPanel.BrowserPathText.Text;
             try
             {
-                if (!string.IsNullOrEmpty(path))
+                if (!MyCommon.IsNullOrEmpty(path))
                 {
                     if (path.StartsWith("\"", StringComparison.Ordinal) && path.Length > 2 && path.IndexOf("\"", 2, StringComparison.Ordinal) > -1)
                     {
index f384c04..afd8f5e 100644 (file)
@@ -284,7 +284,7 @@ namespace OpenTween
 
         private static bool SetConfigDirectoryPath()
         {
-            if (StartupOptions.TryGetValue("configDir", out var configDir) && !string.IsNullOrEmpty(configDir))
+            if (StartupOptions.TryGetValue("configDir", out var configDir) && !MyCommon.IsNullOrEmpty(configDir))
             {
                 // 起動オプション /configDir で設定ファイルの参照先を変更できます
                 if (!Directory.Exists(configDir))
index 49116d6..032f35b 100644 (file)
@@ -88,7 +88,7 @@ namespace OpenTween
 
         private void TextId_KeyDown(object sender, KeyEventArgs e)
         {
-            if (e.KeyCode == Keys.Back && string.IsNullOrEmpty(this.TextId.Text))
+            if (e.KeyCode == Keys.Back && MyCommon.IsNullOrEmpty(this.TextId.Text))
             {
                 inputText = "";
                 isBack = true;
@@ -102,7 +102,7 @@ namespace OpenTween
             }
             else if (e.Control && e.KeyCode == Keys.Delete)
             {
-                if (!string.IsNullOrEmpty(this.TextId.Text))
+                if (!MyCommon.IsNullOrEmpty(this.TextId.Text))
                 {
                     var idx = this.TextId.AutoCompleteCustomSource.IndexOf(this.TextId.Text);
                     if (idx > -1)
@@ -126,7 +126,7 @@ namespace OpenTween
         private void AtIdSupplement_Shown(object sender, EventArgs e)
         {
             TextId.Text = startChar;
-            if (!string.IsNullOrEmpty(this.StartsWith))
+            if (!MyCommon.IsNullOrEmpty(this.StartsWith))
             {
                 TextId.Text += this.StartsWith.Substring(0, this.StartsWith.Length);
             }
index 78fb59a..1ae37f0 100644 (file)
@@ -124,7 +124,7 @@ namespace OpenTween.Connection
                     break;
                 case ProxyType.Specified:
                     proxy = new WebProxy(proxyAddress, proxyPort);
-                    if (!string.IsNullOrEmpty(proxyUser) || !string.IsNullOrEmpty(proxyPassword))
+                    if (!MyCommon.IsNullOrEmpty(proxyUser) || !MyCommon.IsNullOrEmpty(proxyPassword))
                         proxy.Credentials = new NetworkCredential(proxyUser, proxyPassword);
                     break;
                 case ProxyType.IE:
index 885aa9e..8d45106 100644 (file)
@@ -96,7 +96,7 @@ namespace OpenTween.Connection
                 ["oauth_nonce"] = NonceRandom.Next(123400, 9999999).ToString(),
                 ["oauth_version"] = "1.0",
             };
-            if (!string.IsNullOrEmpty(token))
+            if (!MyCommon.IsNullOrEmpty(token))
                 parameter.Add("oauth_token", token); // トークンがあれば追加
             return parameter;
         }
@@ -121,7 +121,7 @@ namespace OpenTween.Connection
             var signatureBase = string.Format("{0}&{1}&{2}", method, MyCommon.UrlEncode(url), MyCommon.UrlEncode(paramString));
             // 署名鍵の文字列をコンシューマー秘密鍵とアクセストークン秘密鍵から生成(&区切り。アクセストークン秘密鍵なくても&残すこと)
             var key = MyCommon.UrlEncode(consumerSecret) + "&";
-            if (!string.IsNullOrEmpty(tokenSecret))
+            if (!MyCommon.IsNullOrEmpty(tokenSecret))
                 key += MyCommon.UrlEncode(tokenSecret);
             // 鍵生成&署名生成
             using var hmac = new HMACSHA1(Encoding.ASCII.GetBytes(key));
index c22afce..ee1350b 100644 (file)
@@ -142,7 +142,7 @@ namespace OpenTween.Connection
                 var mediaId = await this.tw.UploadMedia(media, category)
                     .ConfigureAwait(false);
 
-                if (!string.IsNullOrEmpty(media.AltText))
+                if (!MyCommon.IsNullOrEmpty(media.AltText))
                 {
                     await this.tw.Api.MediaMetadataCreate(mediaId, media.AltText)
                         .ConfigureAwait(false);
index 2cab195..bf57258 100644 (file)
@@ -131,7 +131,7 @@ namespace OpenTween
 
         private bool IsFilterMatch(Twitter.FormattedEvent x)
         {
-            if (!CheckBoxFilter.Checked || string.IsNullOrEmpty(TextBoxKeyword.Text))
+            if (!CheckBoxFilter.Checked || MyCommon.IsNullOrEmpty(TextBoxKeyword.Text))
             {
                 return true;
             }
index 82c6bcd..a32303d 100644 (file)
@@ -667,7 +667,7 @@ namespace OpenTween
             else
             {
                 ft.FilterBody = bdy.Split(' ', ' ')
-                    .Where(x => !string.IsNullOrEmpty(x))
+                    .Where(x => !MyCommon.IsNullOrEmpty(x))
                     .ToArray();
             }
 
@@ -699,7 +699,7 @@ namespace OpenTween
             else
             {
                 ft.ExFilterBody = bdy.Split(' ', ' ')
-                    .Where(x => !string.IsNullOrEmpty(x))
+                    .Where(x => !MyCommon.IsNullOrEmpty(x))
                     .ToArray();
             }
 
@@ -755,7 +755,7 @@ namespace OpenTween
             isBlank = false;
             if (RadioAND.Checked)
             {
-                if (string.IsNullOrEmpty(UID.Text) && string.IsNullOrEmpty(MSG1.Text) && string.IsNullOrEmpty(TextSource.Text) && CheckRetweet.Checked == false)
+                if (MyCommon.IsNullOrEmpty(UID.Text) && MyCommon.IsNullOrEmpty(MSG1.Text) && MyCommon.IsNullOrEmpty(TextSource.Text) && CheckRetweet.Checked == false)
                 {
                     isBlank = true;
                     return true;
@@ -785,7 +785,7 @@ namespace OpenTween
             }
             else
             {
-                if (string.IsNullOrEmpty(MSG2.Text) && string.IsNullOrEmpty(TextSource.Text) && CheckRetweet.Checked == false)
+                if (MyCommon.IsNullOrEmpty(MSG2.Text) && MyCommon.IsNullOrEmpty(TextSource.Text) && CheckRetweet.Checked == false)
                 {
                     isBlank = true;
                     return true;
@@ -812,7 +812,7 @@ namespace OpenTween
             isBlank = false;
             if (RadioExAnd.Checked)
             {
-                if (string.IsNullOrEmpty(ExUID.Text) && string.IsNullOrEmpty(ExMSG1.Text) && string.IsNullOrEmpty(TextExSource.Text) && CheckExRetweet.Checked == false)
+                if (MyCommon.IsNullOrEmpty(ExUID.Text) && MyCommon.IsNullOrEmpty(ExMSG1.Text) && MyCommon.IsNullOrEmpty(TextExSource.Text) && CheckExRetweet.Checked == false)
                 {
                     isBlank = true;
                     return true;
@@ -842,7 +842,7 @@ namespace OpenTween
             }
             else
             {
-                if (string.IsNullOrEmpty(ExMSG2.Text) && string.IsNullOrEmpty(TextExSource.Text) && CheckExRetweet.Checked == false)
+                if (MyCommon.IsNullOrEmpty(ExMSG2.Text) && MyCommon.IsNullOrEmpty(TextExSource.Text) && CheckExRetweet.Checked == false)
                 {
                     isBlank = true;
                     return true;
@@ -971,7 +971,7 @@ namespace OpenTween
                 tabName = inputName.TabName;
                 tabType = inputName.Usage;
             }
-            if (!string.IsNullOrEmpty(tabName))
+            if (!MyCommon.IsNullOrEmpty(tabName))
             {
                 //List対応
                 ListElement? list = null;
index 21dcf8a..fe0f104 100644 (file)
@@ -268,7 +268,7 @@ namespace OpenTween
             };
 
             object? n;
-            if (icon != null || !string.IsNullOrEmpty(url))
+            if (icon != null || !MyCommon.IsNullOrEmpty(url))
             {
                 var gCore = _core!.GetType("Growl.CoreLibrary.Resource");
                 object? res;
index 7a5b419..01d8b33 100644 (file)
@@ -125,14 +125,14 @@ namespace OpenTween
 
         private int GetIndexOf(ListBox.ObjectCollection list, string value)
         {
-            if (string.IsNullOrEmpty(value)) return -1;
+            if (MyCommon.IsNullOrEmpty(value)) return -1;
 
             var idx = 0;
 
             foreach (var l in list)
             {
                 var src = (string)l;
-                if (string.IsNullOrEmpty(src))
+                if (MyCommon.IsNullOrEmpty(src))
                 {
                     idx += 1;
                     continue;
@@ -151,7 +151,7 @@ namespace OpenTween
         public void AddHashToHistory(string hash, bool isIgnorePermanent)
         {
             hash = hash.Trim();
-            if (!string.IsNullOrEmpty(hash))
+            if (!MyCommon.IsNullOrEmpty(hash))
             {
                 if (isIgnorePermanent || !this.IsPermanent)
                 {
@@ -231,7 +231,7 @@ namespace OpenTween
             if (e.KeyChar == '#')
             {
                 _hashSupl.ShowDialog();
-                if (!string.IsNullOrEmpty(_hashSupl.inputText))
+                if (!MyCommon.IsNullOrEmpty(_hashSupl.inputText))
                 {
                     var fHalf = "";
                     var eHalf = "";
@@ -256,7 +256,7 @@ namespace OpenTween
 
         public void ToggleHash()
         {
-            if (string.IsNullOrEmpty(this.UseHash))
+            if (MyCommon.IsNullOrEmpty(this.UseHash))
             {
                 if (this.HistoryHashList.Items.Count > 0)
                     this.UseHash = this.HistoryHashList.Items[0].ToString();
@@ -344,7 +344,7 @@ namespace OpenTween
         {
             //ハッシュタグの整形
             hashtag = hashtag.Trim();
-            if (string.IsNullOrEmpty(hashtag))
+            if (MyCommon.IsNullOrEmpty(hashtag))
             {
                 if (isShowWarn) MessageBox.Show("emply hashtag.", "Hashtag warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return false;
@@ -382,7 +382,7 @@ namespace OpenTween
                 hash += hs + " ";
             }
             hash = hash.Trim();
-            if (!string.IsNullOrEmpty(hash))
+            if (!MyCommon.IsNullOrEmpty(hash))
             {
                 this.AddHashToHistory(hash, true);
                 this.IsPermanent = this.CheckPermanent.Checked;
index 0584095..b109e17 100644 (file)
@@ -88,7 +88,7 @@ namespace OpenTween
 
         private async Task GetImageAsyncInternal(bool force)
         {
-            if (string.IsNullOrEmpty(this.imageUrl) || this.imageCache == null)
+            if (MyCommon.IsNullOrEmpty(this.imageUrl) || this.imageCache == null)
                 return;
 
             if (!force && this.imageReference.Target != null)
index fbbe78d..60b86be 100644 (file)
@@ -136,7 +136,7 @@ namespace OpenTween
             {
                 var listItem = (ListElement)this.ListsList.SelectedItem;
 
-                if (string.IsNullOrEmpty(this.NameTextBox.Text))
+                if (MyCommon.IsNullOrEmpty(this.NameTextBox.Text))
                 {
                     MessageBox.Show(Properties.Resources.ListManageOKButton1);
                     return;
@@ -322,7 +322,7 @@ namespace OpenTween
                 this.UserFollowerNum.Text = user.FollowersCount.ToString("#,###,##0");
                 this.UserPostsNum.Text = user.StatusesCount.ToString("#,###,##0");
                 this.UserProfile.Text = user.Description;
-                if (!string.IsNullOrEmpty(user.RecentPost))
+                if (!MyCommon.IsNullOrEmpty(user.RecentPost))
                 {
                     this.UserTweetDateTime.Text = user.PostCreatedAt.ToLocalTimeString("yy/MM/dd HH:mm");
                     this.UserTweet.Text = user.RecentPost;
index 5eec3e0..570dabc 100644 (file)
@@ -77,7 +77,7 @@ namespace OpenTween
             get
             {
                 var serviceName = this.ServiceName;
-                if (string.IsNullOrEmpty(serviceName))
+                if (MyCommon.IsNullOrEmpty(serviceName))
                     return null;
 
                 return this.pictureService.TryGetValue(serviceName, out var service)
@@ -200,7 +200,7 @@ namespace OpenTween
         /// </summary>
         private bool IsUploadable(string serviceName, string ext, long? size)
         {
-            if (!string.IsNullOrEmpty(serviceName))
+            if (!MyCommon.IsNullOrEmpty(serviceName))
             {
                 var imageService = this.pictureService[serviceName];
                 if (imageService.CheckFileExtension(ext))
@@ -394,7 +394,7 @@ namespace OpenTween
 
         private IMediaItem? CreateFileMediaItem(string path, bool noMsgBox)
         {
-            if (string.IsNullOrEmpty(path)) return null;
+            if (MyCommon.IsNullOrEmpty(path)) return null;
 
             try
             {
@@ -491,7 +491,7 @@ namespace OpenTween
                 if (isSelectedPage)
                     this.ClearImageSelectedPicture();
 
-                if (item == null || string.IsNullOrEmpty(item.Path)) return;
+                if (item == null || MyCommon.IsNullOrEmpty(item.Path)) return;
 
                 try
                 {
@@ -563,11 +563,11 @@ namespace OpenTween
             var text = string.Join(", ",
                 ImageServiceCombo.Items.Cast<string>()
                     .Where(serviceName =>
-                        !string.IsNullOrEmpty(serviceName) &&
+                        !MyCommon.IsNullOrEmpty(serviceName) &&
                         this.pictureService[serviceName].CheckFileExtension(ext) &&
                         this.pictureService[serviceName].CheckFileSize(ext, fileSize)));
 
-            if (string.IsNullOrEmpty(text))
+            if (MyCommon.IsNullOrEmpty(text))
                 return Properties.Resources.PostPictureWarn6;
 
             return text;
@@ -631,7 +631,7 @@ namespace OpenTween
         private void SelectImageServiceComboItem(string svc, int? index = null)
         {
             int idx;
-            if (string.IsNullOrEmpty(svc))
+            if (MyCommon.IsNullOrEmpty(svc))
             {
                 idx = index ?? 0;
             }
index 51fa8a5..2390e15 100644 (file)
@@ -44,7 +44,7 @@ namespace OpenTween.Models
         {
             this.Url = url;
             this.AltText = altText;
-            this.VideoUrl = !string.IsNullOrEmpty(videoUrl) ? videoUrl : null;
+            this.VideoUrl = !MyCommon.IsNullOrEmpty(videoUrl) ? videoUrl : null;
         }
 
         public override bool Equals(object? obj)
index c8ad53e..2a1df99 100644 (file)
@@ -331,7 +331,7 @@ namespace OpenTween.Models
         {
             var filterExprs = new List<Expression>();
 
-            if (useNameField && !string.IsNullOrEmpty(filterName))
+            if (useNameField && !MyCommon.IsNullOrEmpty(filterName))
             {
                 filterExprs.Add(Expression.OrElse(
                     this.MakeGenericFilter(postParam, "ScreenName", filterName, useRegex, caseSensitive, exactMatch: true),
@@ -339,7 +339,7 @@ namespace OpenTween.Models
             }
             foreach (var body in filterBody)
             {
-                if (string.IsNullOrEmpty(body))
+                if (MyCommon.IsNullOrEmpty(body))
                     continue;
 
                 Expression bodyExpr;
@@ -378,7 +378,7 @@ namespace OpenTween.Models
 
                 filterExprs.Add(bodyExpr);
             }
-            if (!string.IsNullOrEmpty(filterSource))
+            if (!MyCommon.IsNullOrEmpty(filterSource))
             {
                 if (filterByUrl)
                     filterExprs.Add(this.MakeGenericFilter(postParam, "SourceHtml", filterSource, useRegex, caseSensitive));
@@ -544,7 +544,7 @@ namespace OpenTween.Models
             {
                 if (this.UseNameField)
                 {
-                    if (!string.IsNullOrEmpty(this.FilterName))
+                    if (!MyCommon.IsNullOrEmpty(this.FilterName))
                     {
                         fs.AppendFormat(Properties.Resources.SetFiltersText1, this.FilterName);
                     }
@@ -593,7 +593,7 @@ namespace OpenTween.Models
                 {
                     fs.Append("LambdaExp/");
                 }
-                if (!string.IsNullOrEmpty(this.FilterSource))
+                if (!MyCommon.IsNullOrEmpty(this.FilterSource))
                 {
                     fs.AppendFormat("Src…{0}/", this.FilterSource);
                 }
@@ -606,7 +606,7 @@ namespace OpenTween.Models
                 fs.Append(Properties.Resources.SetFiltersText12);
                 if (this.ExUseNameField)
                 {
-                    if (!string.IsNullOrEmpty(this.ExFilterName))
+                    if (!MyCommon.IsNullOrEmpty(this.ExFilterName))
                     {
                         fs.AppendFormat(Properties.Resources.SetFiltersText1, this.ExFilterName);
                     }
@@ -655,7 +655,7 @@ namespace OpenTween.Models
                 {
                     fs.Append("LambdaExp/");
                 }
-                if (!string.IsNullOrEmpty(this.ExFilterSource))
+                if (!MyCommon.IsNullOrEmpty(this.ExFilterSource))
                 {
                     fs.AppendFormat("Src…{0}/", this.ExFilterSource);
                 }
@@ -691,18 +691,18 @@ namespace OpenTween.Models
         /// この振り分けルールにマッチ条件が含まれているかを返します
         /// </summary>
         public bool HasMatchConditions()
-            => !string.IsNullOrEmpty(this.FilterName) ||
-                this.FilterBody.Any(x => !string.IsNullOrEmpty(x)) ||
-                !string.IsNullOrEmpty(this.FilterSource) ||
+            => !MyCommon.IsNullOrEmpty(this.FilterName) ||
+                this.FilterBody.Any(x => !MyCommon.IsNullOrEmpty(x)) ||
+                !MyCommon.IsNullOrEmpty(this.FilterSource) ||
                 this.FilterRt;
 
         /// <summary>
         /// この振り分けルールに除外条件が含まれているかを返します
         /// </summary>
         public bool HasExcludeConditions()
-            => !string.IsNullOrEmpty(this.ExFilterName) ||
-                this.ExFilterBody.Any(x => !string.IsNullOrEmpty(x)) ||
-                !string.IsNullOrEmpty(this.ExFilterSource) ||
+            => !MyCommon.IsNullOrEmpty(this.ExFilterName) ||
+                this.ExFilterBody.Any(x => !MyCommon.IsNullOrEmpty(x)) ||
+                !MyCommon.IsNullOrEmpty(this.ExFilterSource) ||
                 this.ExFilterRt;
 
         public override bool Equals(object? obj)
index 8e8fd8c..e4c5dad 100644 (file)
@@ -70,7 +70,7 @@ namespace OpenTween.Models
 
         public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress)
         {
-            if (string.IsNullOrEmpty(this.SearchWords))
+            if (MyCommon.IsNullOrEmpty(this.SearchWords))
                 return;
 
             bool read;
index c6badd0..53a764a 100644 (file)
@@ -370,7 +370,7 @@ namespace OpenTween.Models
 
                         // 通知サウンドは TabClass.Notify の値に関わらず鳴らす
                         // SettingCommon.PlaySound が false であれば TweenMain 側で無効化される
-                        if (!string.IsNullOrEmpty(tab.SoundFile))
+                        if (!MyCommon.IsNullOrEmpty(tab.SoundFile))
                         {
                             if (!this.notifyPriorityByTabType.TryGetValue(tab.TabType, out var notifyPriority))
                                 notifyPriority = 0;
index f658754..07110ca 100644 (file)
@@ -51,7 +51,7 @@ namespace OpenTween.Models
 
         public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress<string> progress)
         {
-            if (string.IsNullOrEmpty(this.ScreenName))
+            if (MyCommon.IsNullOrEmpty(this.ScreenName))
                 return;
 
             bool read;
index 22a624c..8f8d6ee 100644 (file)
@@ -51,6 +51,7 @@ using System.Runtime.InteropServices;
 using OpenTween.Api;
 using OpenTween.Models;
 using OpenTween.Setting;
+using System.Diagnostics.CodeAnalysis;
 
 namespace OpenTween
 {
@@ -535,7 +536,7 @@ namespace OpenTween
 
         public static string EncryptString(string str)
         {
-            if (string.IsNullOrEmpty(str)) return "";
+            if (MyCommon.IsNullOrEmpty(str)) return "";
 
             //文字列をバイト型配列にする
             var bytesIn = Encoding.UTF8.GetBytes(str);
@@ -587,7 +588,7 @@ namespace OpenTween
 
         public static string DecryptString(string str)
         {
-            if (string.IsNullOrEmpty(str)) return "";
+            if (MyCommon.IsNullOrEmpty(str)) return "";
 
             //DESCryptoServiceProviderオブジェクトの作成
             using var des = new DESCryptoServiceProvider();
@@ -994,5 +995,8 @@ namespace OpenTween
             }
             return sb.ToString();
         }
+
+        public static bool IsNullOrEmpty([NotNullWhen(false)] string? value)
+            => string.IsNullOrEmpty(value);
     }
 }
index c318452..209824f 100644 (file)
@@ -330,7 +330,7 @@ namespace OpenTween
             InternetProxyInfo ipi;
 
             // Filling in structure
-            if (!string.IsNullOrEmpty(strProxy))
+            if (!MyCommon.IsNullOrEmpty(strProxy))
             {
                 ipi = new InternetProxyInfo
                 {
index 58df000..f8eab67 100644 (file)
@@ -152,7 +152,7 @@ namespace OpenTween
 
         private void buttonSearchTimeline_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(this.textSearchTimeline.Text))
+            if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text))
             {
                 this.DialogResult = DialogResult.Cancel;
                 return;
@@ -171,7 +171,7 @@ namespace OpenTween
 
         private void buttonSearchTimelineNew_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(this.textSearchTimeline.Text))
+            if (MyCommon.IsNullOrEmpty(this.textSearchTimeline.Text))
             {
                 this.DialogResult = DialogResult.Cancel;
                 return;
@@ -190,7 +190,7 @@ namespace OpenTween
 
         private void buttonSearchPublic_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(this.textSearchPublic.Text))
+            if (MyCommon.IsNullOrEmpty(this.textSearchPublic.Text))
             {
                 this.DialogResult = DialogResult.Cancel;
                 return;
index a4f9f3e..1a95869 100644 (file)
@@ -71,7 +71,7 @@ namespace OpenTween.Setting.Panel
 
         private void UserAppointUrlText_Validating(object sender, CancelEventArgs e)
         {
-            if (!UserAppointUrlText.Text.StartsWith("http", StringComparison.Ordinal) && !string.IsNullOrEmpty(UserAppointUrlText.Text))
+            if (!UserAppointUrlText.Text.StartsWith("http", StringComparison.Ordinal) && !MyCommon.IsNullOrEmpty(UserAppointUrlText.Text))
             {
                 MessageBox.Show("Text Error:正しいURLではありません");
             }
index dd1f359..e5d8dfa 100644 (file)
@@ -66,7 +66,7 @@ namespace OpenTween
 
         private string Encrypt(string password)
         {
-            if (string.IsNullOrEmpty(password)) password = "";
+            if (MyCommon.IsNullOrEmpty(password)) password = "";
             if (password.Length > 0)
             {
                 try
@@ -85,7 +85,7 @@ namespace OpenTween
         }
         private string Decrypt(string password)
         {
-            if (string.IsNullOrEmpty(password)) password = "";
+            if (MyCommon.IsNullOrEmpty(password)) password = "";
             if (password.Length > 0)
             {
                 try
@@ -249,7 +249,7 @@ namespace OpenTween
         [XmlIgnore]
         public Version? SkipUpdateVersion
         {
-            get => string.IsNullOrEmpty(this.SkipUpdateVersionStr) ? null : Version.Parse(this.SkipUpdateVersionStr);
+            get => MyCommon.IsNullOrEmpty(this.SkipUpdateVersionStr) ? null : Version.Parse(this.SkipUpdateVersionStr);
             set => this.SkipUpdateVersionStr = value == null ? "" : value.ToString();
         }
 
@@ -271,7 +271,7 @@ namespace OpenTween
         }
         private string Encrypt(string password)
         {
-            if (string.IsNullOrEmpty(password)) password = "";
+            if (MyCommon.IsNullOrEmpty(password)) password = "";
             if (password.Length > 0)
             {
                 try
@@ -290,7 +290,7 @@ namespace OpenTween
         }
         private string Decrypt(string password)
         {
-            if (string.IsNullOrEmpty(password)) password = "";
+            if (MyCommon.IsNullOrEmpty(password)) password = "";
             if (password.Length > 0)
             {
                 try
index eb4a608..2e9e6e7 100644 (file)
@@ -276,7 +276,7 @@ namespace OpenTween
             get
             {
                 var pwd = ProxyPassword;
-                if (string.IsNullOrEmpty(pwd)) pwd = "";
+                if (MyCommon.IsNullOrEmpty(pwd)) pwd = "";
                 if (pwd.Length > 0)
                 {
                     try
@@ -296,7 +296,7 @@ namespace OpenTween
             set
             {
                 var pwd = value;
-                if (string.IsNullOrEmpty(pwd)) pwd = "";
+                if (MyCommon.IsNullOrEmpty(pwd)) pwd = "";
                 if (pwd.Length > 0)
                 {
                     try
index 7da155c..12ee07d 100644 (file)
@@ -54,7 +54,7 @@ namespace OpenTween.Setting
             if (settings.UserAccounts == null || settings.UserAccounts.Count == 0)
             {
                 settings.UserAccounts = new List<UserAccount>();
-                if (!string.IsNullOrEmpty(settings.UserName))
+                if (!MyCommon.IsNullOrEmpty(settings.UserName))
                 {
                     var account = new UserAccount
                     {
index be314dc..2f60121 100644 (file)
@@ -402,7 +402,7 @@ namespace OpenTween
                 return srcUri;
 
             // OAuth2 アクセストークンまたは API キー (旧方式) のいずれも設定されていなければ短縮しない
-            if (string.IsNullOrEmpty(this.BitlyAccessToken) && (string.IsNullOrEmpty(this.BitlyId) || string.IsNullOrEmpty(this.BitlyKey)))
+            if (MyCommon.IsNullOrEmpty(this.BitlyAccessToken) && (MyCommon.IsNullOrEmpty(this.BitlyId) || MyCommon.IsNullOrEmpty(this.BitlyKey)))
                 return srcUri;
 
             var bitly = new BitlyApi
index 14f908a..d364f9a 100644 (file)
@@ -88,7 +88,7 @@ namespace OpenTween.Thumbnail.Services
                     .ConfigureAwait(false);
 
                 var thumbnailUrl = this.GetThumbnailUrl(content);
-                if (string.IsNullOrEmpty(thumbnailUrl)) return null;
+                if (MyCommon.IsNullOrEmpty(thumbnailUrl)) return null;
 
                 return new ThumbnailInfo
                 {
index 992bf62..8143ebc 100644 (file)
@@ -92,7 +92,7 @@ namespace OpenTween
             get => this._ApiEndpoint;
             set
             {
-                if (string.IsNullOrEmpty(value))
+                if (MyCommon.IsNullOrEmpty(value))
                 {
                     // リセット
                     this._ApiEndpoint = null;
@@ -222,7 +222,7 @@ namespace OpenTween
                 minuteText = Math.Ceiling(this.remainMinutes).ToString();
             }
 
-            var endpointText = string.IsNullOrEmpty(this._ApiEndpoint) ? "unknown" : this._ApiEndpoint;
+            var endpointText = MyCommon.IsNullOrEmpty(this._ApiEndpoint) ? "unknown" : this._ApiEndpoint;
 
             var textFormat = "API {0}/{1}";
             this.Text = string.Format(textFormat, remainCountText, maxCountText);
index 6a20283..db2a31f 100644 (file)
@@ -874,7 +874,7 @@ namespace OpenTween
             this.tw = new Twitter(this.twitterApi);
 
             //認証関連
-            if (string.IsNullOrEmpty(SettingManager.Common.Token)) SettingManager.Common.UserName = "";
+            if (MyCommon.IsNullOrEmpty(SettingManager.Common.Token)) SettingManager.Common.UserName = "";
             tw.Initialize(SettingManager.Common.Token, SettingManager.Common.TokenSecret, SettingManager.Common.UserName, SettingManager.Common.UserId);
 
             _initial = true;
@@ -885,14 +885,14 @@ namespace OpenTween
             var firstRun = false;
 
             //ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
-            if (string.IsNullOrEmpty(tw.Username))
+            if (MyCommon.IsNullOrEmpty(tw.Username))
             {
                 saveRequired = true;
                 firstRun = true;
 
                 //設定せずにキャンセルされたか、設定されたが依然ユーザー名が未設定ならプログラム終了
                 if (ShowSettingDialog(showTaskbarIcon: true) != DialogResult.OK ||
-                    string.IsNullOrEmpty(tw.Username))
+                    MyCommon.IsNullOrEmpty(tw.Username))
                 {
                     Application.Exit();  //強制終了
                     return;
@@ -911,7 +911,7 @@ namespace OpenTween
             tw.RestrictFavCheck = SettingManager.Common.RestrictFavCheck;
             tw.ReadOwnPost = SettingManager.Common.ReadOwnPost;
             tw.TrackWord = SettingManager.Common.TrackWord;
-            TrackToolStripMenuItem.Checked = !string.IsNullOrEmpty(tw.TrackWord);
+            TrackToolStripMenuItem.Checked = !MyCommon.IsNullOrEmpty(tw.TrackWord);
             tw.AllAtReply = SettingManager.Common.AllAtReply;
             AllrepliesToolStripMenuItem.Checked = tw.AllAtReply;
             ShortUrl.Instance.DisableExpanding = !SettingManager.Common.TinyUrlResolve;
@@ -953,7 +953,7 @@ namespace OpenTween
                                     SettingManager.Common.HashIsPermanent,
                                     SettingManager.Common.HashIsHead,
                                     SettingManager.Common.HashIsNotAddToAtReply);
-            if (!string.IsNullOrEmpty(HashMgr.UseHash) && HashMgr.IsPermanent) HashStripSplitButton.Text = HashMgr.UseHash;
+            if (!MyCommon.IsNullOrEmpty(HashMgr.UseHash) && HashMgr.IsPermanent) HashStripSplitButton.Text = HashMgr.UseHash;
 
             //アイコンリスト作成
             this.IconCache = new ImageCache();
@@ -1838,7 +1838,7 @@ namespace OpenTween
                                 nt = GrowlHelper.NotifyType.Notify;
                             }
                             var bText = sb.ToString();
-                            if (string.IsNullOrEmpty(bText)) return;
+                            if (MyCommon.IsNullOrEmpty(bText)) return;
 
                             var image = this.IconCache.TryGetFromCache(post.ImageUrl);
                             gh.Notify(nt, post.StatusId.ToString(), title.ToString(), bText, image?.Image, post.ImageUrl);
@@ -1897,7 +1897,7 @@ namespace OpenTween
                             title.AppendFormat(Properties.Resources.RefreshTimeline_NotifyText, addCount);
                         }
                         var bText = sb.ToString();
-                        if (string.IsNullOrEmpty(bText)) return;
+                        if (MyCommon.IsNullOrEmpty(bText)) return;
 
                         NotifyIcon1.BalloonTipTitle = title.ToString();
                         NotifyIcon1.BalloonTipText = bText;
@@ -1908,7 +1908,7 @@ namespace OpenTween
             }
 
             //サウンド再生
-            if (!_initial && SettingManager.Common.PlaySound && !string.IsNullOrEmpty(soundFile))
+            if (!_initial && SettingManager.Common.PlaySound && !MyCommon.IsNullOrEmpty(soundFile))
             {
                 try
                 {
@@ -2669,7 +2669,7 @@ namespace OpenTween
             if (ct.IsCancellationRequested)
                 return;
 
-            if (!string.IsNullOrEmpty(errMsg) &&
+            if (!MyCommon.IsNullOrEmpty(errMsg) &&
                 !errMsg.StartsWith("OK:", StringComparison.Ordinal) &&
                 !errMsg.StartsWith("Warn:", StringComparison.Ordinal))
             {
@@ -2706,7 +2706,7 @@ namespace OpenTween
                     this._postTimestamps.RemoveAt(i);
             }
 
-            if (!this.HashMgr.IsPermanent && !string.IsNullOrEmpty(this.HashMgr.UseHash))
+            if (!this.HashMgr.IsPermanent && !MyCommon.IsNullOrEmpty(this.HashMgr.UseHash))
             {
                 this.HashMgr.ClearHashtag();
                 this.HashStripSplitButton.Text = "#[-]";
@@ -3291,7 +3291,7 @@ namespace OpenTween
             {
                 RepliedStatusOpenMenuItem.Enabled = true;
             }
-            if (!this.ExistCurrentPost || post == null || string.IsNullOrEmpty(post.RetweetedBy))
+            if (!this.ExistCurrentPost || post == null || MyCommon.IsNullOrEmpty(post.RetweetedBy))
             {
                 MoveToRTHomeMenuItem.Enabled = false;
             }
@@ -3864,7 +3864,7 @@ namespace OpenTween
             //同一検索条件のタブが既に存在すれば、そのタブアクティブにして終了
             foreach (var tb in _statuses.GetTabsByType<PublicSearchTabModel>())
             {
-                if (tb.SearchWords == searchWord && string.IsNullOrEmpty(tb.SearchLang))
+                if (tb.SearchWords == searchWord && MyCommon.IsNullOrEmpty(tb.SearchLang))
                 {
                     var tabIndex = this._statuses.Tabs.IndexOf(tb);
                     this.ListTab.SelectedIndex = tabIndex;
@@ -4076,7 +4076,7 @@ namespace OpenTween
                         btn.TabIndex = 3;
                         btn.Click += SearchButton_Click;
 
-                        if (!string.IsNullOrEmpty(searchTab.SearchWords))
+                        if (!MyCommon.IsNullOrEmpty(searchTab.SearchWords))
                         {
                             cmb.Items.Add(searchTab.SearchWords);
                             cmb.Text = searchTab.SearchWords;
@@ -4284,7 +4284,7 @@ namespace OpenTween
                     tn = this.CurrentTabName;
                 }
 
-                if (string.IsNullOrEmpty(tn)) return;
+                if (MyCommon.IsNullOrEmpty(tn)) return;
 
                 var tabIndex = this._statuses.Tabs.IndexOf(tn);
                 if (tabIndex != -1)
@@ -4404,7 +4404,7 @@ namespace OpenTween
             var eHalf = "";
             if (dialog.DialogResult == DialogResult.OK)
             {
-                if (!string.IsNullOrEmpty(dialog.inputText))
+                if (!MyCommon.IsNullOrEmpty(dialog.inputText))
                 {
                     if (selStart > 0)
                     {
@@ -4484,7 +4484,7 @@ namespace OpenTween
 
             this.StatusText.AccessibleDescription = string.Format(Properties.Resources.StatusText_AccessibleDescription, pLen);
 
-            if (string.IsNullOrEmpty(StatusText.Text))
+            if (MyCommon.IsNullOrEmpty(StatusText.Text))
             {
                 this.inReplyTo = null;
             }
@@ -4640,7 +4640,7 @@ namespace OpenTween
             var footer = "";
 
             var hashtag = this.HashMgr.UseHash;
-            if (!string.IsNullOrEmpty(hashtag) && !(this.HashMgr.IsNotAddToAtReply && this.inReplyTo != null))
+            if (!MyCommon.IsNullOrEmpty(hashtag) && !(this.HashMgr.IsNotAddToAtReply && this.inReplyTo != null))
             {
                 if (HashMgr.IsHead)
                     header = HashMgr.UseHash + " ";
@@ -4655,7 +4655,7 @@ namespace OpenTween
                     // 推奨ステータスを使用する
                     footer += this.recommendedStatusFooter;
                 }
-                else if (!string.IsNullOrEmpty(SettingManager.Local.StatusText))
+                else if (!MyCommon.IsNullOrEmpty(SettingManager.Local.StatusText))
                 {
                     // テキストボックスに入力されている文字列を使用する
                     footer += " " + SettingManager.Local.StatusText.Trim();
@@ -6484,7 +6484,7 @@ namespace OpenTween
                 if (post.ScreenName == _anchorPost.ScreenName ||
                     post.RetweetedBy == _anchorPost.ScreenName ||
                     post.ScreenName == _anchorPost.RetweetedBy ||
-                    (!string.IsNullOrEmpty(post.RetweetedBy) && post.RetweetedBy == _anchorPost.RetweetedBy) ||
+                    (!MyCommon.IsNullOrEmpty(post.RetweetedBy) && post.RetweetedBy == _anchorPost.RetweetedBy) ||
                     _anchorPost.ReplyToList.Any(x => x.UserId == post.UserId) ||
                     _anchorPost.ReplyToList.Any(x => x.UserId == post.RetweetedByUserId) ||
                     post.ReplyToList.Any(x => x.UserId == _anchorPost.UserId) ||
@@ -7241,7 +7241,7 @@ namespace OpenTween
                 newTabName = inputName.TabName;
             }
             this.TopMost = SettingManager.Common.AlwaysTop;
-            if (!string.IsNullOrEmpty(newTabName))
+            if (!MyCommon.IsNullOrEmpty(newTabName))
             {
                 //新タブ名存在チェック
                 if (this._statuses.ContainsTab(newTabName))
@@ -7344,7 +7344,7 @@ namespace OpenTween
             }
 
             //タブのないところにドロップ->最後尾へ移動
-            if (string.IsNullOrEmpty(tn))
+            if (MyCommon.IsNullOrEmpty(tn))
             {
                 var lastTab = this._statuses.Tabs.Last();
                 tn = lastTab.TabName;
@@ -7420,7 +7420,7 @@ namespace OpenTween
                         StatusText.Focus();
                         return;
                     }
-                    if (string.IsNullOrEmpty(StatusText.Text))
+                    if (MyCommon.IsNullOrEmpty(StatusText.Text))
                     {
                         //空の場合
                         var inReplyToStatusId = post.RetweetedId ?? post.StatusId;
@@ -7593,7 +7593,7 @@ namespace OpenTween
                                         ids += "@" + screenName + " ";
                                 }
                             }
-                            if (!string.IsNullOrEmpty(post.RetweetedBy))
+                            if (!MyCommon.IsNullOrEmpty(post.RetweetedBy))
                             {
                                 if (!ids.Contains("@" + post.RetweetedBy + " ") && post.RetweetedByUserId != tw.UserId)
                                 {
@@ -7601,7 +7601,7 @@ namespace OpenTween
                                 }
                             }
                             if (ids.Length == 0) return;
-                            if (string.IsNullOrEmpty(StatusText.Text))
+                            if (MyCommon.IsNullOrEmpty(StatusText.Text))
                             {
                                 //未入力の場合のみ返信先付加
                                 var inReplyToStatusId = post.RetweetedId ?? post.StatusId;
@@ -7709,7 +7709,7 @@ namespace OpenTween
         private void ContextMenuTabProperty_Opening(object sender, CancelEventArgs e)
         {
             //右クリックの場合はタブ名が設定済。アプリケーションキーの場合は現在のタブを対象とする
-            if (string.IsNullOrEmpty(_rclickTabName) || sender != ContextMenuTabProperty)
+            if (MyCommon.IsNullOrEmpty(_rclickTabName) || sender != ContextMenuTabProperty)
                 _rclickTabName = this.CurrentTabName;
 
             if (_statuses == null) return;
@@ -7793,7 +7793,7 @@ namespace OpenTween
             this.DeleteTabMenuItem.Enabled = !checkState;
             this.DeleteTbMenuItem.Enabled = !checkState;
 
-            if (string.IsNullOrEmpty(_rclickTabName)) return;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
             _statuses.Tabs[_rclickTabName].Protected = checkState;
 
             SaveConfigsTabs();
@@ -7804,7 +7804,7 @@ namespace OpenTween
             UreadManageMenuItem.Checked = ((ToolStripMenuItem)sender).Checked;
             this.UnreadMngTbMenuItem.Checked = UreadManageMenuItem.Checked;
 
-            if (string.IsNullOrEmpty(_rclickTabName)) return;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
             ChangeTabUnreadManage(_rclickTabName, UreadManageMenuItem.Checked);
 
             SaveConfigsTabs();
@@ -7844,7 +7844,7 @@ namespace OpenTween
             NotifyDispMenuItem.Checked = ((ToolStripMenuItem)sender).Checked;
             this.NotifyTbMenuItem.Checked = NotifyDispMenuItem.Checked;
 
-            if (string.IsNullOrEmpty(_rclickTabName)) return;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
 
             _statuses.Tabs[_rclickTabName].Notify = NotifyDispMenuItem.Checked;
 
@@ -7853,7 +7853,7 @@ namespace OpenTween
 
         private void SoundFileComboBox_SelectedIndexChanged(object sender, EventArgs e)
         {
-            if (soundfileListup || string.IsNullOrEmpty(_rclickTabName)) return;
+            if (soundfileListup || MyCommon.IsNullOrEmpty(_rclickTabName)) return;
 
             _statuses.Tabs[_rclickTabName].SoundFile = (string)((ToolStripComboBox)sender).SelectedItem;
 
@@ -7862,7 +7862,7 @@ namespace OpenTween
 
         private void DeleteTabMenuItem_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(_rclickTabName) || sender == this.DeleteTbMenuItem)
+            if (MyCommon.IsNullOrEmpty(_rclickTabName) || sender == this.DeleteTbMenuItem)
                 _rclickTabName = this.CurrentTabName;
 
             RemoveSpecifiedTab(_rclickTabName, true);
@@ -7871,7 +7871,7 @@ namespace OpenTween
 
         private void FilterEditMenuItem_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(_rclickTabName)) _rclickTabName = _statuses.HomeTab.TabName;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) _rclickTabName = _statuses.HomeTab.TabName;
 
             using (var fltDialog = new FilterDialog())
             {
@@ -7899,7 +7899,7 @@ namespace OpenTween
                 tabUsage = inputName.Usage;
             }
             this.TopMost = SettingManager.Common.AlwaysTop;
-            if (!string.IsNullOrEmpty(tabName))
+            if (!MyCommon.IsNullOrEmpty(tabName))
             {
                 //List対応
                 ListElement? list = null;
@@ -8221,7 +8221,7 @@ namespace OpenTween
                         tabName = inputName.TabName;
                     }
                     this.TopMost = SettingManager.Common.AlwaysTop;
-                    if (!string.IsNullOrEmpty(tabName))
+                    if (!MyCommon.IsNullOrEmpty(tabName))
                     {
                         var newTab = new FilterTabModel(tabName);
                         if (!_statuses.AddTab(newTab) || !AddNewTab(newTab, startup: false))
@@ -8336,7 +8336,7 @@ namespace OpenTween
                 var href = linkElm.GetAttribute("href");
                 var linkedText = linkElm.InnerText;
 
-                if (string.IsNullOrEmpty(displayUrl))
+                if (MyCommon.IsNullOrEmpty(displayUrl))
                     displayUrl = href;
 
                 links.Add(new OpenUrlItem(linkedText, displayUrl, href));
@@ -8379,7 +8379,7 @@ namespace OpenTween
 
         private void ClearTabMenuItem_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(_rclickTabName)) return;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
             ClearTab(_rclickTabName, true);
         }
 
@@ -8639,11 +8639,11 @@ namespace OpenTween
                     HashSupl.AddItem("#" + hm.Result("$3"));
                 }
             }
-            if (!string.IsNullOrEmpty(HashMgr.UseHash) && !hstr.Contains(HashMgr.UseHash + " "))
+            if (!MyCommon.IsNullOrEmpty(HashMgr.UseHash) && !hstr.Contains(HashMgr.UseHash + " "))
             {
                 hstr += HashMgr.UseHash;
             }
-            if (!string.IsNullOrEmpty(hstr)) HashMgr.AddHashToHistory(hstr.Trim(), false);
+            if (!MyCommon.IsNullOrEmpty(hstr)) HashMgr.AddHashToHistory(hstr.Trim(), false);
 
             // 本当にリプライ先指定すべきかどうかの判定
             m = Regex.Matches(StatusText, "(^|[ -/:-@[-^`{-~])(?<id>@[a-zA-Z0-9_]+)");
@@ -8867,8 +8867,8 @@ namespace OpenTween
             if (Converter_Type == MyCommon.UrlConverter.Bitly || Converter_Type == MyCommon.UrlConverter.Jmp)
             {
                 // OAuth2 アクセストークンまたは API キー (旧方式) のいずれも設定されていなければ短縮しない
-                if (string.IsNullOrEmpty(SettingManager.Common.BitlyAccessToken) &&
-                    (string.IsNullOrEmpty(SettingManager.Common.BilyUser) || string.IsNullOrEmpty(SettingManager.Common.BitlyPwd)))
+                if (MyCommon.IsNullOrEmpty(SettingManager.Common.BitlyAccessToken) &&
+                    (MyCommon.IsNullOrEmpty(SettingManager.Common.BilyUser) || MyCommon.IsNullOrEmpty(SettingManager.Common.BitlyPwd)))
                 {
                     MessageBox.Show(this, Properties.Resources.UrlConvert_BitlyAuthRequired, ApplicationSettings.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     return false;
@@ -8921,7 +8921,7 @@ namespace OpenTween
                         return true;
                     }
 
-                    if (!string.IsNullOrEmpty(result))
+                    if (!MyCommon.IsNullOrEmpty(result))
                     {
                         var undotmp = new urlUndo();
 
@@ -9006,7 +9006,7 @@ namespace OpenTween
                         continue;
                     }
 
-                    if (!string.IsNullOrEmpty(result))
+                    if (!MyCommon.IsNullOrEmpty(result))
                     {
                         // 短縮 URL が生成されるまでの間に投稿欄から元の URL が削除されていたら中断する
                         var origUrlIndex = this.StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal);
@@ -9452,7 +9452,7 @@ namespace OpenTween
                 try
                 {
                     var configBrowserPath = SettingManager.Local.BrowserPath;
-                    if (!string.IsNullOrEmpty(configBrowserPath))
+                    if (!MyCommon.IsNullOrEmpty(configBrowserPath))
                     {
                         if (configBrowserPath.StartsWith("\"", StringComparison.Ordinal) && configBrowserPath.Length > 2 && configBrowserPath.IndexOf("\"", 2, StringComparison.Ordinal) > -1)
                         {
@@ -9879,7 +9879,7 @@ namespace OpenTween
 
         private void TabRenameMenuItem_Click(object sender, EventArgs e)
         {
-            if (string.IsNullOrEmpty(_rclickTabName)) return;
+            if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
 
             _ = TabRename(_rclickTabName, out _);
         }
@@ -10259,7 +10259,7 @@ namespace OpenTween
 
             tb.SearchWords = cmb.Text;
             tb.SearchLang = cmbLang.Text;
-            if (string.IsNullOrEmpty(cmb.Text))
+            if (MyCommon.IsNullOrEmpty(cmb.Text))
             {
                 listView.Focus();
                 SaveConfigsTabs();
@@ -10440,7 +10440,7 @@ namespace OpenTween
             }
             this.TopMost = SettingManager.Common.AlwaysTop;
             if (rslt == DialogResult.Cancel) return;
-            if (!string.IsNullOrEmpty(HashMgr.UseHash))
+            if (!MyCommon.IsNullOrEmpty(HashMgr.UseHash))
             {
                 HashStripSplitButton.Text = HashMgr.UseHash;
                 HashTogglePullDownMenuItem.Checked = true;
@@ -10460,7 +10460,7 @@ namespace OpenTween
         private void HashToggleMenuItem_Click(object sender, EventArgs e)
         {
             HashMgr.ToggleHash();
-            if (!string.IsNullOrEmpty(HashMgr.UseHash))
+            if (!MyCommon.IsNullOrEmpty(HashMgr.UseHash))
             {
                 HashStripSplitButton.Text = HashMgr.UseHash;
                 HashToggleMenuItem.Checked = true;
@@ -10577,7 +10577,7 @@ namespace OpenTween
             {
                 OpenRepSourceOpMenuItem.Enabled = true;
             }
-            if (!this.ExistCurrentPost || post == null || string.IsNullOrEmpty(post.RetweetedBy))
+            if (!this.ExistCurrentPost || post == null || MyCommon.IsNullOrEmpty(post.RetweetedBy))
             {
                 OpenRterHomeMenuItem.Enabled = false;
             }
@@ -11204,13 +11204,13 @@ namespace OpenTween
                 title.Append(" [");
                 title.Append(ev.Event.ToUpper(CultureInfo.CurrentCulture));
                 title.Append("] by ");
-                if (!string.IsNullOrEmpty(ev.Username))
+                if (!MyCommon.IsNullOrEmpty(ev.Username))
                 {
                     title.Append(ev.Username);
                 }
 
                 string text;
-                if (!string.IsNullOrEmpty(ev.Target))
+                if (!MyCommon.IsNullOrEmpty(ev.Target))
                     text = ev.Target;
                 else
                     text = " ";
@@ -11231,7 +11231,7 @@ namespace OpenTween
 
             //サウンド再生
             var snd = SettingManager.Common.EventSoundFile;
-            if (!_initial && SettingManager.Common.PlaySound && !string.IsNullOrEmpty(snd))
+            if (!_initial && SettingManager.Common.PlaySound && !MyCommon.IsNullOrEmpty(snd))
             {
                 if ((ev.Eventtype & SettingManager.Common.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
                 {
@@ -11292,7 +11292,7 @@ namespace OpenTween
                 {
                     tw.TrackWord = inputTrack;
                     this.MarkSettingCommonModified();
-                    TrackToolStripMenuItem.Checked = !string.IsNullOrEmpty(inputTrack);
+                    TrackToolStripMenuItem.Checked = !MyCommon.IsNullOrEmpty(inputTrack);
                     tw.ReconnectUserStream();
                 }
             }
@@ -11379,7 +11379,7 @@ namespace OpenTween
             inputName.TabName = id;
 
             if (inputName.ShowDialog() == DialogResult.OK &&
-                !string.IsNullOrEmpty(inputName.TabName.Trim()))
+                !MyCommon.IsNullOrEmpty(inputName.TabName.Trim()))
             {
                 id = inputName.TabName.Trim();
             }
@@ -11393,7 +11393,7 @@ namespace OpenTween
         private async void UserTimelineToolStripMenuItem_Click(object sender, EventArgs e)
         {
             var id = GetUserIdFromCurPostOrInput("Show UserTimeline");
-            if (!string.IsNullOrEmpty(id))
+            if (!MyCommon.IsNullOrEmpty(id))
             {
                 await this.AddNewTabForUserTimeline(id);
             }
@@ -11582,7 +11582,7 @@ namespace OpenTween
 
         private void tweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e)
         {
-            if (!string.IsNullOrEmpty(e.StatusText))
+            if (!MyCommon.IsNullOrEmpty(e.StatusText))
             {
                 this.StatusLabelUrl.Text = e.StatusText;
             }
index 1b56aa3..b005bcb 100644 (file)
@@ -233,7 +233,7 @@ namespace OpenTween
 
         private async Task SetUserPictureAsync(string imageUrl, bool force = false)
         {
-            if (string.IsNullOrEmpty(imageUrl))
+            if (MyCommon.IsNullOrEmpty(imageUrl))
                 return;
 
             if (this.IconCache == null)
@@ -364,7 +364,7 @@ namespace OpenTween
 
         private async Task DoTranslation(string str)
         {
-            if (string.IsNullOrEmpty(str))
+            if (MyCommon.IsNullOrEmpty(str))
                 return;
 
             var bing = new Bing();
@@ -504,7 +504,7 @@ namespace OpenTween
                 {
                     this.RaiseStatusChanged(this.PostBrowser.StatusText.Replace("&", "&&"));
                 }
-                if (string.IsNullOrEmpty(PostBrowser.StatusText))
+                if (MyCommon.IsNullOrEmpty(PostBrowser.StatusText))
                 {
                     this.RaiseStatusChanged(statusText: "");
                 }
@@ -545,7 +545,7 @@ namespace OpenTween
             if (this.CurrentPost != null)
             {
                 var name = this.CurrentPost.ImageUrl;
-                if (!string.IsNullOrEmpty(name))
+                if (!MyCommon.IsNullOrEmpty(name))
                 {
                     var idx = name.LastIndexOf('/');
                     if (idx != -1)
@@ -692,7 +692,7 @@ namespace OpenTween
         private async void IconNameToolStripMenuItem_Click(object sender, EventArgs e)
         {
             var imageUrl = this.CurrentPost?.ImageUrl;
-            if (string.IsNullOrEmpty(imageUrl))
+            if (MyCommon.IsNullOrEmpty(imageUrl))
                 return;
 
             await this.Owner.OpenUriInBrowserAsync(imageUrl.Remove(imageUrl.LastIndexOf("_normal", StringComparison.Ordinal), 7)); // "_normal".Length
@@ -701,7 +701,7 @@ namespace OpenTween
         private async void ReloadIconToolStripMenuItem_Click(object sender, EventArgs e)
         {
             var imageUrl = this.CurrentPost?.ImageUrl;
-            if (string.IsNullOrEmpty(imageUrl))
+            if (MyCommon.IsNullOrEmpty(imageUrl))
                 return;
 
             await this.SetUserPictureAsync(imageUrl, force: true);
@@ -710,7 +710,7 @@ namespace OpenTween
         private void SaveIconPictureToolStripMenuItem_Click(object sender, EventArgs e)
         {
             var imageUrl = this.CurrentPost?.ImageUrl;
-            if (string.IsNullOrEmpty(imageUrl))
+            if (MyCommon.IsNullOrEmpty(imageUrl))
                 return;
 
             var memoryImage = this.IconCache.TryGetFromCache(imageUrl);
@@ -885,7 +885,7 @@ namespace OpenTween
                     if (link.GetAttribute("href") == this._postBrowserStatusText)
                     {
                         var linkStr = link.GetAttribute("title");
-                        if (string.IsNullOrEmpty(linkStr))
+                        if (MyCommon.IsNullOrEmpty(linkStr))
                             linkStr = link.GetAttribute("href");
 
                         Clipboard.SetDataObject(linkStr, false, 5, 100);
index 91865cb..a881dee 100644 (file)
@@ -168,7 +168,7 @@ namespace OpenTween
             if (!SettingManager.Local.UseTwemoji)
                 return t(e(targetText));
 
-            if (string.IsNullOrEmpty(entity.Url))
+            if (MyCommon.IsNullOrEmpty(entity.Url))
                 return "";
 
             return "<img class=\"emoji\" src=\"" + e(entity.Url) + "\" alt=\"" + e(entity.Text) + "\" />";
index 4f02655..b4df43f 100644 (file)
@@ -93,7 +93,7 @@ namespace OpenTween
                 loadTasks.Add(loadTask);
 
                 var tooltipText = thumb.TooltipText;
-                if (!string.IsNullOrEmpty(tooltipText))
+                if (!MyCommon.IsNullOrEmpty(tooltipText))
                 {
                     this.toolTip.SetToolTip(picbox, tooltipText);
                     picbox.AccessibleDescription = tooltipText;
index e184c27..64a46ec 100644 (file)
@@ -216,7 +216,7 @@ namespace OpenTween
         public void Initialize(string token, string tokenSecret, string username, long userId)
         {
             //OAuth認証
-            if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(tokenSecret) || string.IsNullOrEmpty(username))
+            if (MyCommon.IsNullOrEmpty(token) || MyCommon.IsNullOrEmpty(tokenSecret) || MyCommon.IsNullOrEmpty(username))
             {
                 Twitter.AccountState = MyCommon.ACCOUNT_STATE.Invalid;
             }
@@ -579,10 +579,10 @@ namespace OpenTween
             var count = GetApiResultCount(MyCommon.WORKERTYPE.UserTimeline, more, false);
 
             TwitterStatus[] statuses;
-            if (string.IsNullOrEmpty(userName))
+            if (MyCommon.IsNullOrEmpty(userName))
             {
                 var target = tab.ScreenName;
-                if (string.IsNullOrEmpty(target)) return;
+                if (MyCommon.IsNullOrEmpty(target)) return;
                 userName = target;
                 statuses = await this.Api.StatusesUserTimeline(userName, count)
                     .ConfigureAwait(false);
@@ -1397,14 +1397,14 @@ namespace OpenTween
                 {
                     foreach (var m in entities.Urls)
                     {
-                        if (!string.IsNullOrEmpty(m.DisplayUrl)) text = text.Replace(m.Url, m.DisplayUrl);
+                        if (!MyCommon.IsNullOrEmpty(m.DisplayUrl)) text = text.Replace(m.Url, m.DisplayUrl);
                     }
                 }
                 if (entities.Media != null)
                 {
                     foreach (var m in entities.Media)
                     {
-                        if (!string.IsNullOrEmpty(m.DisplayUrl)) text = text.Replace(m.Url, m.DisplayUrl);
+                        if (!MyCommon.IsNullOrEmpty(m.DisplayUrl)) text = text.Replace(m.Url, m.DisplayUrl);
                     }
                 }
             }
@@ -1435,7 +1435,7 @@ namespace OpenTween
                         }
                     }
 
-                    if (!string.IsNullOrEmpty(entity.DisplayUrl))
+                    if (!MyCommon.IsNullOrEmpty(entity.DisplayUrl))
                         text = text.Replace(entity.Url, entity.DisplayUrl);
                 }
             }
@@ -1444,11 +1444,11 @@ namespace OpenTween
             {
                 foreach (var entity in entities.Media)
                 {
-                    if (!string.IsNullOrEmpty(entity.AltText))
+                    if (!MyCommon.IsNullOrEmpty(entity.AltText))
                     {
                         text = text.Replace(entity.Url, string.Format(Properties.Resources.ImageAltText, entity.AltText));
                     }
-                    else if (!string.IsNullOrEmpty(entity.DisplayUrl))
+                    else if (!MyCommon.IsNullOrEmpty(entity.DisplayUrl))
                     {
                         text = text.Replace(entity.Url, entity.DisplayUrl);
                     }
@@ -1670,7 +1670,7 @@ namespace OpenTween
         /// </summary>
         internal static (string SourceText, Uri? SourceUri) ParseSource(string? sourceHtml)
         {
-            if (string.IsNullOrEmpty(sourceHtml))
+            if (MyCommon.IsNullOrEmpty(sourceHtml))
                 return ("", null);
 
             string sourceText;