private string FormatStatusText(string statusText)
{
statusText = statusText.Replace("\r\n", "\n");
if (this.ToolStripMenuItemUrlMultibyteSplit.Checked)
{
// URLと全角文字の切り離し
statusText = Regex.Replace(statusText, @"https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#^]+", "$& ");
}
if (this.IdeographicSpaceToSpaceToolStripMenuItem.Checked)
{
// 文中の全角スペースを半角スペース1個にする
statusText = statusText.Replace(" ", " ");
}
// DM の場合はこれ以降の処理を行わない
if (statusText.StartsWith("D ", StringComparison.OrdinalIgnoreCase))
return statusText;
bool disableFooter;
if (this._cfgCommon.PostShiftEnter)
{
disableFooter = MyCommon.IsKeyDown(Keys.Control);
}
else
{
if (this.StatusText.Multiline && !this._cfgCommon.PostCtrlEnter)
disableFooter = MyCommon.IsKeyDown(Keys.Control);
else
disableFooter = MyCommon.IsKeyDown(Keys.Shift);
}
if (statusText.Contains("RT @"))
disableFooter = true;
var header = "";
var footer = "";
var hashtag = this.HashMgr.UseHash;
if (!string.IsNullOrEmpty(hashtag) && !(this.HashMgr.IsNotAddToAtReply && this.inReplyTo != null))
{
if (HashMgr.IsHead)
header = HashMgr.UseHash + " ";
else
footer = " " + HashMgr.UseHash;
}
if (!disableFooter)
{
if (this._cfgLocal.UseRecommendStatus)
{
// 推奨ステータスを使用する
footer += this.recommendedStatusFooter;
}
else if (!string.IsNullOrEmpty(this._cfgLocal.StatusText))
{
// テキストボックスに入力されている文字列を使用する
footer += " " + this._cfgLocal.StatusText.Trim();
}
}
statusText = header + statusText + footer;
if (this.ToolStripMenuItemPreventSmsCommand.Checked)
{
// ツイートが意図せず SMS コマンドとして解釈されることを回避 (D, DM, M のみ)
// 参照: https://support.twitter.com/articles/14020
if (Regex.IsMatch(statusText, @"^[+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]*(d|dm|m)([+\-\[\]\s\\.,*/(){}^~|='&%$#""<>?]+|$)", RegexOptions.IgnoreCase)
&& !Twitter.DMSendTextRegex.IsMatch(statusText))
{
// U+200B (ZERO WIDTH SPACE) を先頭に加えて回避
statusText = '\u200b' + statusText;
}
}
return statusText;
}