prepare zooflow, add profilefilter

This commit is contained in:
Jonathan Jenne
2019-09-24 12:55:58 +02:00
parent 82a839949d
commit 0f7e6415e8
29 changed files with 862 additions and 105 deletions

View File

@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>DigitalData.Modules.ClipboardWatcher</RootNamespace>
<AssemblyName>DigitalData.Modules.ClipboardWatcher</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DigitalData.Modules.ClipboardWatcher.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DigitalData.Modules.ClipboardWatcher.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Data.v18.1.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Utils.v18.1.dll</HintPath>
</Reference>
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.XtraEditors.v18.1.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.7\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmMatch.Designer.vb">
<DependentUpon>frmMatch.vb</DependentUpon>
</Compile>
<Compile Include="frmMatch.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmTreeView.Designer.vb">
<DependentUpon>frmTreeView.vb</DependentUpon>
</Compile>
<Compile Include="frmTreeView.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ProfileFilter.vb" />
<Compile Include="ProfileMatch.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmMatch.resx">
<DependentUpon>frmMatch.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmTreeView.resx">
<DependentUpon>frmTreeView.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\licenses.licx" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modules.Language\Language.vbproj">
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
<Name>Language</Name>
</ProjectReference>
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
<Name>Logging</Name>
</ProjectReference>
<ProjectReference Include="..\Modules\ZooFlow\ZooFlow.vbproj">
<Project>{81CAC44F-3711-4C8F-AE98-E02A7448782A}</Project>
<Name>ZooFlow</Name>
</ProjectReference>
<ProjectReference Include="..\Windows\Windows.vbproj">
<Project>{5efaef9b-90b9-4f05-9f70-f79ad77fff86}</Project>
<Name>Windows</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>1</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die einer Assembly zugeordnet sind.
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("ClipboardWatcher")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("ClipboardWatcher")>
<Assembly: AssemblyCopyright("Copyright © 2019")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("54aa1032-5249-42ef-9b3d-f05a61a1e65b")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
'-Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
'Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
'mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
'''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
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.Modules.ClipboardWatcher.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
''' Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion:4.0.30319.42000
'
' Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "Automatische My.Settings-Speicherfunktion"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.ClipboardWatcher.My.MySettings
Get
Return Global.DigitalData.Modules.ClipboardWatcher.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1 @@
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -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

View File

@@ -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

99
ClipboardWatcher/frmMatch.Designer.vb generated Normal file
View File

