["longUrl"] = srcUri.OriginalString,
};
- if (!string.IsNullOrEmpty(domain))
+ if (!MyCommon.IsNullOrEmpty(domain))
query["domain"] = domain;
var uri = new Uri("/v3/shorten", UriKind.Relative);
private IEnumerable<KeyValuePair<string, string>> CreateAccessTokenParams()
{
- if (string.IsNullOrEmpty(this.EndUserAccessToken))
+ if (MyCommon.IsNullOrEmpty(this.EndUserAccessToken))
{
return new[]
{
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()
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()
return null;
// たまに出てくる空文字列は無視する
- if (string.IsNullOrEmpty(header[headerName]))
+ if (MyCommon.IsNullOrEmpty(header[headerName]))
return null;
switch (header[headerName])
public static ITwitterStreamMessage ParseLine(string line)
{
- if (string.IsNullOrEmpty(line))
+ if (MyCommon.IsNullOrEmpty(line))
return new StreamMessageKeepAlive();
if (line.First() != '{' || line.Last() != '}')
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);
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)
{
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))
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;
}
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)
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);
}
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:
["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;
}
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));
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);
private bool IsFilterMatch(Twitter.FormattedEvent x)
{
- if (!CheckBoxFilter.Checked || string.IsNullOrEmpty(TextBoxKeyword.Text))
+ if (!CheckBoxFilter.Checked || MyCommon.IsNullOrEmpty(TextBoxKeyword.Text))
{
return true;
}
else
{
ft.FilterBody = bdy.Split(' ', ' ')
- .Where(x => !string.IsNullOrEmpty(x))
+ .Where(x => !MyCommon.IsNullOrEmpty(x))
.ToArray();
}
else
{
ft.ExFilterBody = bdy.Split(' ', ' ')
- .Where(x => !string.IsNullOrEmpty(x))
+ .Where(x => !MyCommon.IsNullOrEmpty(x))
.ToArray();
}
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;
}
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;
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;
}
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;
tabName = inputName.TabName;
tabType = inputName.Usage;
}
- if (!string.IsNullOrEmpty(tabName))
+ if (!MyCommon.IsNullOrEmpty(tabName))
{
//List対応
ListElement? list = null;
};
object? n;
- if (icon != null || !string.IsNullOrEmpty(url))
+ if (icon != null || !MyCommon.IsNullOrEmpty(url))
{
var gCore = _core!.GetType("Growl.CoreLibrary.Resource");
object? res;
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;
public void AddHashToHistory(string hash, bool isIgnorePermanent)
{
hash = hash.Trim();
- if (!string.IsNullOrEmpty(hash))
+ if (!MyCommon.IsNullOrEmpty(hash))
{
if (isIgnorePermanent || !this.IsPermanent)
{
if (e.KeyChar == '#')
{
_hashSupl.ShowDialog();
- if (!string.IsNullOrEmpty(_hashSupl.inputText))
+ if (!MyCommon.IsNullOrEmpty(_hashSupl.inputText))
{
var fHalf = "";
var eHalf = "";
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();
{
//ハッシュタグの整形
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;
hash += hs + " ";
}
hash = hash.Trim();
- if (!string.IsNullOrEmpty(hash))
+ if (!MyCommon.IsNullOrEmpty(hash))
{
this.AddHashToHistory(hash, true);
this.IsPermanent = this.CheckPermanent.Checked;
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)
{
var listItem = (ListElement)this.ListsList.SelectedItem;
- if (string.IsNullOrEmpty(this.NameTextBox.Text))
+ if (MyCommon.IsNullOrEmpty(this.NameTextBox.Text))
{
MessageBox.Show(Properties.Resources.ListManageOKButton1);
return;
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;
get
{
var serviceName = this.ServiceName;
- if (string.IsNullOrEmpty(serviceName))
+ if (MyCommon.IsNullOrEmpty(serviceName))
return null;
return this.pictureService.TryGetValue(serviceName, out var service)
/// </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))
private IMediaItem? CreateFileMediaItem(string path, bool noMsgBox)
{
- if (string.IsNullOrEmpty(path)) return null;
+ if (MyCommon.IsNullOrEmpty(path)) return null;
try
{
if (isSelectedPage)
this.ClearImageSelectedPicture();
- if (item == null || string.IsNullOrEmpty(item.Path)) return;
+ if (item == null || MyCommon.IsNullOrEmpty(item.Path)) return;
try
{
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;
private void SelectImageServiceComboItem(string svc, int? index = null)
{
int idx;
- if (string.IsNullOrEmpty(svc))
+ if (MyCommon.IsNullOrEmpty(svc))
{
idx = index ?? 0;
}
{
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)
{
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),
}
foreach (var body in filterBody)
{
- if (string.IsNullOrEmpty(body))
+ if (MyCommon.IsNullOrEmpty(body))
continue;
Expression bodyExpr;
filterExprs.Add(bodyExpr);
}
- if (!string.IsNullOrEmpty(filterSource))
+ if (!MyCommon.IsNullOrEmpty(filterSource))
{
if (filterByUrl)
filterExprs.Add(this.MakeGenericFilter(postParam, "SourceHtml", filterSource, useRegex, caseSensitive));
{
if (this.UseNameField)
{
- if (!string.IsNullOrEmpty(this.FilterName))
+ if (!MyCommon.IsNullOrEmpty(this.FilterName))
{
fs.AppendFormat(Properties.Resources.SetFiltersText1, this.FilterName);
}
{
fs.Append("LambdaExp/");
}
- if (!string.IsNullOrEmpty(this.FilterSource))
+ if (!MyCommon.IsNullOrEmpty(this.FilterSource))
{
fs.AppendFormat("Src…{0}/", this.FilterSource);
}
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);
}
{
fs.Append("LambdaExp/");
}
- if (!string.IsNullOrEmpty(this.ExFilterSource))
+ if (!MyCommon.IsNullOrEmpty(this.ExFilterSource))
{
fs.AppendFormat("Src…{0}/", this.ExFilterSource);
}
/// この振り分けルールにマッチ条件が含まれているかを返します
/// </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)
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;
// 通知サウンドは 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;
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;
using OpenTween.Api;
using OpenTween.Models;
using OpenTween.Setting;
+using System.Diagnostics.CodeAnalysis;
namespace OpenTween
{
public static string EncryptString(string str)
{
- if (string.IsNullOrEmpty(str)) return "";
+ if (MyCommon.IsNullOrEmpty(str)) return "";
//文字列をバイト型配列にする
var bytesIn = Encoding.UTF8.GetBytes(str);
public static string DecryptString(string str)
{
- if (string.IsNullOrEmpty(str)) return "";
+ if (MyCommon.IsNullOrEmpty(str)) return "";
//DESCryptoServiceProviderオブジェクトの作成
using var des = new DESCryptoServiceProvider();
}
return sb.ToString();
}
+
+ public static bool IsNullOrEmpty([NotNullWhen(false)] string? value)
+ => string.IsNullOrEmpty(value);
}
}
InternetProxyInfo ipi;
// Filling in structure
- if (!string.IsNullOrEmpty(strProxy))
+ if (!MyCommon.IsNullOrEmpty(strProxy))
{
ipi = new InternetProxyInfo
{
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;
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;
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;
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ではありません");
}
private string Encrypt(string password)
{
- if (string.IsNullOrEmpty(password)) password = "";
+ if (MyCommon.IsNullOrEmpty(password)) password = "";
if (password.Length > 0)
{
try
}
private string Decrypt(string password)
{
- if (string.IsNullOrEmpty(password)) password = "";
+ if (MyCommon.IsNullOrEmpty(password)) password = "";
if (password.Length > 0)
{
try
[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();
}
}
private string Encrypt(string password)
{
- if (string.IsNullOrEmpty(password)) password = "";
+ if (MyCommon.IsNullOrEmpty(password)) password = "";
if (password.Length > 0)
{
try
}
private string Decrypt(string password)
{
- if (string.IsNullOrEmpty(password)) password = "";
+ if (MyCommon.IsNullOrEmpty(password)) password = "";
if (password.Length > 0)
{
try
get
{
var pwd = ProxyPassword;
- if (string.IsNullOrEmpty(pwd)) pwd = "";
+ if (MyCommon.IsNullOrEmpty(pwd)) pwd = "";
if (pwd.Length > 0)
{
try
set
{
var pwd = value;
- if (string.IsNullOrEmpty(pwd)) pwd = "";
+ if (MyCommon.IsNullOrEmpty(pwd)) pwd = "";
if (pwd.Length > 0)
{
try
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
{
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
.ConfigureAwait(false);
var thumbnailUrl = this.GetThumbnailUrl(content);
- if (string.IsNullOrEmpty(thumbnailUrl)) return null;
+ if (MyCommon.IsNullOrEmpty(thumbnailUrl)) return null;
return new ThumbnailInfo
{
get => this._ApiEndpoint;
set
{
- if (string.IsNullOrEmpty(value))
+ if (MyCommon.IsNullOrEmpty(value))
{
// リセット
this._ApiEndpoint = null;
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);
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;
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;
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;
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();
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);
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;
}
//サウンド再生
- if (!_initial && SettingManager.Common.PlaySound && !string.IsNullOrEmpty(soundFile))
+ if (!_initial && SettingManager.Common.PlaySound && !MyCommon.IsNullOrEmpty(soundFile))
{
try
{
if (ct.IsCancellationRequested)
return;
- if (!string.IsNullOrEmpty(errMsg) &&
+ if (!MyCommon.IsNullOrEmpty(errMsg) &&
!errMsg.StartsWith("OK:", StringComparison.Ordinal) &&
!errMsg.StartsWith("Warn:", StringComparison.Ordinal))
{
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 = "#[-]";
{
RepliedStatusOpenMenuItem.Enabled = true;
}
- if (!this.ExistCurrentPost || post == null || string.IsNullOrEmpty(post.RetweetedBy))
+ if (!this.ExistCurrentPost || post == null || MyCommon.IsNullOrEmpty(post.RetweetedBy))
{
MoveToRTHomeMenuItem.Enabled = false;
}
//同一検索条件のタブが既に存在すれば、そのタブアクティブにして終了
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;
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;
tn = this.CurrentTabName;
}
- if (string.IsNullOrEmpty(tn)) return;
+ if (MyCommon.IsNullOrEmpty(tn)) return;
var tabIndex = this._statuses.Tabs.IndexOf(tn);
if (tabIndex != -1)
var eHalf = "";
if (dialog.DialogResult == DialogResult.OK)
{
- if (!string.IsNullOrEmpty(dialog.inputText))
+ if (!MyCommon.IsNullOrEmpty(dialog.inputText))
{
if (selStart > 0)
{
this.StatusText.AccessibleDescription = string.Format(Properties.Resources.StatusText_AccessibleDescription, pLen);
- if (string.IsNullOrEmpty(StatusText.Text))
+ if (MyCommon.IsNullOrEmpty(StatusText.Text))
{
this.inReplyTo = null;
}
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 + " ";
// 推奨ステータスを使用する
footer += this.recommendedStatusFooter;
}
- else if (!string.IsNullOrEmpty(SettingManager.Local.StatusText))
+ else if (!MyCommon.IsNullOrEmpty(SettingManager.Local.StatusText))
{
// テキストボックスに入力されている文字列を使用する
footer += " " + SettingManager.Local.StatusText.Trim();
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) ||
newTabName = inputName.TabName;
}
this.TopMost = SettingManager.Common.AlwaysTop;
- if (!string.IsNullOrEmpty(newTabName))
+ if (!MyCommon.IsNullOrEmpty(newTabName))
{
//新タブ名存在チェック
if (this._statuses.ContainsTab(newTabName))
}
//タブのないところにドロップ->最後尾へ移動
- if (string.IsNullOrEmpty(tn))
+ if (MyCommon.IsNullOrEmpty(tn))
{
var lastTab = this._statuses.Tabs.Last();
tn = lastTab.TabName;
StatusText.Focus();
return;
}
- if (string.IsNullOrEmpty(StatusText.Text))
+ if (MyCommon.IsNullOrEmpty(StatusText.Text))
{
//空の場合
var inReplyToStatusId = post.RetweetedId ?? post.StatusId;
ids += "@" + screenName + " ";
}
}
- if (!string.IsNullOrEmpty(post.RetweetedBy))
+ if (!MyCommon.IsNullOrEmpty(post.RetweetedBy))
{
if (!ids.Contains("@" + post.RetweetedBy + " ") && post.RetweetedByUserId != tw.UserId)
{
}
}
if (ids.Length == 0) return;
- if (string.IsNullOrEmpty(StatusText.Text))
+ if (MyCommon.IsNullOrEmpty(StatusText.Text))
{
//未入力の場合のみ返信先付加
var inReplyToStatusId = post.RetweetedId ?? post.StatusId;
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;
this.DeleteTabMenuItem.Enabled = !checkState;
this.DeleteTbMenuItem.Enabled = !checkState;
- if (string.IsNullOrEmpty(_rclickTabName)) return;
+ if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
_statuses.Tabs[_rclickTabName].Protected = checkState;
SaveConfigsTabs();
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();
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;
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;
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);
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())
{
tabUsage = inputName.Usage;
}
this.TopMost = SettingManager.Common.AlwaysTop;
- if (!string.IsNullOrEmpty(tabName))
+ if (!MyCommon.IsNullOrEmpty(tabName))
{
//List対応
ListElement? list = null;
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))
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));
private void ClearTabMenuItem_Click(object sender, EventArgs e)
{
- if (string.IsNullOrEmpty(_rclickTabName)) return;
+ if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
ClearTab(_rclickTabName, true);
}
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_]+)");
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;
return true;
}
- if (!string.IsNullOrEmpty(result))
+ if (!MyCommon.IsNullOrEmpty(result))
{
var undotmp = new urlUndo();
continue;
}
- if (!string.IsNullOrEmpty(result))
+ if (!MyCommon.IsNullOrEmpty(result))
{
// 短縮 URL が生成されるまでの間に投稿欄から元の URL が削除されていたら中断する
var origUrlIndex = this.StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal);
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)
{
private void TabRenameMenuItem_Click(object sender, EventArgs e)
{
- if (string.IsNullOrEmpty(_rclickTabName)) return;
+ if (MyCommon.IsNullOrEmpty(_rclickTabName)) return;
_ = TabRename(_rclickTabName, out _);
}
tb.SearchWords = cmb.Text;
tb.SearchLang = cmbLang.Text;
- if (string.IsNullOrEmpty(cmb.Text))
+ if (MyCommon.IsNullOrEmpty(cmb.Text))
{
listView.Focus();
SaveConfigsTabs();
}
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;
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;
{
OpenRepSourceOpMenuItem.Enabled = true;
}
- if (!this.ExistCurrentPost || post == null || string.IsNullOrEmpty(post.RetweetedBy))
+ if (!this.ExistCurrentPost || post == null || MyCommon.IsNullOrEmpty(post.RetweetedBy))
{
OpenRterHomeMenuItem.Enabled = false;
}
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 = " ";
//サウンド再生
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))
{
{
tw.TrackWord = inputTrack;
this.MarkSettingCommonModified();
- TrackToolStripMenuItem.Checked = !string.IsNullOrEmpty(inputTrack);
+ TrackToolStripMenuItem.Checked = !MyCommon.IsNullOrEmpty(inputTrack);
tw.ReconnectUserStream();
}
}
inputName.TabName = id;
if (inputName.ShowDialog() == DialogResult.OK &&
- !string.IsNullOrEmpty(inputName.TabName.Trim()))
+ !MyCommon.IsNullOrEmpty(inputName.TabName.Trim()))
{
id = inputName.TabName.Trim();
}
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);
}
private void tweetDetailsView_StatusChanged(object sender, TweetDetailsViewStatusChengedEventArgs e)
{
- if (!string.IsNullOrEmpty(e.StatusText))
+ if (!MyCommon.IsNullOrEmpty(e.StatusText))
{
this.StatusLabelUrl.Text = e.StatusText;
}
private async Task SetUserPictureAsync(string imageUrl, bool force = false)
{
- if (string.IsNullOrEmpty(imageUrl))
+ if (MyCommon.IsNullOrEmpty(imageUrl))
return;
if (this.IconCache == null)
private async Task DoTranslation(string str)
{
- if (string.IsNullOrEmpty(str))
+ if (MyCommon.IsNullOrEmpty(str))
return;
var bing = new Bing();
{
this.RaiseStatusChanged(this.PostBrowser.StatusText.Replace("&", "&&"));
}
- if (string.IsNullOrEmpty(PostBrowser.StatusText))
+ if (MyCommon.IsNullOrEmpty(PostBrowser.StatusText))
{
this.RaiseStatusChanged(statusText: "");
}
if (this.CurrentPost != null)
{
var name = this.CurrentPost.ImageUrl;
- if (!string.IsNullOrEmpty(name))
+ if (!MyCommon.IsNullOrEmpty(name))
{
var idx = name.LastIndexOf('/');
if (idx != -1)
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
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);
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);
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);
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) + "\" />";
loadTasks.Add(loadTask);
var tooltipText = thumb.TooltipText;
- if (!string.IsNullOrEmpty(tooltipText))
+ if (!MyCommon.IsNullOrEmpty(tooltipText))
{
this.toolTip.SetToolTip(picbox, tooltipText);
picbox.AccessibleDescription = tooltipText;
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;
}
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);
{
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);
}
}
}
}
}
- if (!string.IsNullOrEmpty(entity.DisplayUrl))
+ if (!MyCommon.IsNullOrEmpty(entity.DisplayUrl))
text = text.Replace(entity.Url, entity.DisplayUrl);
}
}
{
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);
}
/// </summary>
internal static (string SourceText, Uri? SourceUri) ParseSource(string? sourceHtml)
{
- if (string.IsNullOrEmpty(sourceHtml))
+ if (MyCommon.IsNullOrEmpty(sourceHtml))
return ("", null);
string sourceText;