prepare for new profilematch version, clean up, fix bugs
This commit is contained in:
@@ -12,8 +12,10 @@ Public Class ClassProfileFilter
|
|||||||
Public ProcessName As String
|
Public ProcessName As String
|
||||||
Public Name As String
|
Public Name As String
|
||||||
Public Comment As String
|
Public Comment As String
|
||||||
Public CountSQL As String
|
Public SQLCountDocs As String
|
||||||
Public Count As Integer = 0
|
Public SQLCountData As String
|
||||||
|
Public CountDocs As Integer = 0
|
||||||
|
Public CountData As Integer = 0
|
||||||
Public Windows As List(Of WindowData)
|
Public Windows As List(Of WindowData)
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
@@ -157,7 +159,8 @@ Public Class ClassProfileFilter
|
|||||||
.Regex = oRow.Item("REGEX_EXPRESSION"),
|
.Regex = oRow.Item("REGEX_EXPRESSION"),
|
||||||
.Name = oRow.Item("NAME"),
|
.Name = oRow.Item("NAME"),
|
||||||
.Comment = oRow.Item("COMMENT"),
|
.Comment = oRow.Item("COMMENT"),
|
||||||
.CountSQL = oRow.Item("SQL_COUNT_RESULT"),
|
.SQLCountDocs = oRow.Item("SQL_COUNT_DOCS"),
|
||||||
|
.SQLCountData = oRow.Item("SQL_COUNT_DATA"),
|
||||||
.Windows = oWindowList
|
.Windows = oWindowList
|
||||||
})
|
})
|
||||||
Next
|
Next
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ Public Class frmProfileMatch
|
|||||||
oCountElement.TextAlignment = TileItemContentAlignment.BottomRight
|
oCountElement.TextAlignment = TileItemContentAlignment.BottomRight
|
||||||
oCountElement.Appearance.Normal.Font = SecondaryFont
|
oCountElement.Appearance.Normal.Font = SecondaryFont
|
||||||
Dim oText As String
|
Dim oText As String
|
||||||
If oProfile.Count = 99999 Then
|
If oProfile.CountDocs = 99999 Then
|
||||||
oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
|
oText = "DocCount 0 = Check Your MatchCountConfig in Profiles!"
|
||||||
ElseIf oProfile.Count = 99998 Then
|
ElseIf oProfile.CountDocs = 99998 Then
|
||||||
oText = "DocCount (MatchCountConfig has not been configured)"
|
oText = "DocCount (MatchCountConfig has not been configured)"
|
||||||
Else
|
Else
|
||||||
oText = $"{oProfile.Count} files!"
|
oText = $"{oProfile.CountDocs} files!"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oCountElement.Text = oText
|
oCountElement.Text = oText
|
||||||
@@ -76,13 +76,9 @@ Public Class frmProfileMatch
|
|||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
Logger.Info("Error in Save FormLayout: " & ex.Message)
|
Logger.Info("Error in Save FormLayout: " & ex.Message)
|
||||||
End Try
|
End Try
|
||||||
CURR_MATCH_RESULT = Nothing
|
|
||||||
CLIPBOARD_TEXT = ""
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
|
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
|
||||||
CURR_MATCH_RESULT = Nothing
|
|
||||||
CLIPBOARD_TEXT = ""
|
|
||||||
Close()
|
Close()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -88,9 +88,6 @@ Public Class frmResultDoc
|
|||||||
_frmProfileMatch?.Show()
|
_frmProfileMatch?.Show()
|
||||||
_frmProfileMatch?.BringToFront()
|
_frmProfileMatch?.BringToFront()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
CURR_MATCH_RESULT = Nothing
|
|
||||||
CLIPBOARD_TEXT = ""
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Async Function LoadSearchesAsync() As Task(Of List(Of DocSearch))
|
Private Async Function LoadSearchesAsync() As Task(Of List(Of DocSearch))
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
Imports System.ComponentModel
|
Imports System.Threading
|
||||||
Imports System.Threading
|
|
||||||
Imports System.Text.RegularExpressions
|
|
||||||
Imports DD_LIB_Standards
|
Imports DD_LIB_Standards
|
||||||
|
|
||||||
Public Class frmStart
|
Public Class frmStart
|
||||||
@@ -39,137 +37,137 @@ Public Class frmStart
|
|||||||
CURR_MATCH_RESULT = ClipboardContents
|
CURR_MATCH_RESULT = ClipboardContents
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub _Watcher_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Handles _Watcher.Changed
|
'Private Sub _Watcher_Changed(ByVal sender As Object, ByVal e As EventArgs) ' Handles _Watcher.Changed
|
||||||
|
|
||||||
clsHotkey.GetCaption()
|
' clsHotkey.GetCaption()
|
||||||
|
|
||||||
If DT_USER_PROFILES Is Nothing Then
|
' If DT_USER_PROFILES Is Nothing Then
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
' End If
|
||||||
If DT_USER_PROFILES.Rows.Count = 0 Then
|
' If DT_USER_PROFILES.Rows.Count = 0 Then
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
' End If
|
||||||
CURR_MATCH_RESULT = Nothing
|
' CURR_MATCH_RESULT = Nothing
|
||||||
'CURR_MATCH_WM_SEARCH = Nothing
|
' 'CURR_MATCH_WM_SEARCH = Nothing
|
||||||
If MONITORING_ACTIVE = False Then
|
' If MONITORING_ACTIVE = False Then
|
||||||
NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Clipboard-watcher is inactive.", ToolTipIcon.Info)
|
' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Clipboard-watcher is inactive.", ToolTipIcon.Info)
|
||||||
Exit Sub
|
' Exit Sub
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
Dim Data As IDataObject = Clipboard.GetDataObject
|
' Dim Data As IDataObject = Clipboard.GetDataObject
|
||||||
|
|
||||||
' Dim RelevantWindow = clsWINDOWSApi.IsRelevantWindow("jonathan")
|
' ' Dim RelevantWindow = clsWINDOWSApi.IsRelevantWindow("jonathan")
|
||||||
'With Me.TextBox1
|
' 'With Me.TextBox1
|
||||||
' .AppendText(String.Concat("Available Formats:", vbNewLine))
|
' ' .AppendText(String.Concat("Available Formats:", vbNewLine))
|
||||||
' .AppendText(String.Join(vbNewLine, Data.GetFormats))
|
' ' .AppendText(String.Join(vbNewLine, Data.GetFormats))
|
||||||
' .AppendText(String.Concat(vbNewLine, vbNewLine, "Text = '", _
|
' ' .AppendText(String.Concat(vbNewLine, vbNewLine, "Text = '", _
|
||||||
' Clipboard.GetText, "'", vbNewLine, vbNewLine))
|
' ' Clipboard.GetText, "'", vbNewLine, vbNewLine))
|
||||||
'End With
|
' 'End With
|
||||||
Dim oFound As Boolean = False
|
' Dim oFound As Boolean = False
|
||||||
CLIPBOARD_TEXT = Clipboard.GetText
|
' CLIPBOARD_TEXT = Clipboard.GetText
|
||||||
Logger.Debug(String.Format(" >>[{0}] Clipboard-Watcher fired for process '{1}'", Now.ToString, CurrPROC_Name), False)
|
' Logger.Debug(String.Format(" >>[{0}] Clipboard-Watcher fired for process '{1}'", Now.ToString, CurrPROC_Name), False)
|
||||||
Dim oDTMatchProfiles As DataTable = New DataTable
|
' Dim oDTMatchProfiles As DataTable = New DataTable
|
||||||
oDTMatchProfiles.Columns.Add("GUID")
|
' oDTMatchProfiles.Columns.Add("GUID")
|
||||||
oDTMatchProfiles.Columns.Add("NAME")
|
' oDTMatchProfiles.Columns.Add("NAME")
|
||||||
oDTMatchProfiles.Columns.Add("COUNT")
|
' oDTMatchProfiles.Columns.Add("COUNT")
|
||||||
oDTMatchProfiles.Columns.Add("COMMENT")
|
' oDTMatchProfiles.Columns.Add("COMMENT")
|
||||||
|
|
||||||
For Each oProfileRow As DataRow In DT_USER_PROFILES.Rows
|
' For Each oProfileRow As DataRow In DT_USER_PROFILES.Rows
|
||||||
Dim oProfileID = oProfileRow.Item("GUID")
|
' Dim oProfileID = oProfileRow.Item("GUID")
|
||||||
'If found = True Then Exit For
|
' 'If found = True Then Exit For
|
||||||
'#### 1st CHECK: PROCESSNAME EQUAL ####
|
' '#### 1st CHECK: PROCESSNAME EQUAL ####
|
||||||
If CurrPROC_Name.ToUpper = oProfileRow.Item("PROC_NAME").ToString.ToUpper Then
|
' If CurrPROC_Name.ToUpper = oProfileRow.Item("PROC_NAME").ToString.ToUpper Then
|
||||||
'### 2nd CHECK: MATCH ClipboardValue
|
' '### 2nd CHECK: MATCH ClipboardValue
|
||||||
Dim oRegex_expression = oProfileRow.Item("REGEX_EXPRESSION")
|
' Dim oRegex_expression = oProfileRow.Item("REGEX_EXPRESSION")
|
||||||
Dim oRegex As New System.Text.RegularExpressions.Regex(oRegex_expression)
|
' Dim oRegex As New System.Text.RegularExpressions.Regex(oRegex_expression)
|
||||||
Dim oMatch As System.Text.RegularExpressions.Match = oRegex.Match(CLIPBOARD_TEXT)
|
' Dim oMatch As System.Text.RegularExpressions.Match = oRegex.Match(CLIPBOARD_TEXT)
|
||||||
If oMatch.Success Then
|
' If oMatch.Success Then
|
||||||
' If match.Groups(0).Value <> CURR_MATCH_RESULT Then
|
' ' If match.Groups(0).Value <> CURR_MATCH_RESULT Then
|
||||||
CURR_MATCH_RESULT = oMatch.Groups(0).Value
|
' CURR_MATCH_RESULT = oMatch.Groups(0).Value
|
||||||
If Not IsNothing(CURR_MATCH_RESULT) Then
|
' If Not IsNothing(CURR_MATCH_RESULT) Then
|
||||||
'#### 3rd CHECK: WindowTitle Match
|
' '#### 3rd CHECK: WindowTitle Match
|
||||||
Dim oMatchWindow As Boolean = True
|
' Dim oMatchWindow As Boolean = True
|
||||||
Dim oCountWindowDefinitions As Integer = 0
|
' Dim oCountWindowDefinitions As Integer = 0
|
||||||
For Each oWindowMatchRow As DataRow In DTPROFILE_REL_WINDOW.Rows
|
' For Each oWindowMatchRow As DataRow In DTPROFILE_REL_WINDOW.Rows
|
||||||
If oWindowMatchRow.Item("PROFILE_ID") = oProfileID Then
|
' If oWindowMatchRow.Item("PROFILE_ID") = oProfileID Then
|
||||||
oCountWindowDefinitions += 1
|
' oCountWindowDefinitions += 1
|
||||||
oRegex_expression = oWindowMatchRow.Item("REGEX")
|
' oRegex_expression = oWindowMatchRow.Item("REGEX")
|
||||||
oRegex = New System.Text.RegularExpressions.Regex(oRegex_expression)
|
' oRegex = New System.Text.RegularExpressions.Regex(oRegex_expression)
|
||||||
oMatch = oRegex.Match(CURR_FOCUSED_WINDOWNAME)
|
' oMatch = oRegex.Match(CURR_FOCUSED_WINDOWNAME)
|
||||||
oMatchWindow = oMatch.Success
|
' oMatchWindow = oMatch.Success
|
||||||
If oMatchWindow = True Then
|
' If oMatchWindow = True Then
|
||||||
Dim oMatchRegexWindowClipboard As Boolean = False
|
' Dim oMatchRegexWindowClipboard As Boolean = False
|
||||||
Logger.Debug($"Found a match on windowtitle [{CURR_FOCUSED_WINDOWNAME}]")
|
' Logger.Debug($"Found a match on windowtitle [{CURR_FOCUSED_WINDOWNAME}]")
|
||||||
If oWindowMatchRow.Item("REGEX_CLIPBOARD") <> String.Empty Then
|
' If oWindowMatchRow.Item("REGEX_CLIPBOARD") <> String.Empty Then
|
||||||
oRegex_expression = oWindowMatchRow.Item("REGEX_CLIPBOARD")
|
' oRegex_expression = oWindowMatchRow.Item("REGEX_CLIPBOARD")
|
||||||
oRegex = New System.Text.RegularExpressions.Regex(oRegex_expression)
|
' oRegex = New System.Text.RegularExpressions.Regex(oRegex_expression)
|
||||||
oMatch = oRegex.Match(CLIPBOARD_TEXT)
|
' oMatch = oRegex.Match(CLIPBOARD_TEXT)
|
||||||
oMatchRegexWindowClipboard = oMatch.Success
|
' oMatchRegexWindowClipboard = oMatch.Success
|
||||||
If oMatchRegexWindowClipboard = True Then
|
' If oMatchRegexWindowClipboard = True Then
|
||||||
Logger.Debug($"Found a match on oMatchRegexWindowClipboard [{oRegex_expression}]")
|
' Logger.Debug($"Found a match on oMatchRegexWindowClipboard [{oRegex_expression}]")
|
||||||
Exit For
|
' Exit For
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If oMatchWindow = False Then
|
' If oMatchWindow = False Then
|
||||||
Logger.Debug($"Found NO MATCH on windowtitle [{CURR_FOCUSED_WINDOWNAME}], but [{oCountWindowDefinitions}] definitions are configured")
|
' Logger.Debug($"Found NO MATCH on windowtitle [{CURR_FOCUSED_WINDOWNAME}], but [{oCountWindowDefinitions}] definitions are configured")
|
||||||
Exit For
|
' Exit For
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
' ================= MOVE TO CTRL + F =================
|
' ' ================= MOVE TO CTRL + F =================
|
||||||
|
|
||||||
'CURR_MATCH_WM_SEARCH = oProfileRow.Item("WD_SEARCH")
|
' 'CURR_MATCH_WM_SEARCH = oProfileRow.Item("WD_SEARCH")
|
||||||
Dim oSQL_COUNT As String = oProfileRow.Item("SQL_COUNT_RESULT")
|
' Dim oSQL_COUNT As String = oProfileRow.Item("SQL_COUNT_DOCS")
|
||||||
Dim oRESULTDocs As Integer
|
' Dim oRESULTDocs As Integer
|
||||||
If oSQL_COUNT <> String.Empty Then
|
' If oSQL_COUNT <> String.Empty Then
|
||||||
oSQL_COUNT = clsPatterns.ReplaceAllValues(oSQL_COUNT, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID)
|
' oSQL_COUNT = clsPatterns.ReplaceAllValues(oSQL_COUNT, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileID)
|
||||||
Try
|
' Try
|
||||||
oRESULTDocs = ClassDatabase.Execute_Scalar(oSQL_COUNT, MyConnectionString)
|
' oRESULTDocs = ClassDatabase.Execute_Scalar(oSQL_COUNT, MyConnectionString)
|
||||||
Catch ex As Exception
|
' Catch ex As Exception
|
||||||
oRESULTDocs = 99999
|
' oRESULTDocs = 99999
|
||||||
End Try
|
' End Try
|
||||||
Else
|
' Else
|
||||||
oRESULTDocs = 99998
|
' oRESULTDocs = 99998
|
||||||
End If
|
' End If
|
||||||
If (oRESULTDocs <> 99998 And oRESULTDocs <> 99998 And oRESULTDocs <> 0) Then
|
' If (oRESULTDocs <> 99998 And oRESULTDocs <> 99998 And oRESULTDocs <> 0) Then
|
||||||
Dim onewMatchRow As DataRow = oDTMatchProfiles.NewRow
|
' Dim onewMatchRow As DataRow = oDTMatchProfiles.NewRow
|
||||||
onewMatchRow("GUID") = oProfileID
|
' onewMatchRow("GUID") = oProfileID
|
||||||
onewMatchRow("NAME") = oProfileRow.Item("NAME")
|
' onewMatchRow("NAME") = oProfileRow.Item("NAME")
|
||||||
onewMatchRow("COMMENT") = oProfileRow.Item("COMMENT")
|
' onewMatchRow("COMMENT") = oProfileRow.Item("COMMENT")
|
||||||
onewMatchRow("COUNT") = oRESULTDocs
|
' onewMatchRow("COUNT") = oRESULTDocs
|
||||||
oDTMatchProfiles.Rows.Add(onewMatchRow)
|
' oDTMatchProfiles.Rows.Add(onewMatchRow)
|
||||||
oFound = True
|
' oFound = True
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
' ================= MOVE TO CTRL + F =================
|
' ' ================= MOVE TO CTRL + F =================
|
||||||
|
|
||||||
|
|
||||||
End If
|
' End If
|
||||||
'Else
|
' 'Else
|
||||||
' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", String.Format("Clipboard Watcher fired but Clipboardcontent is equal: '{0}'", CURR_MATCH_RESULT), ToolTipIcon.Info)
|
' ' NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", String.Format("Clipboard Watcher fired but Clipboardcontent is equal: '{0}'", CURR_MATCH_RESULT), ToolTipIcon.Info)
|
||||||
' Logger.Debug(String.Format(" >> {0} - Equal Clipboard-result '{1}'", Now.ToString, CURR_MATCH_RESULT), False)
|
' ' Logger.Debug(String.Format(" >> {0} - Equal Clipboard-result '{1}'", Now.ToString, CURR_MATCH_RESULT), False)
|
||||||
' Exit For
|
' ' Exit For
|
||||||
'End If
|
' 'End If
|
||||||
Else
|
' Else
|
||||||
'Logger.Debug(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, oMatch.Groups(0).Value), False)
|
' 'Logger.Debug(String.Format(" >> {0} - No regex-match for cliboardtext '{1}'", Now.ToString, oMatch.Groups(0).Value), False)
|
||||||
End If
|
' End If
|
||||||
End If
|
' End If
|
||||||
Next
|
' Next
|
||||||
If oFound = False Then
|
' If oFound = False Then
|
||||||
Logger.Debug(String.Format(" >> {0} - oFound is false - no match on Clipboardvalue '{1}'!", Now.ToString, CURR_MATCH_RESULT), False)
|
' Logger.Debug(String.Format(" >> {0} - oFound is false - no match on Clipboardvalue '{1}'!", Now.ToString, CURR_MATCH_RESULT), False)
|
||||||
CurrDT_PROFILE_MATCH = Nothing
|
' CurrDT_PROFILE_MATCH = Nothing
|
||||||
Else
|
' Else
|
||||||
CurrDT_PROFILE_MATCH = oDTMatchProfiles
|
' CurrDT_PROFILE_MATCH = oDTMatchProfiles
|
||||||
|
|
||||||
End If
|
' End If
|
||||||
|
|
||||||
End Sub
|
'End Sub
|
||||||
|
|
||||||
Public Sub New()
|
Public Sub New()
|
||||||
Dim splash As New frmSplash()
|
Dim splash As New frmSplash()
|
||||||
@@ -280,11 +278,11 @@ Public Class frmStart
|
|||||||
Dim oProfiles = CURRENT_MATCHING_PROFILES
|
Dim oProfiles = CURRENT_MATCHING_PROFILES
|
||||||
|
|
||||||
For Each oProfile In oProfiles
|
For Each oProfile In oProfiles
|
||||||
Dim oSQL = oProfile.CountSQL
|
Dim oSQL = oProfile.SQLCountDocs
|
||||||
Dim oResultDocs As Integer = 0
|
Dim oResultDocs As Integer = 0
|
||||||
|
|
||||||
If oSQL = String.Empty Then
|
If oSQL = String.Empty Then
|
||||||
oProfile.CountSQL = ClassConstants.NO_COUNT_SQL
|
oProfile.SQLCountDocs = ClassConstants.NO_COUNT_SQL
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Try
|
Try
|
||||||
@@ -294,16 +292,16 @@ Public Class frmStart
|
|||||||
oResultDocs = ClassConstants.INVALID_COUNT_SQL
|
oResultDocs = ClassConstants.INVALID_COUNT_SQL
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
oProfile.Count = oResultDocs
|
oProfile.CountDocs = oResultDocs
|
||||||
Next
|
Next
|
||||||
|
|
||||||
If oProfiles.Count = 1 Then
|
If oProfiles.Count = 1 Then
|
||||||
If oProfiles.First().Count = ClassConstants.INVALID_COUNT_SQL Then
|
If oProfiles.First().CountDocs = ClassConstants.INVALID_COUNT_SQL Then
|
||||||
NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Found match but check is wrong - Check Your MatchCountConfig in Profiles!", ToolTipIcon.Info)
|
NotifyIconMain.ShowBalloonTip(20000, "Clipboard Watcher", "Found match but check is wrong - Check Your MatchCountConfig in Profiles!", ToolTipIcon.Info)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If oProfiles.First().Count = ClassConstants.NO_COUNT_SQL Then
|
If oProfiles.First().CountDocs = ClassConstants.NO_COUNT_SQL Then
|
||||||
NotifyIconMain.ShowBalloonTip(10000, "Clipboard Watcher", "Found match but MatchCountConfig is not configured!", ToolTipIcon.Info)
|
NotifyIconMain.ShowBalloonTip(10000, "Clipboard Watcher", "Found match but MatchCountConfig is not configured!", ToolTipIcon.Info)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user