From 0f7e6415e8acf9d4d4fffefff6d3b77b9a1e242a Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 24 Sep 2019 12:55:58 +0200 Subject: [PATCH] prepare zooflow, add profilefilter --- .../ClipboardWatcher.vbproj | 52 +- .../My Project/Application.Designer.vb | 0 .../My Project/Application.myapp | 0 .../My Project/AssemblyInfo.vb | 2 +- .../My Project/Resources.Designer.vb | 2 +- .../My Project/Resources.resx | 0 .../My Project/Settings.Designer.vb | 4 +- .../My Project/Settings.settings | 0 .../My Project/licenses.licx | 0 ClipboardWatcher/ProfileFilter.vb | 455 ++++++++++++++++++ ClipboardWatcher/ProfileMatch.vb | 106 ++++ .../frmMatch.Designer.vb | 2 +- .../frmMatch.resx | 0 .../frmMatch.vb | 0 ClipboardWatcher/frmTreeView.Designer.vb | 49 ++ ClipboardWatcher/frmTreeView.resx | 120 +++++ ClipboardWatcher/frmTreeView.vb | 3 + .../packages.config | 0 DDMonorepo.sln | 16 +- GUIs.Test.ZUGFeRDTest/ZUGFeRDTest.vbproj | 2 +- GUIs.Test.ZUGFeRDTest/packages.config | 2 +- Message/Email.vb | 5 +- Modules/ZooFlow/Params/ProfileData.vb | 81 ++-- ZooFlow/ClassClipboardWatcher.vb | 1 - ZooFlow/Events/OnFlowFormStateChangedEvent.vb | 1 + ZooFlow/ZooFlow.vbproj | 9 +- ZooFlow/frmFlowForm.vb | 10 +- ZooFlow/frmMain.resx | 2 +- ZooFlow/frmMain.vb | 47 +- 29 files changed, 864 insertions(+), 107 deletions(-) rename {Products.ClipboardWatcher => ClipboardWatcher}/ClipboardWatcher.vbproj (78%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Application.Designer.vb (100%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Application.myapp (100%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/AssemblyInfo.vb (95%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Resources.Designer.vb (97%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Resources.resx (100%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Settings.Designer.vb (95%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/Settings.settings (100%) rename {Products.ClipboardWatcher => ClipboardWatcher}/My Project/licenses.licx (100%) create mode 100644 ClipboardWatcher/ProfileFilter.vb create mode 100644 ClipboardWatcher/ProfileMatch.vb rename {Products.ClipboardWatcher => ClipboardWatcher}/frmMatch.Designer.vb (98%) rename {Products.ClipboardWatcher => ClipboardWatcher}/frmMatch.resx (100%) rename {Products.ClipboardWatcher => ClipboardWatcher}/frmMatch.vb (100%) create mode 100644 ClipboardWatcher/frmTreeView.Designer.vb create mode 100644 ClipboardWatcher/frmTreeView.resx create mode 100644 ClipboardWatcher/frmTreeView.vb rename {Products.ClipboardWatcher => ClipboardWatcher}/packages.config (100%) diff --git a/Products.ClipboardWatcher/ClipboardWatcher.vbproj b/ClipboardWatcher/ClipboardWatcher.vbproj similarity index 78% rename from Products.ClipboardWatcher/ClipboardWatcher.vbproj rename to ClipboardWatcher/ClipboardWatcher.vbproj index a40ca953..e10d6e66 100644 --- a/Products.ClipboardWatcher/ClipboardWatcher.vbproj +++ b/ClipboardWatcher/ClipboardWatcher.vbproj @@ -4,10 +4,10 @@ Debug AnyCPU - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C} + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E} Library - DigitalData.Products.ClipboardWatcher - DigitalData.Products.ClipboardWatcher + DigitalData.Modules.ClipboardWatcher + DigitalData.Modules.ClipboardWatcher 512 Windows v4.6.1 @@ -18,7 +18,7 @@ true true bin\Debug\ - DigitalData.Products.ClipboardWatcher.xml + DigitalData.Modules.ClipboardWatcher.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 @@ -27,7 +27,7 @@ true true bin\Release\ - DigitalData.Products.ClipboardWatcher.xml + DigitalData.Modules.ClipboardWatcher.xml 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 @@ -43,20 +43,25 @@ On - - - - - + + False + D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Data.v18.1.dll + + + False + D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Utils.v18.1.dll + + + False + D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.XtraEditors.v18.1.dll + ..\packages\NLog.4.6.7\lib\net45\NLog.dll - - @@ -87,6 +92,12 @@ Form + + frmTreeView.vb + + + Form + True @@ -102,11 +113,16 @@ Settings.settings True + + frmMatch.vb + + frmTreeView.vb + VbMyResourcesResXFileCodeGenerator @@ -128,14 +144,6 @@ - - {44982f9b-6116-44e2-85d0-f39650b1ef99} - Config - - - {eaf0ea75-5fa7-485d-89c7-b2d843b03a96} - Database - {d3c8cfed-d6f6-43a8-9bdf-454145d0352f} Language @@ -145,11 +153,11 @@ Logging - {81cac44f-3711-4c8f-ae98-e02a7448782a} + {81CAC44F-3711-4C8F-AE98-E02A7448782A} ZooFlow - {5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86} + {5efaef9b-90b9-4f05-9f70-f79ad77fff86} Windows diff --git a/Products.ClipboardWatcher/My Project/Application.Designer.vb b/ClipboardWatcher/My Project/Application.Designer.vb similarity index 100% rename from Products.ClipboardWatcher/My Project/Application.Designer.vb rename to ClipboardWatcher/My Project/Application.Designer.vb diff --git a/Products.ClipboardWatcher/My Project/Application.myapp b/ClipboardWatcher/My Project/Application.myapp similarity index 100% rename from Products.ClipboardWatcher/My Project/Application.myapp rename to ClipboardWatcher/My Project/Application.myapp diff --git a/Products.ClipboardWatcher/My Project/AssemblyInfo.vb b/ClipboardWatcher/My Project/AssemblyInfo.vb similarity index 95% rename from Products.ClipboardWatcher/My Project/AssemblyInfo.vb rename to ClipboardWatcher/My Project/AssemblyInfo.vb index f1a6a172..a7914cc6 100644 --- a/Products.ClipboardWatcher/My Project/AssemblyInfo.vb +++ b/ClipboardWatcher/My Project/AssemblyInfo.vb @@ -18,7 +18,7 @@ Imports System.Runtime.InteropServices 'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. - + ' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: ' diff --git a/Products.ClipboardWatcher/My Project/Resources.Designer.vb b/ClipboardWatcher/My Project/Resources.Designer.vb similarity index 97% rename from Products.ClipboardWatcher/My Project/Resources.Designer.vb rename to ClipboardWatcher/My Project/Resources.Designer.vb index cff14c62..1fdfc6b9 100644 --- a/Products.ClipboardWatcher/My Project/Resources.Designer.vb +++ b/ClipboardWatcher/My Project/Resources.Designer.vb @@ -39,7 +39,7 @@ Namespace My.Resources Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Products.ClipboardWatcher.Resources", GetType(Resources).Assembly) + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Modules.ClipboardWatcher.Resources", GetType(Resources).Assembly) resourceMan = temp End If Return resourceMan diff --git a/Products.ClipboardWatcher/My Project/Resources.resx b/ClipboardWatcher/My Project/Resources.resx similarity index 100% rename from Products.ClipboardWatcher/My Project/Resources.resx rename to ClipboardWatcher/My Project/Resources.resx diff --git a/Products.ClipboardWatcher/My Project/Settings.Designer.vb b/ClipboardWatcher/My Project/Settings.Designer.vb similarity index 95% rename from Products.ClipboardWatcher/My Project/Settings.Designer.vb rename to ClipboardWatcher/My Project/Settings.Designer.vb index a022678b..392c3d68 100644 --- a/Products.ClipboardWatcher/My Project/Settings.Designer.vb +++ b/ClipboardWatcher/My Project/Settings.Designer.vb @@ -64,9 +64,9 @@ Namespace My Friend Module MySettingsProperty _ - Friend ReadOnly Property Settings() As Global.DigitalData.Products.ClipboardWatcher.My.MySettings + Friend ReadOnly Property Settings() As Global.DigitalData.Modules.ClipboardWatcher.My.MySettings Get - Return Global.DigitalData.Products.ClipboardWatcher.My.MySettings.Default + Return Global.DigitalData.Modules.ClipboardWatcher.My.MySettings.Default End Get End Property End Module diff --git a/Products.ClipboardWatcher/My Project/Settings.settings b/ClipboardWatcher/My Project/Settings.settings similarity index 100% rename from Products.ClipboardWatcher/My Project/Settings.settings rename to ClipboardWatcher/My Project/Settings.settings diff --git a/Products.ClipboardWatcher/My Project/licenses.licx b/ClipboardWatcher/My Project/licenses.licx similarity index 100% rename from Products.ClipboardWatcher/My Project/licenses.licx rename to ClipboardWatcher/My Project/licenses.licx diff --git a/ClipboardWatcher/ProfileFilter.vb b/ClipboardWatcher/ProfileFilter.vb new file mode 100644 index 00000000..c9e3ba30 --- /dev/null +++ b/ClipboardWatcher/ProfileFilter.vb @@ -0,0 +1,455 @@ +Imports System.Text.RegularExpressions +Imports System.Windows.Forms +Imports DigitalData.Modules.Language.Utils +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Windows +Imports DigitalData.Modules.ZooFlow.Params + +Public Class ProfileFilter + Private _ProfileMatch As ProfileMatch + Private _ProfileTable As DataTable + Private _ProcessTable As DataTable + Private _WindowTable As DataTable + Private _ControlTable As DataTable + Private _Profiles As List(Of ProfileData) + Private _TreeView As TreeView + Private _LogConfig As LogConfig + Private _Logger As Logger + + Public ReadOnly Property Profiles As List(Of ProfileData) + Get + Return _Profiles + End Get + End Property + + 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) + _ProfileTable = ProfileDatatable + _ProcessTable = ProcessTable + _WindowTable = WindowDatatable + _ControlTable = ControlDatatable + _Profiles = TransformProfiles() + _TreeView = TreeView + _LogConfig = LogConfig + _Logger = LogConfig.GetLogger() + Catch ex As Exception + _Logger.Error(ex) + Throw ex + End Try + End Sub + + Public Function ToList() As List(Of ProfileData) + Return _Profiles + End Function + + Public Function FilterProfilesByClipboardRegex(Profiles As List(Of ProfileData), ClipboardContents As String) As List(Of ProfileData) + Dim oFilteredProfiles As New List(Of ProfileData) + + Dim oRootNode As TreeNode = New TreeNode() With { + .Text = $"Suche nach '{ClipboardContents}'", + .Tag = "ROOT" + } + _TreeView.Nodes.Add(oRootNode) + + For Each oProfile In Profiles + _Logger.Debug("Current Profile: {0}", oProfile.Name) + + Dim oNode = _ProfileMatch.NewProfileNode(oProfile) + oRootNode.Nodes.Add(oNode) + + Try + Dim oRegex As New Regex(oProfile.Regex) + Dim oMatch = oRegex.Match(ClipboardContents) + If oMatch.Success Then + _Logger.Debug("FilterProfilesByClipboardRegex: Clipboard Regex Matched: {0}", ClipboardContents) + oFilteredProfiles.Add(oProfile) + oProfile.IsMatched = True + + Dim oSubnode = _ProfileMatch.NewClipboardRegexNode(oProfile, oMatch.Success) + oNode.Nodes.Add(oSubnode) + End If + Catch ex As Exception + _Logger.Warn("Regex '{0}' could not be processed for input '{1}'", oProfile.Regex, ClipboardContents) + _Logger.Error(ex) + End Try + Next + + Return oFilteredProfiles + End Function + Public Function FilterProfilesByProcess(Profiles As List(Of ProfileData), CurrentProcessName As String) As List(Of ProfileData) + Dim oFilteredProfiles As New List(Of ProfileData) + Try + For Each oProfile In Profiles + Dim oGuid = oProfile.Guid + + If oProfile.IsMatched = False Then + Continue For + End If + + Dim oProcesses As New List(Of ProcessData) + For Each oProcessDef As ProcessData In oProfile.Processes + If oProcessDef.PROFILE_ID <> oGuid Then + Continue For + End If + + Dim oIsMatch = oProcessDef.ProcessName.ToLower = CurrentProcessName.ToLower + Dim oParent = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oProfile.Name & "-REGEX") + If oParent IsNot Nothing Then + Dim oNode = _ProfileMatch.NewProcessNode(oProfile, oProcessDef, oIsMatch) + oParent.Nodes.Add(oNode) + End If + + _Logger.Debug($"FilterProfilesByProcess: Checking Profile: {oProfile.Name} ...") + If oIsMatch Then + _Logger.Debug($"Yes...Processname Matched: {oProcessDef.ProcessName}") + 'TODO: Add Debug Data + oFilteredProfiles.Add(oProfile) + oProfile.MatchedProcessID = oProcessDef.Guid + oProcessDef.IsMatched = True + oProcesses.Add(oProcessDef) + oProfile.IsMatched = True + oProfile.MatchedProcessID = oProcessDef.Guid + + End If + Next + If oFilteredProfiles.Count > 0 Then + oProfile.Processes = oProcesses + End If + Next + + Return oFilteredProfiles + Catch ex As Exception + _Logger.Warn("Unexpected error in FilterProfilesByProcess...") + _Logger.Error(ex) + End Try + + End Function + Public Function FilterWindowsByWindowTitleRegex(Profiles As List(Of ProfileData), WindowTitle As String) As List(Of ProfileData) + Dim oProfiles As New List(Of ProfileData) + + For Each oProfile As ProfileData In Profiles + _Logger.Debug("Checking WindowDefinition for profile: {0}...", oProfile.Name) + If oProfile.IsMatched = False Then Continue For + Dim oWindows As New List(Of WindowData) + + For Each oWindowDef As WindowData In oProfile.Windows + If oWindowDef.WindowProcessID <> oProfile.MatchedProcessID Then Continue For + Try + If oWindowDef.Regex = String.Empty Then + oProfile.MatchedWindowID = oWindowDef.Guid + oWindowDef.IsMatched = True + oWindows.Add(oWindowDef) + Exit For + End If + + Dim oRegex As New Regex(oWindowDef.Regex) + Dim oMatch = oRegex.Match(WindowTitle) + + If oMatch.Success Then + _Logger.Debug("MATCH on WindowTitle: {0}", WindowTitle) + oProfile.MatchedWindowID = oWindowDef.Guid + oWindowDef.IsMatched = True + oWindows.Add(oWindowDef) + End If + + Dim oParent = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oWindowDef.WindowProcessID & "-PROCESS") + If oParent IsNot Nothing Then + Dim oNode = _ProfileMatch.NewWindowNode(oProfile, oWindowDef, oMatch.Success) + oParent.Nodes.Add(oNode) + End If + + Catch ex As Exception + _Logger.Warn("Regex '{0}' could not be processed for input '{1}'", oWindowDef.Regex, WindowTitle) + _Logger.Error(ex) + End Try + Next + + If oWindows.Count > 0 Then + oProfile.Windows = oWindows + oProfile.IsMatched = True + oProfiles.Add(oProfile) + End If + Next + + Return oProfiles + End Function + + Public Function FilterProfilesByFocusedControlLocation(Profiles As List(Of ProfileData), ClipboardContents As String, WindowHandle As IntPtr) As List(Of ProfileData) + Dim oFilteredProfiles As New List(Of ProfileData) + Dim oWindow As New Window(_LogConfig) + + For Each oProfile In Profiles + If oProfile.IsMatched = False Then Continue For + + If oProfile.Controls.Count = 0 Then + oFilteredProfiles.Add(oProfile) + Continue For + End If + + Dim oControls As New List(Of ControlData) + + For Each oControl In oProfile.Controls + Dim oControlBounds = oWindow.GetFocusedControlLocation(WindowHandle) + Dim oFound As Boolean = False + + For Each oItem As KeyValuePair(Of String, Window.RectangleInfo) In oControlBounds + Select Case oItem.Key + Case "TOPLEFT" + If oControl.TopLeft.Top = oItem.Value.Top And oControl.TopLeft.Left = oItem.Value.Left Then + oFound = True + End If + Case "TOPRIGHT" + If oControl.TopRight.Top = oItem.Value.Top And oControl.TopLeft.Right = oItem.Value.Right Then + oFound = True + End If + Case "BOTTOMLEFT" + If oControl.BottomLeft.Bottom = oItem.Value.Bottom And oControl.TopLeft.Left = oItem.Value.Left Then + oFound = True + End If + Case "BOTTOMRIGHT" + If oControl.BottomRight.Bottom = oItem.Value.Bottom And oControl.TopLeft.Right = oItem.Value.Right Then + oFound = True + End If + End Select + Next + + If oFound Then + oFilteredProfiles.Add(oProfile) + End If + + Dim oParent = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oControl.WindowId & "-WINDOW") + If oParent IsNot Nothing Then + Dim oNode = _ProfileMatch.NewControlNode(oProfile, oControl, oFound) + oParent.Nodes.Add(oNode) + End If + Next + + If oControls.Count > 0 Then + oProfile.Controls = oControls + oFilteredProfiles.Add(oProfile) + End If + Next + + + Return oFilteredProfiles + End Function + + 'Public Function FilterProfilesBySearchResults(Profiles As List(Of ProfileData), DataSearchTable As DataTable, DocSearchTable As DataTable) As List(Of ProfileData) + ' Dim oProfiles As New List(Of ProfileData) + + ' For Each oProfile In Profiles + ' Dim oResultDocs As Integer = 0 + ' Dim oResultData As Integer = 0 + + ' Dim oPatterns As New ClassPatterns(_LogConfig) + ' Dim oDataSearches As DataTable = DataSearchTable + ' Dim oDocSearches As DataTable = DocSearchTable + + ' For Each oRow As DataRow In oDataSearches.Rows + ' Dim oCountCommand = String.Empty + ' Try + ' oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) + + ' If oCountCommand = String.Empty Then + ' Continue For + ' End If + + ' oCountCommand = oPatterns.ReplaceAllValues(oCountCommand, My.Application.User) + ' oResultData += NotNull(Of Integer)(My.Database.GetScalarValue(oCountCommand), 0) + ' Catch ex As Exception + ' _Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + ' End Try + ' Next + + ' For Each oRow As DataRow In oDocSearches.Rows + ' Dim oCountCommand = String.Empty + ' Try + ' oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) + + ' If oCountCommand = String.Empty Then + ' Continue For + ' End If + + ' oCountCommand = oPatterns.ReplaceAllValues(oCountCommand, My.Application.User) + ' oResultDocs += NotNull(Of Integer)(My.Database.GetScalarValue(oCountCommand), 0) + ' Catch ex As Exception + ' _Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + ' End Try + ' Next + + ' If oResultData > 0 Or oResultDocs > 0 Then + ' oProfile.CountData = oResultData + ' oProfile.CountDocs = oResultDocs + ' oProfiles.Add(oProfile) + ' End If + ' Next + + ' Return oProfiles + 'End Function + + Public Function FilterWindowsByWindowClipboardRegex(Profiles As List(Of ProfileData), ClipboardContents As String) As List(Of ProfileData) + Dim oProfiles As New List(Of ProfileData) + + For Each oProfile As ProfileData In Profiles + _Logger.Debug("Current Profile: {0}", oProfile.Name) + + Dim oWindows As New List(Of WindowData) + + For Each w As WindowData In oProfile.Windows + Try + If w.Regex = String.Empty Then + oWindows.Add(w) + End If + + Dim oRegex As New Regex(w.Regex) + Dim oMatch = oRegex.Match(ClipboardContents) + + If oMatch.Success Then + _Logger.Debug("Window Clipboard Regex Matched: {0}", ClipboardContents) + oWindows.Add(w) + End If + + Dim oResult As TreeNode = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oProfile.Name & "-REGEX") + If Not IsNothing(oResult) Then + Dim oNode As New TreeNode($"MATCH on WINDOW Clipboard Regex [{w.Regex}]: {oMatch.Success}") + oNode.ImageIndex = 2 + oNode.Tag = oProfile.Name & "-WINDOW_REGEX" + oResult.Nodes.Add(oNode) + End If + Catch ex As Exception + _Logger.Warn("Regex '{0}' could not be processed for input '{1}'", w.Regex, ClipboardContents) + _Logger.Error(ex) + End Try + Next + + If oWindows.Count > 0 Then + oProfile.Windows = oWindows + oProfiles.Add(oProfile) + End If + Next + + Return oProfiles + End Function + + Public Function ClearNotMatchedProfiles(Profiles As List(Of ProfileData)) As List(Of ProfileData) + Dim oFilteredProfiles As New List(Of ProfileData) + For Each oProfile In Profiles + If oProfile.IsMatched Then + oFilteredProfiles.Add(oProfile) + End If + Next + Return oFilteredProfiles + End Function + + Public Function ClearDuplicateProfiles(Profiles As List(Of ProfileData)) As List(Of ProfileData) + Return Profiles. + GroupBy(Function(Profile) Profile.Guid). + Select(Function(GroupedProfiles) GroupedProfiles.First). + ToList() + End Function + + Private Function TransformProfiles() As List(Of ProfileData) + 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) + + 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() + + Return oList + End Function + + Private Function TransformControls(ProfileId As Integer, ControlDatatable As DataTable) As List(Of ControlData) + 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 + + Return oControlList + End Function + Private Function TransformProcesses(ProfileId As Integer, ProcessDatatable As DataTable) As List(Of ProcessData) + 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 + + oProcessList = oProcessList. + Distinct(). + ToList() + + Return oProcessList + End Function + Private Function TransformWindows(ProfileId As Integer, WindowDatatable As DataTable) As List(Of WindowData) + 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 + + Return oWindowList + End Function +End Class diff --git a/ClipboardWatcher/ProfileMatch.vb b/ClipboardWatcher/ProfileMatch.vb new file mode 100644 index 00000000..1b4a276e --- /dev/null +++ b/ClipboardWatcher/ProfileMatch.vb @@ -0,0 +1,106 @@ +Imports System.Drawing +Imports System.Windows.Forms +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.ZooFlow.Params + +Public Class ProfileMatch + Private _Logger As Logger + + Public Sub New(LogConfig As LogConfig) + _Logger = LogConfig.GetLogger() + End Sub + + Public Function FindNodeByTag(ByVal nodes As TreeNodeCollection, ByVal Tag As String) As TreeNode + For Each node As TreeNode In nodes + If (node.Tag.Equals(Tag)) Then + Return node + End If + + Dim oNext As TreeNode = FindNodeByTag(node.Nodes, Tag) + If oNext IsNot Nothing Then + Return oNext + End If + Next + Return Nothing + End Function + + Public Function NewProfileNode(Profile As ProfileData) As TreeNode + Dim oNode As New TreeNode() With { + .Text = $"Profile: {Profile.Name}", + .ImageIndex = 0, + .Tag = Profile.Name & "-PROFILE" + } + + Return oNode + End Function + + Public Function NewClipboardRegexNode(Profile As ProfileData, IsMatch As Boolean) As TreeNode + Dim oText = $"{GetMatchText(IsMatch)} on Global Clipboard Regex {Profile.Regex}" + + Dim oNode As New TreeNode() With { + .Text = oText, + .ImageIndex = 1, + .Tag = Profile.Name & "-REGEX", + .BackColor = GetMatchColor(IsMatch) + } + + Return oNode + End Function + Public Function NewProcessNode(Profile As ProfileData, Process As ProcessData, IsMatch As Boolean) As TreeNode + Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH") + Dim oText = $"{GetMatchText(IsMatch)} on ProcessName {Process.ProcessName}" + + Dim oNode As New TreeNode() With { + .Text = oText, + .ImageIndex = 4, + .Tag = Process.Guid & "-PROCESS", + .BackColor = GetMatchColor(IsMatch) + } + + Return oNode + End Function + + Public Function NewWindowNode(Profile As ProfileData, Window As WindowData, IsMatch As Boolean) As TreeNode + Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH") + Dim oText = $"{GetMatchText(IsMatch)} on WindowTitle {Window.Title}" + + Dim oNode As New TreeNode() With { + .Text = oText, + .ImageIndex = 3, + .Tag = Window.Guid & "-WINDOW", + .BackColor = GetMatchColor(IsMatch) + } + + Return oNode + End Function + + Public Function NewControlNode(Profile As ProfileData, Control As ControlData, IsMatch As Boolean) As TreeNode + Dim oMatchText = IIf(IsMatch, "MATCH", "NO MATCH") + Dim oText = $"{GetMatchText(IsMatch)} on Control {Control.Description}: {IsMatch.ToString}" + + Dim oNode As New TreeNode() With { + .Text = oText, + .ImageIndex = 2, + .Tag = Control.Guid & "-CONTROL", + .BackColor = GetMatchColor(IsMatch) + } + + Return oNode + End Function + + Private Function GetLowestNode(ByVal Node As TreeNode) As TreeNode + If Node.GetNodeCount(False) = 1 Then + Return GetLowestNode(Node.Nodes.Item(0)) + Else + Return Node + End If + End Function + + Private Function GetMatchText(IsMatch As Boolean) + Return IIf(IsMatch, "MATCH", "NO MATCH") + End Function + + Private Function GetMatchColor(IsMatch As Boolean) + Return IIf(IsMatch, Color.LightGreen, Color.LightCoral) + End Function +End Class diff --git a/Products.ClipboardWatcher/frmMatch.Designer.vb b/ClipboardWatcher/frmMatch.Designer.vb similarity index 98% rename from Products.ClipboardWatcher/frmMatch.Designer.vb rename to ClipboardWatcher/frmMatch.Designer.vb index 7258bcab..396743b6 100644 --- a/Products.ClipboardWatcher/frmMatch.Designer.vb +++ b/ClipboardWatcher/frmMatch.Designer.vb @@ -95,5 +95,5 @@ Partial Class frmMatch Friend WithEvents TileGroupDocumentsData As DevExpress.XtraEditors.TileGroup Friend WithEvents TileGroupDocuments As DevExpress.XtraEditors.TileGroup Friend WithEvents TileGroupData As DevExpress.XtraEditors.TileGroup - Friend WithEvents Label1 As Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label End Class diff --git a/Products.ClipboardWatcher/frmMatch.resx b/ClipboardWatcher/frmMatch.resx similarity index 100% rename from Products.ClipboardWatcher/frmMatch.resx rename to ClipboardWatcher/frmMatch.resx diff --git a/Products.ClipboardWatcher/frmMatch.vb b/ClipboardWatcher/frmMatch.vb similarity index 100% rename from Products.ClipboardWatcher/frmMatch.vb rename to ClipboardWatcher/frmMatch.vb diff --git a/ClipboardWatcher/frmTreeView.Designer.vb b/ClipboardWatcher/frmTreeView.Designer.vb new file mode 100644 index 00000000..ff7bde96 --- /dev/null +++ b/ClipboardWatcher/frmTreeView.Designer.vb @@ -0,0 +1,49 @@ + _ +Partial Class frmTreeView + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.TreeView1 = New System.Windows.Forms.TreeView() + Me.SuspendLayout() + ' + 'TreeView1 + ' + Me.TreeView1.Dock = System.Windows.Forms.DockStyle.Fill + Me.TreeView1.Location = New System.Drawing.Point(0, 0) + Me.TreeView1.Name = "TreeView1" + Me.TreeView1.Size = New System.Drawing.Size(800, 450) + Me.TreeView1.TabIndex = 0 + ' + 'frmTreeView + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.TreeView1) + Me.Name = "frmTreeView" + Me.Text = "frmTreeView" + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents TreeView1 As System.Windows.Forms.TreeView +End Class diff --git a/ClipboardWatcher/frmTreeView.resx b/ClipboardWatcher/frmTreeView.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/ClipboardWatcher/frmTreeView.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ClipboardWatcher/frmTreeView.vb b/ClipboardWatcher/frmTreeView.vb new file mode 100644 index 00000000..a7f1848d --- /dev/null +++ b/ClipboardWatcher/frmTreeView.vb @@ -0,0 +1,3 @@ +Public Class frmTreeView + +End Class \ No newline at end of file diff --git a/Products.ClipboardWatcher/packages.config b/ClipboardWatcher/packages.config similarity index 100% rename from Products.ClipboardWatcher/packages.config rename to ClipboardWatcher/packages.config diff --git a/DDMonorepo.sln b/DDMonorepo.sln index 7841b9e0..79a0501e 100644 --- a/DDMonorepo.sln +++ b/DDMonorepo.sln @@ -82,16 +82,14 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "RegexEditor", "Controls.Reg EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZooFlow", "ZooFlow\ZooFlow.vbproj", "{D0FB36EB-783D-40E1-B71E-A0B84B2FE567}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Products", "Products", "{EB026AEE-C702-47C6-82F5-956D5C8E26C2}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ClipboardWatcher", "Products.ClipboardWatcher\ClipboardWatcher.vbproj", "{1FBA063D-60A5-4FC8-A529-A3D1ECFD640C}" -EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Windows", "Windows\Windows.vbproj", "{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZooFlow", "Modules\ZooFlow\ZooFlow.vbproj", "{81CAC44F-3711-4C8F-AE98-E02A7448782A}" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Automation", "Automation\Automation.vbproj", "{483A3DA7-6F7A-4E57-B77F-ED33F4E280C5}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ClipboardWatcher", "ClipboardWatcher\ClipboardWatcher.vbproj", "{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -214,10 +212,6 @@ Global {D0FB36EB-783D-40E1-B71E-A0B84B2FE567}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0FB36EB-783D-40E1-B71E-A0B84B2FE567}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0FB36EB-783D-40E1-B71E-A0B84B2FE567}.Release|Any CPU.Build.0 = Release|Any CPU - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C}.Release|Any CPU.Build.0 = Release|Any CPU {5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Debug|Any CPU.Build.0 = Debug|Any CPU {5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -230,6 +224,10 @@ Global {483A3DA7-6F7A-4E57-B77F-ED33F4E280C5}.Debug|Any CPU.Build.0 = Debug|Any CPU {483A3DA7-6F7A-4E57-B77F-ED33F4E280C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {483A3DA7-6F7A-4E57-B77F-ED33F4E280C5}.Release|Any CPU.Build.0 = Release|Any CPU + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -264,10 +262,10 @@ Global {D3C8CFED-D6F6-43A8-9BDF-454145D0352F} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {BCC6942F-CD4B-4B67-8200-1C0D002E7CC2} = {F98C0329-C004-417F-B2AB-7466E88D8220} {D0FB36EB-783D-40E1-B71E-A0B84B2FE567} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB} - {1FBA063D-60A5-4FC8-A529-A3D1ECFD640C} = {EB026AEE-C702-47C6-82F5-956D5C8E26C2} {5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {81CAC44F-3711-4C8F-AE98-E02A7448782A} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} {483A3DA7-6F7A-4E57-B77F-ED33F4E280C5} = {CC368D6A-6AC4-4EB9-A092-14700FABEF7A} + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286} diff --git a/GUIs.Test.ZUGFeRDTest/ZUGFeRDTest.vbproj b/GUIs.Test.ZUGFeRDTest/ZUGFeRDTest.vbproj index 4fe0733a..e05efbe6 100644 --- a/GUIs.Test.ZUGFeRDTest/ZUGFeRDTest.vbproj +++ b/GUIs.Test.ZUGFeRDTest/ZUGFeRDTest.vbproj @@ -52,7 +52,7 @@ - ..\packages\NLog.4.5.11\lib\net45\NLog.dll + ..\packages\NLog.4.6.7\lib\net45\NLog.dll diff --git a/GUIs.Test.ZUGFeRDTest/packages.config b/GUIs.Test.ZUGFeRDTest/packages.config index 9204b8da..7a05eafe 100644 --- a/GUIs.Test.ZUGFeRDTest/packages.config +++ b/GUIs.Test.ZUGFeRDTest/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Message/Email.vb b/Message/Email.vb index 912019bd..7c89afe0 100644 --- a/Message/Email.vb +++ b/Message/Email.vb @@ -2,7 +2,6 @@ Imports Independentsoft.Email.Pop3 Imports Independentsoft.Email.Mime Imports Independentsoft.Email.Imap -Imports DigitalData.Modules.Logging Imports System.Net.Mail Imports System.Net Imports System.Reflection @@ -10,9 +9,9 @@ Imports System.IO Public Class Email Private ReadOnly _logger As Logging.Logger - Private ReadOnly _logConfig As LogConfig + Private ReadOnly _logConfig As Logging.LogConfig - Public Sub New(LogConfig As LogConfig) + Public Sub New(LogConfig As Logging.LogConfig) _logger = LogConfig.GetLogger() _logConfig = LogConfig End Sub diff --git a/Modules/ZooFlow/Params/ProfileData.vb b/Modules/ZooFlow/Params/ProfileData.vb index 3d03fd4b..b2b05a13 100644 --- a/Modules/ZooFlow/Params/ProfileData.vb +++ b/Modules/ZooFlow/Params/ProfileData.vb @@ -6,9 +6,9 @@ Public Comment As String Public ProfileType As Integer - Public Processes As List(Of ProfileData.ProcessData) - Public Windows As List(Of ProfileData.WindowData) - Public Controls As List(Of ProfileData.ControlData) + Public Processes As List(Of ProcessData) + Public Windows As List(Of WindowData) + Public Controls As List(Of ControlData) Public CountDocs As Integer = 0 Public CountData As Integer = 0 @@ -18,30 +18,55 @@ Public MatchedControlID As Integer = 0 Public SelectCommand As String - Public Class ProcessData - Public Guid As Integer - Public ProfileId As Integer - Public ProcessName As String - Public IsMatched As Boolean = False - End Class - - Public Class ControlData - Public Guid As Integer - Public WindowId As Integer - Public Description As String - Public Regex As String - Public AutomationId As String - Public ControlName As String - Public IsMatched As Boolean = False - End Class - - Public Class WindowData - Public Guid As Integer - Public WindowProcessID As Integer - Public Title As String - Public Regex As String - Public Sequence As Integer - Public IsMatched As Boolean = False - End Class + Public Overrides Function Equals(obj As Object) As Boolean + Return Guid = DirectCast(obj, ProfileData).Guid + End Function + + Public Overrides Function GetHashCode() As Integer + Return Guid.ToString.GetHashCode() + End Function + End Class + + Public Class ProcessData + Public Guid As Integer + Public PROFILE_ID As Integer + Public ProcessName As String + Public IsMatched As Boolean = False + + Public Overrides Function Equals(obj As Object) As Boolean + Return Guid = DirectCast(obj, ProcessData).Guid + End Function + + Public Overrides Function GetHashCode() As Integer + Return Guid.ToString.GetHashCode() + End Function + End Class + Public Class WindowData + Public Guid As Integer + Public WindowProcessID As Integer + Public Title As String + Public Regex As String + Public Sequence As Integer + Public IsMatched As Boolean = False + + End Class + Public Class ControlData + Public Guid As Integer + Public WindowId As Integer + Public Description As String + Public Regex As String + Public AutomationId As String + Public ControlName As String + Public IsMatched As Boolean = False + Public TopLeft As ControlBounds + Public TopRight As ControlBounds + Public BottomLeft As ControlBounds + Public BottomRight As ControlBounds + End Class + Public Class ControlBounds + Public Top As Integer + Public Bottom As Integer + Public Left As Integer + Public Right As Integer End Class End Namespace \ No newline at end of file diff --git a/ZooFlow/ClassClipboardWatcher.vb b/ZooFlow/ClassClipboardWatcher.vb index 71f2f3fa..38f4b129 100644 --- a/ZooFlow/ClassClipboardWatcher.vb +++ b/ZooFlow/ClassClipboardWatcher.vb @@ -22,7 +22,6 @@ Public Class ClassClipboardWatcher End Sub Protected Overrides Sub WndProc(ByRef m As Message) - Select Case m.Msg Case WM_DRAWCLIPBOARD Dim oData As IDataObject = Clipboard.GetDataObject diff --git a/ZooFlow/Events/OnFlowFormStateChangedEvent.vb b/ZooFlow/Events/OnFlowFormStateChangedEvent.vb index 86cfdf77..bfaf90d1 100644 --- a/ZooFlow/Events/OnFlowFormStateChangedEvent.vb +++ b/ZooFlow/Events/OnFlowFormStateChangedEvent.vb @@ -2,6 +2,7 @@ Public Enum FlowFormState [Default] HasSearchResults + HasFileDropped End Enum Public ReadOnly Property State As FlowFormState diff --git a/ZooFlow/ZooFlow.vbproj b/ZooFlow/ZooFlow.vbproj index be5a3b1e..651b80ce 100644 --- a/ZooFlow/ZooFlow.vbproj +++ b/ZooFlow/ZooFlow.vbproj @@ -90,7 +90,6 @@ - @@ -188,6 +187,10 @@ + + {B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E} + ClipboardWatcher + {991d0231-4623-496d-8bd0-9ca906029cbc} Filesystem @@ -216,10 +219,6 @@ {81cac44f-3711-4c8f-ae98-e02a7448782a} ZooFlow - - {1fba063d-60a5-4fc8-a529-a3d1ecfd640c} - ClipboardWatcher - {5efaef9b-90b9-4f05-9f70-f79ad77fff86} Windows diff --git a/ZooFlow/frmFlowForm.vb b/ZooFlow/frmFlowForm.vb index b402802e..26e83dea 100644 --- a/ZooFlow/frmFlowForm.vb +++ b/ZooFlow/frmFlowForm.vb @@ -39,27 +39,29 @@ Public Class frmFlowForm Select Case State Case OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults SetBitmap(My.Resources.CW_GEFUNDEN_klein) + Case OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped + SetBitmap(My.Resources.GLOBIX_GEFUNDEN_klein) Case Else SetBitmap(My.Resources.ZOOFLOW_Home_klein) End Select End Sub Private Sub frmFlowForm_DragOver(sender As Object, e As DragEventArgs) Handles Me.DragOver - If ActiveModules.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then + If Not ActiveModules.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then e.Effect = DragDropEffects.None Else If e.Data.GetDataPresent(DataFormats.FileDrop) Then ' Handle file dragged from Windows e.Effect = DragDropEffects.Copy - SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults) + SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped) ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then ' Handle a message dragged from Outlook e.Effect = DragDropEffects.Copy - SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults) + SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped) ElseIf e.Data.GetDataPresent("aryFileGroupDescriptor") AndAlso (e.Data.GetDataPresent("FileContents")) Then ' Handle a message dragged from Thunderbird? e.Effect = DragDropEffects.Copy - SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasSearchResults) + SetFlowFormState(OnFlowFormStateChangedEvent.FlowFormState.HasFileDropped) Else ' Otherwise, do not handle e.Effect = DragDropEffects.None diff --git a/ZooFlow/frmMain.resx b/ZooFlow/frmMain.resx index 652bcb8e..688120a4 100644 --- a/ZooFlow/frmMain.resx +++ b/ZooFlow/frmMain.resx @@ -380,7 +380,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABU - CwAAAk1TRnQBSQFMAgEBBQEAATABAAEwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CwAAAk1TRnQBSQFMAgEBBQEAATgBAAE4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/ZooFlow/frmMain.vb b/ZooFlow/frmMain.vb index bf18f308..f0214bbd 100644 --- a/ZooFlow/frmMain.vb +++ b/ZooFlow/frmMain.vb @@ -6,8 +6,8 @@ Imports DigitalData.Modules.Windows Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.Messaging Imports DigitalData.Modules.ZooFlow.Params -Imports DigitalData.Products.ClipboardWatcher Imports DigitalData.GUIs.ZooFlow.OnFlowFormStateChangedEvent.FlowFormState +Imports DigitalData.Modules.ClipboardWatcher Partial Public Class frmMain Private WithEvents FlowForm As frmFlowForm @@ -21,7 +21,7 @@ Partial Public Class frmMain InitializeComponent() End Sub - Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load + Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load ' === Initialization === Init = New ClassInit(My.LogConfig, Me) AddHandler Init.Completed, AddressOf Init_Completed @@ -34,7 +34,7 @@ Partial Public Class frmMain EventBus.Instance.Register(Me) End Sub - Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed + Private Sub frmMain_FormClosed(sender As Object, e As FormClosedEventArgs) EventBus.Instance.Unregister(Me) End Sub @@ -74,17 +74,17 @@ Partial Public Class frmMain RefreshData() End Sub - Private Sub frmMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown + Private Sub frmMain_Shown(sender As Object, e As EventArgs) Hide() End Sub - Private Async Sub FlowForm_ClipboardChangedAsync(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged + Private Sub FlowForm_ClipboardChanged(sender As Object, e As IDataObject) Handles FlowForm.ClipboardChanged If My.Application.ClipboardWatcher.UserProfiles.Rows.Count = 0 Then Logger.Warn("Clipboard Changed but no profiles configured!") Exit Sub End If - Dim oProfileFilter As ClassProfileFilter + Dim oProfileFilter As ProfileFilter Dim oMatchingProfiles As List(Of ProfileData) Dim oWindow As New Window(My.LogConfig) Dim oWindowInfo = oWindow.GetWindowInfo() @@ -99,27 +99,22 @@ Partial Public Class frmMain Dim oClipboardContents As String = Clipboard.GetText() Try - oProfileFilter = New ClassProfileFilter(My.LogConfig, - My.Application.ClipboardWatcher.UserProfiles, - My.Application.ClipboardWatcher.ProfileProcesses, - My.Application.ClipboardWatcher.ProfileWindows, - My.Application.ClipboardWatcher.ProfileControls) + Dim oTreeView As New TreeView + + oProfileFilter = New ProfileFilter(My.LogConfig, + My.Application.ClipboardWatcher.UserProfiles, + My.Application.ClipboardWatcher.ProfileProcesses, + My.Application.ClipboardWatcher.ProfileWindows, + My.Application.ClipboardWatcher.ProfileControls, + oTreeView) oMatchingProfiles = oProfileFilter.Profiles - Logger.Debug("Profiles before filtering: {0}", oMatchingProfiles.Count) oMatchingProfiles = oProfileFilter.FilterProfilesByClipboardRegex(oMatchingProfiles, oClipboardContents) - Logger.Debug("Profiles after FilterProfilesByClipboardRegex: {0}", oMatchingProfiles.Count) oMatchingProfiles = oProfileFilter.FilterProfilesByProcess(oMatchingProfiles, oWindowInfo.ProcessName) - Logger.Debug("Profiles after FilterProfilesByProcess: {0}", oMatchingProfiles.Count) oMatchingProfiles = oProfileFilter.FilterWindowsByWindowTitleRegex(oMatchingProfiles, oWindowInfo.WindowTitle) - Logger.Debug("Profiles after FilterWindowsByWindowTitleRegex: {0}", oMatchingProfiles.Count) - 'oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControl(oMatchingProfiles, oClipboardContents, oFocusedControl.hWnd.ToString) - 'oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents) - Logger.Debug("Profiles after FilterProfilesByFocusedControl: {0}", oMatchingProfiles.Count) - oMatchingProfiles = Await Task.Run(Function() oProfileFilter.FilterProfilesBySearchResults(oMatchingProfiles)) - Logger.Debug("Profiles after FilterProfilesBySearchResults: {0}", oMatchingProfiles.Count) + oMatchingProfiles = oProfileFilter.FilterProfilesByFocusedControlLocation(oMatchingProfiles, oClipboardContents, Handle) + 'oMatchingProfiles = Await Task.Run(Function() oProfileFilter.FilterProfilesBySearchResults(oMatchingProfiles)) oMatchingProfiles = oProfileFilter.ClearNotMatchedProfiles(oMatchingProfiles) - Logger.Debug("Profiles after ClearNotMatchedProfiles: {0}", oMatchingProfiles.Count) oMatchingProfiles = oMatchingProfiles.ToList() Catch ex As Exception @@ -127,10 +122,10 @@ Partial Public Class frmMain Exit Sub End Try - If oMatchingProfiles.Count = 0 Then - Logger.Warn("No matching Profiles found") - Exit Sub - End If + 'If oMatchingProfiles.Count = 0 Then + ' Logger.Warn("No matching Profiles found") + ' Exit Sub + 'End If MatchingProfiles = oMatchingProfiles @@ -201,6 +196,4 @@ Partial Public Class frmMain Logger.Error(ex) End Try End Sub - - End Class