Compare commits
7 Commits
ddffb9c4f8
...
aa27dd8c1c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa27dd8c1c | ||
|
|
20ec64c21d | ||
|
|
7a6537d529 | ||
|
|
e2d67ab6d7 | ||
|
|
79e10ef2f6 | ||
|
|
da8ba360ca | ||
|
|
fac8762888 |
@@ -87,6 +87,7 @@
|
||||
<Compile Include="FileWatcher\FileWatcher.vb" />
|
||||
<Compile Include="FileWatcher\FileWatcherFilters.vb" />
|
||||
<Compile Include="FileWatcher\FileWatcherProperties.vb" />
|
||||
<Compile Include="IDB\Constants.vb" />
|
||||
<Compile Include="MimeEx.vb" />
|
||||
<Compile Include="WindowsEx.vb" />
|
||||
<Compile Include="ModuleExtensions.vb" />
|
||||
|
||||
43
Base/IDB/Constants.vb
Normal file
43
Base/IDB/Constants.vb
Normal file
@@ -0,0 +1,43 @@
|
||||
Namespace IDB
|
||||
|
||||
Public Class Constants
|
||||
Public Class FileStore
|
||||
Public Const FILE_STORE_INVALID_OBEJCT_ID = 0
|
||||
|
||||
Public Const FILE_CHANGED_QUESTION = "QUESTION VERSION"
|
||||
Public Const FILE_CHANGED_OVERWRITE = "AUTO REPLACE"
|
||||
Public Const FILE_CHANGED_VERSION = "AUTO VERSION"
|
||||
|
||||
Public Const OBJECT_STATE_FILE_ADDED = "File added"
|
||||
Public Const OBJECT_STATE_FILE_VERSIONED = "File versioned"
|
||||
Public Const OBJECT_STATE_FILE_CHANGED = "File changed"
|
||||
Public Const OBJECT_STATE_FILE_OPENED = "File opened"
|
||||
Public Const OBJECT_STATE_FILE_DELETED = "File deleted"
|
||||
Public Const OBJECT_STATE_METADATA_CHANGED = "Metadata changed"
|
||||
Public Const OBJECT_STATE_ATTRIBUTEVALUE_DELETED = "Attributevalue deleted"
|
||||
Public Const OBJECT_STATE_FILE_CHECKED_OUT = "File Checked Out"
|
||||
Public Const OBJECT_STATE_FILE_CHECKED_IN = "File Checked In"
|
||||
End Class
|
||||
|
||||
Public Class Database
|
||||
Public Enum NamedDatabase
|
||||
ECM
|
||||
IDB
|
||||
End Enum
|
||||
End Class
|
||||
|
||||
Public Class Attributes
|
||||
Public Const ATTRIBUTE_DOCTYPE = "Doctype"
|
||||
Public Const ATTRIBUTE_DYNAMIC_FOLDER = "Dynamic Folder"
|
||||
|
||||
Public Const ATTRIBUTE_ORIGIN_FILENAME = "OriginFileName"
|
||||
Public Const ATTRIBUTE_ORIGIN_CHANGED = "OriginChangedDatetime"
|
||||
Public Const ATTRIBUTE_ORIGIN_CREATED = "OriginCreationDatetime"
|
||||
|
||||
Public Const ATTRIBUTE_DISPLAY_FILENAME = "DisplayFileName"
|
||||
Public Const ATTRIBUTE_DISPLAY_FILENAME1 = "DisplayFileName1"
|
||||
|
||||
End Class
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -1,4 +1,5 @@
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ConfigUtils
|
||||
@@ -6,6 +7,7 @@ Public Class ConfigUtils
|
||||
Private _File As FilesystemEx
|
||||
|
||||
Private Const MIGRATE_DIRECTORY As String = "Migrate"
|
||||
Private Const USER_CONFIG As String = "UserConfig.xml"
|
||||
|
||||
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
@@ -21,98 +23,131 @@ Public Class ConfigUtils
|
||||
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
|
||||
Public Function MigrateAppDataConfig(pUserAppDataPath As String, pProductName As String, pOldProductName As String)
|
||||
Dim oNewDirPath = pUserAppDataPath
|
||||
Dim oOldDirPath = oNewDirPath.Replace(pProductName, pOldProductName)
|
||||
Dim oNewFilePath = Path.Combine(oNewDirPath, USER_CONFIG)
|
||||
Dim oOldFilePath = Path.Combine(oOldDirPath, USER_CONFIG)
|
||||
|
||||
' If there is already a new config, exit.
|
||||
If File.Exists(oNewFilePath) Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
' If there is no old config, exit.
|
||||
If Not File.Exists(oOldFilePath) Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
_Logger.Debug("Creating TargetDirectory [{0}]", TargetDirectory)
|
||||
' Create target directory
|
||||
Try
|
||||
IO.Directory.CreateDirectory(TargetDirectory)
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Config Migration aborted because new config directory [{0}] could not be created!", TargetDirectory)
|
||||
_Logger.Error(ex)
|
||||
Exit Sub
|
||||
End Try
|
||||
|
||||
' 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
|
||||
_Logger.Warn("Config Migration aborted because migration directory [{0}] could not be created!", oMigrationDirectory)
|
||||
_Logger.Error(ex)
|
||||
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.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
|
||||
|
||||
_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
|
||||
_Logger.Warn("Could not move old config file {0} to migration directory {1}", oFileInfo.Name, oMigrationDirectory)
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
For Each oDirectoryPath In IO.Directory.EnumerateDirectories(SourceDirectory, "*", IO.SearchOption.TopDirectoryOnly)
|
||||
Dim oDirInfo As New IO.DirectoryInfo(oDirectoryPath)
|
||||
|
||||
_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
|
||||
If Not Directory.Exists(oNewDirPath) Then
|
||||
Directory.CreateDirectory(oNewDirPath)
|
||||
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
|
||||
_Logger.Info("Migrating Config from [{0}] to [{1}]", pOldProductName, pProductName)
|
||||
File.Copy(oOldFilePath, oNewFilePath)
|
||||
Return True
|
||||
|
||||
_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, oMigrationDirectoryPath, True)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("Could not move directory [{0}] to migration directory [{1}]", oDirInfo.FullName, oMigrationDirectoryPath)
|
||||
End Try
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("Error while Migrating Config")
|
||||
_Logger.Error(ex)
|
||||
Return False
|
||||
|
||||
_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 Try
|
||||
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)
|
||||
'Catch ex As Exception
|
||||
' _Logger.Warn("Config Migration aborted because new config directory [{0}] could not be created!", TargetDirectory)
|
||||
' _Logger.Error(ex)
|
||||
' Exit Sub
|
||||
'End Try
|
||||
|
||||
'' 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
|
||||
' _Logger.Warn("Config Migration aborted because migration directory [{0}] could not be created!", oMigrationDirectory)
|
||||
' _Logger.Error(ex)
|
||||
' 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.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
|
||||
|
||||
' _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
|
||||
' _Logger.Warn("Could not move old config file {0} to migration directory {1}", oFileInfo.Name, oMigrationDirectory)
|
||||
' _Logger.Error(ex)
|
||||
' End Try
|
||||
'Next
|
||||
|
||||
'For Each oDirectoryPath In IO.Directory.EnumerateDirectories(SourceDirectory, "*", IO.SearchOption.TopDirectoryOnly)
|
||||
' Dim oDirInfo As New IO.DirectoryInfo(oDirectoryPath)
|
||||
|
||||
' _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
|
||||
|
||||
' _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, oMigrationDirectoryPath, True)
|
||||
' Catch ex As Exception
|
||||
' _Logger.Error(ex)
|
||||
' _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
|
||||
|
||||
@@ -69,7 +69,9 @@ Public Class FileGroups
|
||||
Private Function GetMessageIdFromFileName(Filename As String) As String
|
||||
' Regex to find MessageId
|
||||
' See also: https://stackoverflow.com/questions/3968500/regex-to-validate-a-message-id-as-per-rfc2822
|
||||
Dim oRegex = "(((([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(""(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*""))@(([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\]))))~.+"
|
||||
'Dim oRegex = "(((([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(""(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*""))@(([a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*)|(\[(([\x01-\x08\x0B\x0C\x0E-\x1F\x7F]|[\x21-\x5A\x5E-\x7E])|(\\[\x01-\x09\x0B\x0C\x0E-\x7F]))*\]))))~.+"
|
||||
|
||||
Dim oRegex = "([A-Z0-9]+)~ATTM\d+\..*"
|
||||
Dim oMatch = Regex.Match(Filename, oRegex, RegexOptions.IgnoreCase)
|
||||
|
||||
If oMatch.Success Then
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("2.0.0.0")>
|
||||
<Assembly: AssemblyTrademark("2.1.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyVersion("2.1.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.1.0.0")>
|
||||
|
||||
@@ -452,12 +452,11 @@ Public Class LogConfig
|
||||
|
||||
' Add default targets
|
||||
_config.AddTarget(TARGET_ERROR_EX, GetErrorExceptionLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_ERROR, GetErrorLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_DEFAULT, GetDefaultLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_DEBUG, GetDebugLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_TRACE, GetTraceLogTarget(_basePath))
|
||||
_config.AddTarget(TARGET_JSON, GetJsonLogTarget(_basePath))
|
||||
'_config.AddTarget(TARGET_MEMORY, GetMemoryDebugTarget())
|
||||
|
||||
|
||||
' Add default rules
|
||||
AddDefaultRules(_config)
|
||||
@@ -575,19 +574,7 @@ Public Class LogConfig
|
||||
Return errorLogWithExceptions
|
||||
End Function
|
||||
|
||||
Private Function GetErrorLogTarget(basePath As String) As FileTarget
|
||||
Dim errorLog As New FileTarget() With {
|
||||
.FileName = Path.Combine(basePath, FILE_NAME_FORMAT_ERROR),
|
||||
.Name = TARGET_ERROR,
|
||||
.Layout = LOG_FORMAT_DEFAULT,
|
||||
.MaxArchiveFiles = MAX_ARCHIVE_FILES_DEFAULT,
|
||||
.ArchiveEvery = ARCHIVE_EVERY,
|
||||
.KeepFileOpen = KEEP_FILES_OPEN,
|
||||
.Encoding = Text.Encoding.Unicode
|
||||
}
|
||||
|
||||
Return errorLog
|
||||
End Function
|
||||
|
||||
Private Function GetDebugLogTarget(basePath As String) As FileTarget
|
||||
Dim debugLog As New FileTarget() With {
|
||||
|
||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Logging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("2.6.2.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("2.6.3.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.2.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.2.0")>
|
||||
<Assembly: AssemblyVersion("2.6.3.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.3.0")>
|
||||
|
||||
Reference in New Issue
Block a user