add debugging to profilefilter & window class
This commit is contained in:
@@ -36,15 +36,22 @@ Public Class ProfileFilter
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, ProfileDatatable As DataTable, ProcessTable As DataTable, WindowDatatable As DataTable, ControlDatatable As DataTable, TreeView As TreeView)
|
||||
Try
|
||||
_ProfileMatch = New ProfileMatch(LogConfig)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
|
||||
_Logger.Debug("Initializing Profile Filter")
|
||||
_Logger.Debug("Initializing Profile Data")
|
||||
_ProfileTable = ProfileDatatable
|
||||
_ProcessTable = ProcessTable
|
||||
_WindowTable = WindowDatatable
|
||||
_ControlTable = ControlDatatable
|
||||
_Profiles = TransformProfiles()
|
||||
|
||||
_Logger.Debug("Initializing Profile Debugging")
|
||||
_TreeView = TreeView
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_ProfileMatch = New ProfileMatch(LogConfig)
|
||||
|
||||
_Logger.Debug("Transforming Profiles")
|
||||
_Profiles = TransformProfiles()
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw ex
|
||||
@@ -209,19 +216,19 @@ Public Class ProfileFilter
|
||||
|
||||
For Each oItem As KeyValuePair(Of String, Window.RectangleInfo) In oControlBounds
|
||||
Select Case oItem.Key
|
||||
Case "TOPLEFT"
|
||||
Case "TopLeft"
|
||||
If oControl.TopLeft.Top = oItem.Value.Top And oControl.TopLeft.Left = oItem.Value.Left Then
|
||||
oFound = True
|
||||
End If
|
||||
Case "TOPRIGHT"
|
||||
Case "TopRight"
|
||||
If oControl.TopRight.Top = oItem.Value.Top And oControl.TopLeft.Right = oItem.Value.Right Then
|
||||
oFound = True
|
||||
End If
|
||||
Case "BOTTOMLEFT"
|
||||
Case "BottomLeft"
|
||||
If oControl.BottomLeft.Bottom = oItem.Value.Bottom And oControl.TopLeft.Left = oItem.Value.Left Then
|
||||
oFound = True
|
||||
End If
|
||||
Case "BOTTOMRIGHT"
|
||||
Case "BottomRight"
|
||||
If oControl.BottomRight.Bottom = oItem.Value.Bottom And oControl.TopLeft.Right = oItem.Value.Right Then
|
||||
oFound = True
|
||||
End If
|
||||
@@ -385,106 +392,126 @@ Public Class ProfileFilter
|
||||
End Function
|
||||
|
||||
Private Function TransformProfiles() As List(Of ProfileData)
|
||||
Dim oList As New List(Of ProfileData)
|
||||
Try
|
||||
Dim oList As New List(Of ProfileData)
|
||||
|
||||
For Each oRow As DataRow In _ProfileTable.Rows
|
||||
Dim oProfileId = oRow.Item("GUID")
|
||||
Dim oProcessList As List(Of ProcessData) = TransformProcesses(oProfileId, _ProcessTable)
|
||||
Dim oWindowList As List(Of WindowData) = TransformWindows(oProfileId, _WindowTable)
|
||||
Dim oControlList As List(Of ControlData) = TransformControls(oProfileId, _ControlTable)
|
||||
For Each oRow As DataRow In _ProfileTable.Rows
|
||||
Dim oProfileId = oRow.Item("GUID")
|
||||
Dim oProcessList As List(Of ProcessData) = TransformProcesses(oProfileId, _ProcessTable)
|
||||
Dim oWindowList As List(Of WindowData) = TransformWindows(oProfileId, _WindowTable)
|
||||
Dim oControlList As List(Of ControlData) = TransformControls(oProfileId, _ControlTable)
|
||||
|
||||
oList.Add(New ProfileData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.Regex = oRow.Item("REGEX_EXPRESSION"),
|
||||
.Name = NotNull(oRow.Item("NAME"), String.Empty),
|
||||
.Comment = NotNull(oRow.Item("COMMENT"), String.Empty),
|
||||
.ProfileType = NotNull(oRow.Item("PROFILE_TYPE"), String.Empty),
|
||||
.Processes = oProcessList,
|
||||
.Windows = oWindowList,
|
||||
.Controls = oControlList
|
||||
})
|
||||
Next
|
||||
oList.Add(New ProfileData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.Regex = oRow.Item("REGEX_EXPRESSION"),
|
||||
.Name = NotNull(oRow.Item("NAME"), String.Empty),
|
||||
.Comment = NotNull(oRow.Item("COMMENT"), String.Empty),
|
||||
.ProfileType = NotNull(oRow.Item("PROFILE_TYPE"), String.Empty),
|
||||
.Processes = oProcessList,
|
||||
.Windows = oWindowList,
|
||||
.Controls = oControlList
|
||||
})
|
||||
Next
|
||||
|
||||
oList = oList.
|
||||
Distinct().
|
||||
ToList()
|
||||
oList = oList.
|
||||
Distinct().
|
||||
ToList()
|
||||
|
||||
Return oList
|
||||
Return oList
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function TransformControls(ProfileId As Integer, ControlDatatable As DataTable) As List(Of ControlData)
|
||||
Dim oControlList As New List(Of ControlData)
|
||||
Try
|
||||
Dim oControlList As New List(Of ControlData)
|
||||
|
||||
For Each oRow As DataRow In ControlDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oControlList.Add(New ControlData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.Description = NotNull(oRow.Item("DESCRIPTION"), String.Empty),
|
||||
.WindowId = oRow.Item("WINDOW_ID"),
|
||||
.TopLeft = New ControlBounds() With {
|
||||
.Left = oRow.Item("TOPLEFT_LEFT"),
|
||||
.Right = oRow.Item("TOPLEFT_RIGHT"),
|
||||
.Top = oRow.Item("TOPLEFT_TOP"),
|
||||
.Bottom = oRow.Item("TOPLEFT_BOTTOM")
|
||||
},
|
||||
.TopRight = New ControlBounds() With {
|
||||
.Left = oRow.Item("TOPRIGHT_LEFT"),
|
||||
.Right = oRow.Item("TOPRIGHT_RIGHT"),
|
||||
.Top = oRow.Item("TOPRIGHT_TOP"),
|
||||
.Bottom = oRow.Item("TOPRIGHT_BOTTOM")
|
||||
},
|
||||
.BottomLeft = New ControlBounds() With {
|
||||
.Left = oRow.Item("BOTTOMLEFT_LEFT"),
|
||||
.Right = oRow.Item("BOTTOMLEFT_RIGHT"),
|
||||
.Top = oRow.Item("BOTTOMLEFT_TOP"),
|
||||
.Bottom = oRow.Item("BOTTOMLEFT_BOTTOM")
|
||||
},
|
||||
.BottomRight = New ControlBounds() With {
|
||||
.Left = oRow.Item("BOTTOMRIGHT_LEFT"),
|
||||
.Right = oRow.Item("BOTTOMRIGHT_RIGHT"),
|
||||
.Top = oRow.Item("BOTTOMRIGHT_TOP"),
|
||||
.Bottom = oRow.Item("BOTTOMRIGHT_BOTTOM")
|
||||
}
|
||||
})
|
||||
End If
|
||||
Next
|
||||
For Each oRow As DataRow In ControlDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oControlList.Add(New ControlData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.Description = NotNull(oRow.Item("DESCRIPTION"), String.Empty),
|
||||
.WindowId = oRow.Item("WINDOW_ID"),
|
||||
.TopLeft = New ControlBounds() With {
|
||||
.Left = oRow.Item("TOPLEFT_LEFT"),
|
||||
.Right = oRow.Item("TOPLEFT_RIGHT"),
|
||||
.Top = oRow.Item("TOPLEFT_TOP"),
|
||||
.Bottom = oRow.Item("TOPLEFT_BOTTOM")
|
||||
},
|
||||
.TopRight = New ControlBounds() With {
|
||||
.Left = oRow.Item("TOPRIGHT_LEFT"),
|
||||
.Right = oRow.Item("TOPRIGHT_RIGHT"),
|
||||
.Top = oRow.Item("TOPRIGHT_TOP"),
|
||||
.Bottom = oRow.Item("TOPRIGHT_BOTTOM")
|
||||
},
|
||||
.BottomLeft = New ControlBounds() With {
|
||||
.Left = oRow.Item("BOTTOMLEFT_LEFT"),
|
||||
.Right = oRow.Item("BOTTOMLEFT_RIGHT"),
|
||||
.Top = oRow.Item("BOTTOMLEFT_TOP"),
|
||||
.Bottom = oRow.Item("BOTTOMLEFT_BOTTOM")
|
||||
},
|
||||
.BottomRight = New ControlBounds() With {
|
||||
.Left = oRow.Item("BOTTOMRIGHT_LEFT"),
|
||||
.Right = oRow.Item("BOTTOMRIGHT_RIGHT"),
|
||||
.Top = oRow.Item("BOTTOMRIGHT_TOP"),
|
||||
.Bottom = oRow.Item("BOTTOMRIGHT_BOTTOM")
|
||||
}
|
||||
})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oControlList
|
||||
Return oControlList
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Private Function TransformProcesses(ProfileId As Integer, ProcessDatatable As DataTable) As List(Of ProcessData)
|
||||
Dim oProcessList As New List(Of ProcessData)
|
||||
Try
|
||||
Dim oProcessList As New List(Of ProcessData)
|
||||
|
||||
For Each oRow As DataRow In ProcessDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oProcessList.Add(New ProcessData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.PROFILE_ID = oRow.Item("PROFILE_ID"),
|
||||
.ProcessName = NotNull(oRow.Item("PROC_NAME"), String.Empty)
|
||||
})
|
||||
End If
|
||||
Next
|
||||
For Each oRow As DataRow In ProcessDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oProcessList.Add(New ProcessData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.PROFILE_ID = oRow.Item("PROFILE_ID"),
|
||||
.ProcessName = NotNull(oRow.Item("PROC_NAME"), String.Empty)
|
||||
})
|
||||
End If
|
||||
Next
|
||||
|
||||
oProcessList = oProcessList.
|
||||
Distinct().
|
||||
ToList()
|
||||
oProcessList = oProcessList.
|
||||
Distinct().
|
||||
ToList()
|
||||
|
||||
Return oProcessList
|
||||
Return oProcessList
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
Private Function TransformWindows(ProfileId As Integer, WindowDatatable As DataTable) As List(Of WindowData)
|
||||
Dim oWindowList As New List(Of WindowData)
|
||||
Try
|
||||
Dim oWindowList As New List(Of WindowData)
|
||||
|
||||
For Each oRow As DataRow In WindowDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oWindowList.Add(New WindowData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.WindowProcessID = oRow.Item("PROCESS_ID"),
|
||||
.Title = NotNull(oRow.Item("DESCRIPTION"), String.Empty),
|
||||
.Regex = NotNull(oRow.Item("REGEX"), String.Empty),
|
||||
.Sequence = NotNull(oRow.Item("SEQUENCE"), 0)
|
||||
})
|
||||
End If
|
||||
Next
|
||||
For Each oRow As DataRow In WindowDatatable.Rows
|
||||
If oRow.Item("PROFILE_ID") = ProfileId Then
|
||||
oWindowList.Add(New WindowData() With {
|
||||
.Guid = oRow.Item("GUID"),
|
||||
.WindowProcessID = oRow.Item("PROCESS_ID"),
|
||||
.Title = NotNull(oRow.Item("DESCRIPTION"), String.Empty),
|
||||
.Regex = NotNull(oRow.Item("REGEX"), String.Empty),
|
||||
.Sequence = NotNull(oRow.Item("SEQUENCE"), 0)
|
||||
})
|
||||
End If
|
||||
Next
|
||||
|
||||
Return oWindowList
|
||||
Return oWindowList
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user