@@ -0,0 +1,99 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMatch
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.TileControlMatch = New DevExpress.XtraEditors.TileControl()
Me.TileGroupDocumentsData = New DevExpress.XtraEditors.TileGroup()
Me.TileGroupDocuments = New DevExpress.XtraEditors.TileGroup()
Me.TileGroupData = New DevExpress.XtraEditors.TileGroup()
Me.Label1 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'TileControlMatch
'
Me.TileControlMatch.AllowDragTilesBetweenGroups = False
Me.TileControlMatch.AppearanceGroupText.BackColor = System.Drawing.Color.Transparent
Me.TileControlMatch.AppearanceGroupText.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TileControlMatch.AppearanceGroupText.ForeColor = System.Drawing.Color.White
Me.TileControlMatch.AppearanceGroupText.Options.UseBackColor = True
Me.TileControlMatch.AppearanceGroupText.Options.UseFont = True
Me.TileControlMatch.AppearanceGroupText.Options.UseForeColor = True
Me.TileControlMatch.BackColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
Me.TileControlMatch.Dock = System.Windows.Forms.DockStyle.Fill
Me.TileControlMatch.Groups.Add(Me.TileGroupDocumentsData)
Me.TileControlMatch.Groups.Add(Me.TileGroupDocuments)
Me.TileControlMatch.Groups.Add(Me.TileGroupData)
Me.TileControlMatch.Location = New System.Drawing.Point(0, 0)
Me.TileControlMatch.Name = "TileControlMatch"
Me.TileControlMatch.ShowGroupText = True
Me.TileControlMatch.Size = New System.Drawing.Size(800, 450)
Me.TileControlMatch.TabIndex = 0
Me.TileControlMatch.Text = "TileControl1"
'
'TileGroupDocumentsData
'
Me.TileGroupDocumentsData.Name = "TileGroupDocumentsData"
Me.TileGroupDocumentsData.Text = "Kombiniert"
'
'TileGroupDocuments
'
Me.TileGroupDocuments.Name = "TileGroupDocuments"
Me.TileGroupDocuments.Text = "Dokumente"
'
'TileGroupData
'
Me.TileGroupData.Name = "TileGroupData"
Me.TileGroupData.Text = "Daten"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.BackColor = System.Drawing.Color.FromArgb(CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
Me.Label1.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.White
Me.Label1.Location = New System.Drawing.Point(12, 9)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(401, 21)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Es wurde mehr als ein Match für Ihre Suche gefunden:"
'
'frmMatch
'
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.Label1)
Me.Controls.Add(Me.TileControlMatch)
Me.Name = "frmMatch"
Me.Text = "frmMatch"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents TileControlMatch As DevExpress.XtraEditors.TileControl
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 System.Windows.Forms.Label
End Class

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,155 @@
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.XtraEditors
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.ZooFlow.Params
''' <summary>
'''
''' Selfcontained:
''' - Config (Location of Window)
'''
''' Environment:
''' - Pattern Replacement Values
''' - User Info (isAdmin, etc)
''' - License Info?
''' - ConnectionString
'''
''' Parameters:
''' - Matching Profiles as List Of ProfileData
''' - Clipboard Content as String
''' </summary>
Public Class frmMatch
Private _LogConfig As LogConfig
Private _Logger As Logger
Private _Environment As Environment
Private _Params As ClipboardWatcherParams
Private PrimaryFont As New Font("Segoe UI", 12, FontStyle.Bold)
Private SecondaryFont As New Font("Segoe UI", 10)
Private Const NO_COUNT_SQL As Integer = 99998
Private Const INVALID_COUNT_SQL As Integer = 99999
Private Enum ProfileType
ANY = 0
DOCS_ONLY = 1
DATA_ONLY = 2
End Enum
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ClipboardWatcherParams)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
_LogConfig = LogConfig
_Logger = LogConfig.GetLogger()
_Environment = Environment
_Params = Params
End Sub
Private Sub frmMatch_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oCreatedTiles = CreateTiles()
If oCreatedTiles = -1 Then
Exit Sub
End If
End Sub
Function CreateTiles() As Integer
Try
Dim oCreatedTiles As Integer = 0
Dim oDocumentGroup = TileControlMatch.Groups.Item("TileGroupDocuments")
Dim oDataGroup = TileControlMatch.Groups.Item("TileGroupData")
Dim oDataDocumentsGroup = TileControlMatch.Groups.Item("TileGroupDocumentsData")
oDocumentGroup.Items.Clear()
oDataGroup.Items.Clear()
For Each oProfile As ProfileData In _Params.MatchingProfiles
If oProfile.ProfileType = ProfileType.ANY Then
If oProfile.CountData > 0 And oProfile.CountDocs > 0 Then
Dim oCountText = oProfile.CountData + oProfile.CountDocs
Dim oItem = CreateTile(oProfile, $"{oCountText} Ergebnisse")
oDataDocumentsGroup.Items.Add(oItem)
oCreatedTiles += 1
End If
End If
If oProfile.ProfileType = ProfileType.ANY Or oProfile.ProfileType = ProfileType.DOCS_ONLY Then
If oProfile.CountDocs > 0 Then
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dokumente")
oDocumentGroup.Items.Add(oItem)
oCreatedTiles += 1
End If
End If
If oProfile.ProfileType = ProfileType.ANY Or oProfile.ProfileType = ProfileType.DATA_ONLY Then
If oProfile.CountData > 0 Then
Dim oItem = CreateTile(oProfile, $"{oProfile.CountData} Datensätze")
oDataGroup.Items.Add(oItem)
oCreatedTiles += 1
End If
End If
Next
Return oCreatedTiles
Catch ex As Exception
_Logger.Error(ex)
MsgBox("Error while creating profile tiles!" & vbNewLine & ex.Message)
Return -1
End Try
End Function
Private Function CreateTile(Profile As ProfileData, CountText As String) As TileItem
Dim oItem As New TileItem() With {.Tag = Profile.Guid}
oItem.Elements.Clear()
Dim oNameElement = New TileItemElement With {
.Text = Profile.Name,
.TextAlignment = TileItemContentAlignment.TopLeft
}
oNameElement.Appearance.Normal.Font = PrimaryFont
oItem.Elements.Add(oNameElement)
Dim oCommentElement = New TileItemElement With {
.Text = Profile.Comment,
.TextAlignment = TileItemContentAlignment.MiddleLeft
}
oCommentElement.Appearance.Normal.Font = SecondaryFont
oItem.Elements.Add(oCommentElement)
Dim oCountElement = New TileItemElement With {
.Text = GetCountText(Profile, CountText),
.TextAlignment = TileItemContentAlignment.BottomRight
}
oCountElement.Appearance.Normal.Font = SecondaryFont
oItem.Elements.Add(oCountElement)
Return oItem
End Function
Private Function GetCountText(Profile As ProfileData, CountText As String) As String
Dim oText As String = "No implemented"
If Profile.CountData = INVALID_COUNT_SQL Then
oText = "Invalid SQL!"
ElseIf Profile.CountData = NO_COUNT_SQL Then
oText = "No SQL!"
Else
oText = CountText
End If
If Profile.CountDocs = INVALID_COUNT_SQL Then
oText = "Invalid SQL!"
ElseIf Profile.CountDocs = NO_COUNT_SQL Then
oText = "No SQL!"
Else
oText = CountText
End If
Return oText
End Function
End Class

49
ClipboardWatcher/frmTreeView.Designer.vb generated Normal file
View File

@@ -0,0 +1,49 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmTreeView
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
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

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,3 @@
Public Class frmTreeView
End Class

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.6.7" targetFramework="net461" />
</packages>