7 Commits

Author SHA1 Message Date
Jonathan Jenne
4a4121d8e6 ClipboardWatch: add catchall rule for filtering processes 2020-12-17 17:00:09 +01:00
Jonathan Jenne
30cda7c3f5 EDMIAPI: add GetDatatableByName 2020-12-17 16:59:16 +01:00
Jonathan Jenne
0ba66f119f Config: Version 1.0.11.0 2020-12-17 16:58:57 +01:00
Jonathan Jenne
f4141aee40 Config: add config migration 2020-12-17 16:58:38 +01:00
Jonathan Jenne
cd2bac4d6a Logging: 2.0.4.0 2020-12-17 16:57:32 +01:00
Jonathan Jenne
fdba43e3d7 Logging: Version 2.0.4.0 2020-12-17 15:07:41 +01:00
Jonathan Jenne
975ab50e56 Logging: Show block logs in debug and info 2020-12-17 15:07:06 +01:00
6 changed files with 67 additions and 19 deletions

View File

@@ -33,6 +33,8 @@ Public Class ProfileFilter
Public Const ERROR_EXECUTING_COUNT_SQL_FOR_DATA_SEARCH = "ERROR_EXECUTING_COUNT_SQL_FOR_DATA_SEARCH"
Public Const ERROR_EXECUTING_COUNT_SQL_FOR_DOC_SEARCH = "ERROR_EXECUTING_COUNT_SQL_FOR_DOC_SEARCH"
Public Const PROCESS_NAME_CATCHALL = "_CATCHALL_"
Public ReadOnly Property Profiles As List(Of ProfileData)
Get
Return _Profiles
@@ -122,6 +124,12 @@ Public Class ProfileFilter
End If
Dim oIsMatch = oProcess.ProcessName.ToLower = ProcessName.ToLower
' Catch-all processname
If oProcess.ProcessName.ToLower = PROCESS_NAME_CATCHALL.ToLower Then
oIsMatch = True
End If
Dim oParent = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oProfile.Name & "-REGEX")
If oParent IsNot Nothing Then
Dim oNode = _ProfileMatch.NewProcessNode(oProfile, oProcess, oIsMatch)
@@ -135,7 +143,6 @@ Public Class ProfileFilter
oFilteredProfiles.Add(oProfile)
_Logger.Info("FilterProfilesByProcess: Profile {0} matched!", oProfile.Name)
oProfile.MatchedProcessID = oProcess.Guid
oProcess.IsMatched = True
oProcesses.Add(oProcess)
oProfile.IsMatched = True

View File

