Imports Tween.TweenCustomControl
Imports System.Text.RegularExpressions
Imports System.Web.HttpUtility
+Imports System.Text
Public NotInheritable Class PostClass
Private _Nick As String
add = False
Else
favTab.Add(post.Id, post.IsRead, True)
- If Not favTab.SoundFile = "" AndAlso _soundFile = "" Then _soundFile = favTab.SoundFile
+ If Not String.IsNullOrEmpty(favTab.SoundFile) AndAlso String.IsNullOrEmpty(_soundFile) Then _soundFile = favTab.SoundFile
If favTab.Notify Then add = True
End If
End If
tb.UnreadManage = Manage
End Sub
- 'Public Sub RefreshOwl(ByVal follower As List(Of String))
- ' SyncLock LockObj
- ' If follower.Count > 1 Then
- ' For Each id As Long In _statuses.Keys
- ' _statuses(id).IsOwl = Not follower.Contains(_statuses(id).Name.ToLower())
- ' Next
- ' Else
- ' For Each id As Long In _statuses.Keys
- ' _statuses(id).IsOwl = False
- ' Next
- ' End If
- ' End SyncLock
- 'End Sub
-
Public Sub RefreshOwl(ByVal follower As List(Of Long))
SyncLock LockObj
If follower.Count > 0 Then
'フィルタに合致したら追加
Public Function AddFiltered(ByVal post As PostClass) As HITRESULT
- 'Try
- ' rwLock.AcquireReaderLock(System.Threading.Timeout.Infinite) '読み取りロック取得
If Me.TabType = TabUsageType.PublicSearch OrElse Me.TabType = TabUsageType.DirectMessage OrElse Me.TabType = TabUsageType.Lists Then Return HITRESULT.None
Dim rslt As HITRESULT = HITRESULT.None
If rslt <> HITRESULT.None AndAlso rslt <> HITRESULT.Exclude Then
_tmpIds.Add(New TemporaryId(post.Id, post.IsRead))
End If
- 'Me.Add(ID, Read)
Return rslt 'マーク付けは呼び出し元で行うこと
-
- 'Finally
- ' rwLock.ReleaseReaderLock()
- 'End Try
End Function
'検索結果の追加
Private _moveFrom As Boolean = False
Private _setMark As Boolean = True
- 'Public Sub New(ByVal NameFilter As String, _
- ' ByVal BodyFilter As List(Of String), _
- ' ByVal SearchBoth As Boolean, _
- ' ByVal SearchUrl As Boolean, _
- ' ByVal CaseSensitive As Boolean, _
- ' ByVal UseRegex As Boolean, _
- ' ByVal ParentTab As String, _
- ' ByVal ExNameFilter As String, _
- ' ByVal ExBodyFilter As List(Of String), _
- ' ByVal ExSearchBoth As Boolean, _
- ' ByVal ExSearchUrl As Boolean, _
- ' ByVal ExUseRegex As Boolean, _
- ' ByVal ExCaseSensitive As Boolean, _
- ' ByVal MoveFrom As Boolean, _
- ' ByVal SetMark As Boolean)
- ' _name = NameFilter
- ' _body = BodyFilter
- ' _searchBoth = SearchBoth
- ' _searchUrl = SearchUrl
- ' _caseSensitive = CaseSensitive
- ' _useRegex = UseRegex
- ' _exname = ExNameFilter
- ' _exbody = ExBodyFilter
- ' _exsearchBoth = ExSearchBoth
- ' _exsearchUrl = ExSearchUrl
- ' _exuseRegex = ExUseRegex
- ' _excaseSensitive = ExCaseSensitive
- ' _moveFrom = MoveFrom
- ' _setMark = SetMark
- ' '正規表現検証
- ' If _useRegex Then
- ' Try
- ' Dim rgx As New Regex(_name)
- ' Catch ex As Exception
- ' Throw New Exception(My.Resources.ButtonOK_ClickText3 + ex.Message)
- ' Exit Sub
- ' End Try
- ' For Each bs As String In _body
- ' Try
- ' Dim rgx As New Regex(bs)
- ' Catch ex As Exception
- ' Throw New Exception(My.Resources.ButtonOK_ClickText3 + ex.Message)
- ' Exit Sub
- ' End Try
- ' Next
- ' End If
- ' If _exuseRegex Then
- ' Try
- ' Dim rgx As New Regex(_exname)
- ' Catch ex As Exception
- ' Throw New Exception(My.Resources.ButtonOK_ClickText3 + ex.Message)
- ' Exit Sub
- ' End Try
- ' For Each bs As String In _exbody
- ' Try
- ' Dim rgx As New Regex(bs)
- ' Catch ex As Exception
- ' Throw New Exception(My.Resources.ButtonOK_ClickText3 + ex.Message)
- ' Exit Sub
- ' End Try
- ' Next
- ' End If
- 'End Sub
-
Public Sub New()
End Sub
'フィルタ一覧に表示する文言生成
Private Function MakeSummary() As String
- Dim fs As New System.Text.StringBuilder()
- If _name <> "" OrElse _body.Count > 0 OrElse _isRt OrElse _source <> "" Then
+ Dim fs As New StringBuilder()
+ If Not String.IsNullOrEmpty(_name) OrElse _body.Count > 0 OrElse _isRt OrElse Not String.IsNullOrEmpty(_source) Then
If _searchBoth Then
- If _name <> "" Then
+ If Not String.IsNullOrEmpty(_name) Then
fs.AppendFormat(My.Resources.SetFiltersText1, _name)
Else
fs.Append(My.Resources.SetFiltersText2)
If _isRt Then
fs.Append("RT/")
End If
- If _source <> "" Then
+ If Not String.IsNullOrEmpty(_source) Then
fs.AppendFormat("Src…{0}/", _source)
End If
- 'If _moveFrom Then
- ' fs.Append(My.Resources.SetFiltersText9)
- 'ElseIf _setMark Then
- ' fs.Append(My.Resources.SetFiltersText10)
- 'Else
- ' fs.Append(My.Resources.SetFiltersText11)
- 'End If
fs.Length -= 1
fs.Append(")")
End If
- If _exname <> "" OrElse _exbody.Count > 0 OrElse _isExRt OrElse _exSource <> "" Then
+ If Not String.IsNullOrEmpty(_exname) OrElse _exbody.Count > 0 OrElse _isExRt OrElse Not String.IsNullOrEmpty(_exSource) Then
'除外
fs.Append(My.Resources.SetFiltersText12)
If _exsearchBoth Then
- If _exname <> "" Then
+ If Not String.IsNullOrEmpty(_exname) Then
fs.AppendFormat(My.Resources.SetFiltersText1, _exname)
Else
fs.Append(My.Resources.SetFiltersText2)
If _isExRt Then
fs.Append("RT/")
End If
- If _exSource <> "" Then
+ If Not String.IsNullOrEmpty(_exSource) Then
fs.AppendFormat("Src…{0}/", _exSource)
End If
fs.Length -= 1
rgOpt = RegexOptions.IgnoreCase
End If
If _searchBoth Then
- If _name = "" OrElse
+ If String.IsNullOrEmpty(_name) OrElse
(Not _useRegex AndAlso
(post.Name.Equals(_name, compOpt) OrElse
post.RetweetedBy.Equals(_name, compOpt)
End If
Dim exFlag As Boolean = False
- 'If _name = "" AndAlso _body.Count = 0 Then
- ' exFlag = True
- ' 'bHit = False
- 'End If
- If _exname <> "" OrElse _exbody.Count > 0 Then
+ If Not String.IsNullOrEmpty(_exname) OrElse _exbody.Count > 0 Then
If _excaseSensitive Then
compOpt = StringComparison.Ordinal
rgOpt = RegexOptions.None
rgOpt = RegexOptions.IgnoreCase
End If
If _exsearchBoth Then
- If _exname = "" OrElse
+ If String.IsNullOrEmpty(_exname) OrElse
(Not _exuseRegex AndAlso
(post.Name.Equals(_exname, compOpt) OrElse
post.RetweetedBy.Equals(_exname, compOpt)
End If
End If
- If _name = "" AndAlso _body.Count = 0 AndAlso Not _isRt AndAlso _source = "" Then
+ If String.IsNullOrEmpty(_name) AndAlso _body.Count = 0 AndAlso Not _isRt AndAlso String.IsNullOrEmpty(_source) Then
bHit = False
End If
If bHit Then
If Not exFlag Then
- 'If _setMark Then Return HITRESULT.CopyAndMark
If _moveFrom Then
Return HITRESULT.Move
Else
End If
Return HITRESULT.Copy
End If
- 'Return HITRESULT.Copy
Else
Return HITRESULT.Exclude
End If
(Me.ExSource = other.ExSource)
End Function
- Public Overloads Function CopyTo(ByVal destination As FiltersClass) As FiltersClass
+ Public Function CopyTo(ByVal destination As FiltersClass) As FiltersClass
If Me.BodyFilter.Count > 0 Then
For Each flt As String In Me.BodyFilter
inputName.Dispose()
End Using
Me.TopMost = SettingDialog.AlwaysTop
- If newTabText <> "" Then
+ If Not String.IsNullOrEmpty(newTabText) Then
'新タブ名存在チェック
For i As Integer = 0 To ListTab.TabCount - 1
If ListTab.TabPages(i).Text = newTabText Then
Next
'タブのないところにドロップ->最後尾へ移動
- If tn = "" Then
+ If String.IsNullOrEmpty(tn) Then
tn = ListTab.TabPages(ListTab.TabPages.Count - 1).Text
bef = False
i = ListTab.TabPages.Count - 1
_reply_to_name = ""
Exit Sub
End If
- If StatusText.Text = "" Then
+ If String.IsNullOrEmpty(StatusText.Text) Then
'空の場合
' ステータステキストが入力されていない場合先頭に@ユーザー名を追加する
ids += "@" + nm + " "
End If
Next
- If post.RetweetedBy <> "" Then
+ If Not String.IsNullOrEmpty(post.RetweetedBy) Then
If Not ids.Contains("@" + post.RetweetedBy + " ") AndAlso _
Not post.RetweetedBy.Equals(tw.Username, StringComparison.CurrentCultureIgnoreCase) Then
ids += "@" + post.RetweetedBy + " "
End If
End If
If ids.Length = 0 Then Exit Sub
- If StatusText.Text = "" Then
+ If String.IsNullOrEmpty(StatusText.Text) Then
'未入力の場合のみ返信先付加
StatusText.Text = ids
StatusText.SelectionStart = ids.Length
Private Sub ContextMenuTabProperty_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ContextMenuTabProperty.Opening
'右クリックの場合はタブ名が設定済。アプリケーションキーの場合は現在のタブを対象とする
- If _rclickTabName = "" OrElse sender IsNot ContextMenuTabProperty Then
+ If String.IsNullOrEmpty(_rclickTabName) OrElse sender IsNot ContextMenuTabProperty Then
If ListTab IsNot Nothing AndAlso ListTab.SelectedTab IsNot Nothing Then
_rclickTabName = ListTab.SelectedTab.Text
Else
UreadManageMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
Me.UnreadMngTbMenuItem.Checked = UreadManageMenuItem.Checked
- If _rclickTabName = "" Then Exit Sub
+ If String.IsNullOrEmpty(_rclickTabName) Then Exit Sub
ChangeTabUnreadManage(_rclickTabName, UreadManageMenuItem.Checked)
SaveConfigsTabs()
NotifyDispMenuItem.Checked = DirectCast(sender, ToolStripMenuItem).Checked
Me.NotifyTbMenuItem.Checked = NotifyDispMenuItem.Checked
- If _rclickTabName = "" Then Exit Sub
+ If String.IsNullOrEmpty(_rclickTabName) Then Exit Sub
_statuses.Tabs(_rclickTabName).Notify = NotifyDispMenuItem.Checked
End Sub
Private Sub DeleteTabMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DeleteTabMenuItem.Click, DeleteTbMenuItem.Click
- If _rclickTabName = "" OrElse sender Is Me.DeleteTbMenuItem Then _rclickTabName = ListTab.SelectedTab.Text
+ If String.IsNullOrEmpty(_rclickTabName) OrElse sender Is Me.DeleteTbMenuItem Then _rclickTabName = ListTab.SelectedTab.Text
RemoveSpecifiedTab(_rclickTabName)
SaveConfigsTabs()
Private Sub FilterEditMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FilterEditMenuItem.Click, EditRuleTbMenuItem.Click
- If _rclickTabName = "" Then _rclickTabName = _statuses.GetTabByType(TabUsageType.Home).TabName
+ If String.IsNullOrEmpty(_rclickTabName) Then _rclickTabName = _statuses.GetTabByType(TabUsageType.Home).TabName
fDialog.SetCurrent(_rclickTabName)
fDialog.ShowDialog()
Me.TopMost = SettingDialog.AlwaysTop
inputName.Dispose()
End Using
Me.TopMost = SettingDialog.AlwaysTop
- If tabName <> "" Then
+ If Not String.IsNullOrEmpty(tabName) Then
'List対応
Dim list As ListElement = Nothing
If tabUsage = TabUsageType.Lists Then
inputName.Dispose()
End Using
Me.TopMost = SettingDialog.AlwaysTop
- If tabName <> "" Then
+ If Not String.IsNullOrEmpty(tabName) Then
If Not AddNewTab(tabName, False, TabUsageType.UserDefined) Then
Dim tmp As String = String.Format(My.Resources.IDRuleMenuItem_ClickText2, tabName)
MessageBox.Show(tmp, My.Resources.IDRuleMenuItem_ClickText3, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End If
Next
- If HashMgr.UseHash <> "" AndAlso Not hstr.Contains(HashMgr.UseHash + " ") Then
+ If Not String.IsNullOrEmpty(HashMgr.UseHash) AndAlso Not hstr.Contains(HashMgr.UseHash + " ") Then
hstr += HashMgr.UseHash
End If
- If hstr <> "" Then HashMgr.AddHashToHistory(hstr.Trim, False)
+ If Not String.IsNullOrEmpty(hstr) Then HashMgr.AddHashToHistory(hstr.Trim, False)
' 本当にリプライ先指定すべきかどうかの判定
m = Regex.Matches(StatusText, "(^|[ -/:-@[-^`{-~])(?<id>@[a-zA-Z0-9_]+)")
If _reply_to_id = 0 Then Exit Sub
' リプライ先ユーザー名がない場合も指定しない
- If _reply_to_name = "" Then
+ If String.IsNullOrEmpty(_reply_to_name) Then
_reply_to_id = 0
Exit Sub
End If
Return True
End If
- If Not result = "" Then
+ If Not String.IsNullOrEmpty(result) Then
Dim undotmp As New urlUndo
StatusText.Select(StatusText.Text.IndexOf(tmp, StringComparison.Ordinal), tmp.Length)
Continue For
End If
- If Not result = "" Then
+ If Not String.IsNullOrEmpty(result) Then
StatusText.Select(StatusText.Text.IndexOf(mt.Result("${url}"), StringComparison.Ordinal), mt.Result("${url}").Length)
StatusText.SelectedText = result
'undoバッファにセット
End Sub
Private Sub TabRenameMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabRenameMenuItem.Click, RenameTbMenuItem.Click
- If _rclickTabName = "" Then Exit Sub
+ If String.IsNullOrEmpty(_rclickTabName) Then Exit Sub
TabRename(_rclickTabName)
End Sub