@@ -12,12 +12,21 @@ Public Class ConfigUtils
_File = New Filesystem.File(LogConfig)
End Sub
Public Function TestMigrationNeeded(TargetDirectory As String) As Boolean
If IO.Directory.Exists(TargetDirectory) Then
Return False
Else
Return True
End If
End Function
Public Sub MigrateConfig(SourceDirectory As String, TargetDirectory As String, Optional FilePattern As String = "*.*")
If IO.Directory.Exists(TargetDirectory) Then
_Logger.Warn("Config Migration aborted because new config directory [{0}] already exists!", TargetDirectory)
Exit Sub
End If
_Logger.Debug("Creating TargetDirectory [{0}]", TargetDirectory)
' Create target directory
Try
IO.Directory.CreateDirectory(TargetDirectory)
@@ -29,6 +38,7 @@ Public Class ConfigUtils
' Create Migration directory
Dim oMigrationDirectory = IO.Path.Combine(SourceDirectory, MIGRATE_DIRECTORY)
_Logger.Debug("Creating MigrationDirectory [{0}]", oMigrationDirectory)
Try
IO.Directory.CreateDirectory(oMigrationDirectory)
Catch ex As Exception
@@ -37,18 +47,24 @@ Public Class ConfigUtils
Exit Sub
End Try
' Copy individual files from top level directory
For Each oPath In IO.Directory.EnumerateFiles(SourceDirectory, FilePattern)
Dim oFileInfo = New IO.FileInfo(oPath)
_Logger.NewBlock($"File {oFileInfo.Name}")
_Logger.Debug("Processing file [{0}]", oFileInfo.Name)
_Logger.Debug("Copying [{0}] to TargetDirectory..", oFileInfo.Name)
' Copy to target directory
Try
IO.File.Copy(oPath, IO.Path.Combine(TargetDirectory, oFileInfo.Name))
Catch ex As Exception
_Logger.Warn("Could not move old config file {0} to new config location {1}", oFileInfo.Name, TargetDirectory)
_Logger.Error(ex)
End Try
Next
For Each oPath In IO.Directory.EnumerateFiles(SourceDirectory, FilePattern)
Dim oFileInfo = New IO.FileInfo(oPath)
_Logger.Debug("Moving [{0}] to MigrationDirectory..", oFileInfo.Name)
' Move to migration directory
Try
IO.File.Move(oPath, IO.Path.Combine(oMigrationDirectory, oFileInfo.Name))
Catch ex As Exception
@@ -60,33 +76,44 @@ Public Class ConfigUtils
For Each oDirectoryPath In IO.Directory.EnumerateDirectories(SourceDirectory, "*", IO.SearchOption.TopDirectoryOnly)
Dim oDirInfo As New IO.DirectoryInfo(oDirectoryPath)
_Logger.NewBlock($"Directory {oDirInfo.Name}")
_Logger.Debug("Processing directory [{0}]", oDirInfo.Name)
' Don't copy TargetDirectory if subpath of SourceDirectory or if MigrationDirectory
If oDirInfo.FullName = TargetDirectory Or oDirInfo.FullName = oMigrationDirectory Then
_Logger.Debug("Directory [{0}] should not be copied. Skipping.", oDirInfo.Name)
Continue For
End If
' Copy directory to TargetDirectory
Dim oNewDirectoryPath = IO.Path.Combine(TargetDirectory, oDirInfo.Name)
_Logger.Debug("Copying [{0}] to TargetDirectory..", oDirInfo.Name)
Try
_File.CopyDirectory(oDirInfo.FullName, oNewDirectoryPath, True)
Catch ex As Exception
_Logger.Warn("Could not move directory [{0}] to new path [{1}]", oDirInfo.FullName, oNewDirectoryPath)
_Logger.Error(ex)
End Try
Next
For Each oDirectoryPath In IO.Directory.EnumerateDirectories(SourceDirectory, "*", IO.SearchOption.TopDirectoryOnly)
Dim oDirInfo As New IO.DirectoryInfo(oDirectoryPath)
If oDirInfo.FullName = TargetDirectory Or oDirInfo.FullName = oMigrationDirectory Then
Continue For
End If
Dim oNewDirectoryPath = IO.Path.Combine(oMigrationDirectory, oDirInfo.Name)
_Logger.Debug("Copying [{0}] to MigrationDirectory..", oDirInfo.Name)
' Copy directory to MigrationDirectory
Dim oMigrationDirectoryPath = IO.Path.Combine(oMigrationDirectory, oDirInfo.Name)
Try
_File.CopyDirectory(oDirInfo.FullName, oNewDirectoryPath, True)
_File.CopyDirectory(oDirInfo.FullName, oMigrationDirectoryPath, True)
Catch ex As Exception
_Logger.Error(ex)
_Logger.Warn("Could not move directory [{0}] to migration directory [{1}]", oDirInfo.FullName, oNewDirectoryPath)
_Logger.Warn("Could not move directory [{0}] to migration directory [{1}]", oDirInfo.FullName, oMigrationDirectoryPath)
End Try
_Logger.Debug("Deleting [{0}]..", oDirInfo.Name)
' Delete directory
Try
IO.Directory.Delete(oDirInfo.FullName, True)
Catch ex As Exception
_Logger.Error(ex)
_Logger.Warn("Could not delete directory [{0}]", oDirInfo.FullName)
End Try
Next
End Sub
End Class

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.10.0")>
<Assembly: AssemblyFileVersion("1.0.10.0")>
<Assembly: AssemblyVersion("1.0.11.0")>
<Assembly: AssemblyFileVersion("1.0.11.0")>

View File

@@ -131,6 +131,16 @@ Public Class Client
End Try
End Function
Public Function GetDatatableByName(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As TableResult
Try
Dim oResponse = _channel.ReturnDatatableFromCache(DatatableName, FilterExpression, SortByColumn)
Return oResponse
Catch ex As Exception
_logger.Error(ex)
Throw ex
End Try
End Function
Public Async Function GetDatatableByNameAsync(DatatableName As String, Optional FilterExpression As String = "", Optional SortByColumn As String = "") As Task(Of TableResult)
Try
Dim oResponse = Await _channel.ReturnDatatableFromCacheAsync(DatatableName, FilterExpression, SortByColumn)

View File

@@ -12,8 +12,10 @@ Public Class Logger
Public Sub NewBlock(blockId As String)
Dim message As String = $"-----> Start of Block {blockId}"
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
Dim logEventDebug As New LogEventInfo(LogLevel.Debug, Name, message)
Dim WrapperType As Type = GetType(Logger)
Log(WrapperType, logEventDebug)
Log(WrapperType, logEventInfo)
End Sub
@@ -21,8 +23,10 @@ Public Class Logger
Public Sub EndBlock()
Dim message As String = $"<----- End of Block"
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
Dim logEventDebug As New LogEventInfo(LogLevel.Debug, Name, message)
Dim WrapperType As Type = GetType(Logger)
Log(WrapperType, logEventDebug)
Log(WrapperType, logEventInfo)
End Sub
End Class

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.3.0")>
<Assembly: AssemblyFileVersion("2.0.3.0")>
<Assembly: AssemblyVersion("2.0.4.0")>
<Assembly: AssemblyFileVersion("2.0.4.0")>