diff --git a/Global_Indexer/ClassInit.vb b/Global_Indexer/ClassInit.vb
index 9146f32..c5a949f 100644
--- a/Global_Indexer/ClassInit.vb
+++ b/Global_Indexer/ClassInit.vb
@@ -94,13 +94,13 @@ Public Class ClassInit
Public Function Load_BasicConfig()
Try
ClassDatabase.Init()
- Dim oSql As String = "select * from tbdd_Modules where NAME = 'Global-Indexer'"
+ Dim oSql As String = "SELECT * FROM TBDD_MODULES WHERE NAME = 'Global-Indexer'"
Dim DT As DataTable = ClassDatabase.Return_Datatable(oSql)
If DT.Rows.Count = 1 Then
GI_withWindream = DT.Rows(0).Item("BIT1")
'vWLaufwerk = DT.Rows(0).Item("STRING1")
End If
- oSql = "select * from TBDD_BASECONFIG"
+ oSql = "SELECT * FROM TBDD_BASECONFIG"
DT = ClassDatabase.Return_Datatable(oSql)
If DT.Rows.Count = 1 Then
WMDrive = DT.Rows(0).Item("WM_DRIVE")
diff --git a/Global_Indexer/Global_Indexer.vbproj b/Global_Indexer/Global_Indexer.vbproj
index 6e82df3..c50d22f 100644
--- a/Global_Indexer/Global_Indexer.vbproj
+++ b/Global_Indexer/Global_Indexer.vbproj
@@ -168,7 +168,8 @@
False
..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll
-
+
+ False
..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll
diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb
index bdfaea9..c562398 100644
--- a/Global_Indexer/frmIndex.vb
+++ b/Global_Indexer/frmIndex.vb
@@ -453,7 +453,9 @@ Public Class frmIndex
CURR_DOKART_WD_DIRECT = DT.Rows(0).Item("WINDREAM_DIRECT")
CURR_DOKART_OBJECTTYPE = DT.Rows(0).Item("OBJEKTTYP")
CURR_WORKFILE_EXTENSION = extension
- oRAWZielordner = DT.Rows(0).Item("ZIEL_PFAD")
+
+ oRAWZielordner = WINDREAM.GetNormalizedPath(DT.Rows(0).Item("ZIEL_PFAD"))
+ oRAWZielordner = Path.Combine("\\windream\objects", oRAWZielordner)
'####
' Regulären Ausdruck zum Auslesen der Indexe definieren
@@ -609,41 +611,41 @@ Public Class frmIndex
CURRENT_NEWFILENAME = oFilesystem.GetCleanFilename(NewFileString)
'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
- CURRENT_NEWFILENAME = oRAWZielordner & "\" & CURRENT_NEWFILENAME
+ CURRENT_NEWFILENAME = Path.Combine(oRAWZielordner, CURRENT_NEWFILENAME)
- If CURRENT_NEWFILENAME.EndsWith("_") Then
- CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Substring(0, CURRENT_NEWFILENAME.Length - 1)
- End If
- If CURRENT_NEWFILENAME.StartsWith("_") Then
- CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Substring(1)
- End If
- If CURRENT_NEWFILENAME.Contains("__") Then
- CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("__", "_")
- End If
- 'CURRENT_NEWFILENAME &= extension
- Dim sollfilename = System.IO.Path.GetFileName(CURRENT_NEWFILENAME)
- If sollfilename.StartsWith("_") Then
- sollfilename = sollfilename.Substring(1)
- Dim _path = System.IO.Path.GetDirectoryName(CURRENT_NEWFILENAME)
- CURRENT_NEWFILENAME = _path & "\" & sollfilename
- End If
- Dim path = System.IO.Path.GetDirectoryName(CURRENT_NEWFILENAME)
- If folder_Created = False Then
- ' Den Zielordner erstellen
- If Directory.Exists(path) = False Then
- Try
- 'Try to create the directory.
- Directory.CreateDirectory(path)
- Catch ex As Exception
- LOGGER.Info("Unexpected Error in 'Name_Generieren' - Error: " & vbNewLine & ex.Message & vbNewLine & "Directory.CreateDirectory(" & path & ")")
- LOGGER.Error(ex.Message)
- err = True
- MsgBox("Unexpected Error in 'Name_Generieren' - Error: " & vbNewLine & ex.Message & vbNewLine & "Directory.CreateDirectory(" & path & ")", MsgBoxStyle.Critical)
- End Try
+ 'If CURRENT_NEWFILENAME.EndsWith("_") Then
+ ' CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Substring(0, CURRENT_NEWFILENAME.Length - 1)
+ 'End If
+ 'If CURRENT_NEWFILENAME.StartsWith("_") Then
+ ' CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Substring(1)
+ 'End If
+ 'If CURRENT_NEWFILENAME.Contains("__") Then
+ ' CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("__", "_")
+ 'End If
+ ''CURRENT_NEWFILENAME &= extension
+ 'Dim sollfilename = System.IO.Path.GetFileName(CURRENT_NEWFILENAME)
+ 'If sollfilename.StartsWith("_") Then
+ ' sollfilename = sollfilename.Substring(1)
+ ' Dim _path = System.IO.Path.GetDirectoryName(CURRENT_NEWFILENAME)
+ ' CURRENT_NEWFILENAME = _path & "\" & sollfilename
+ 'End If
+ 'Dim path = System.IO.Path.GetDirectoryName(CURRENT_NEWFILENAME)
+ 'If folder_Created = False Then
+ ' ' Den Zielordner erstellen
+ ' If Directory.Exists(path) = False Then
+ ' Try
+ ' 'Try to create the directory.
+ ' Directory.CreateDirectory(path)
+ ' Catch ex As Exception
+ ' LOGGER.Info("Unexpected Error in 'Name_Generieren' - Error: " & vbNewLine & ex.Message & vbNewLine & "Directory.CreateDirectory(" & path & ")")
+ ' LOGGER.Error(ex.Message)
+ ' err = True
+ ' MsgBox("Unexpected Error in 'Name_Generieren' - Error: " & vbNewLine & ex.Message & vbNewLine & "Directory.CreateDirectory(" & path & ")", MsgBoxStyle.Critical)
+ ' End Try
- End If
- folder_Created = True
- End If
+ ' End If
+ ' folder_Created = True
+ 'End If
'False oder True zurückgeben
LOGGER.Debug("#### ENDE Name_Generieren ####")
LOGGER.Debug("")
@@ -2241,32 +2243,30 @@ Public Class frmIndex
Dim sql As String = "SELECT FOLDER_FOR_INDEX FROM TBDD_DOKUMENTART WHERE GUID = " & CURRENT_DOKART_ID
Dim Folder_for_index = ClassDatabase.Execute_Scalar(sql, MyConnectionString, True)
If Not IsDBNull(Folder_for_index) Then
- If Folder_for_index <> String.Empty Then
- CreateFolderForIndex(Folder_for_index)
- End If
+ CreateFolderForIndex(Folder_for_index)
End If
If CURR_DOKART_WD_DIRECT = False Then
'Datei verschieben
err = Move_Rename_Only(CURRENT_WORKFILE, CURRENT_NEWFILENAME, CURR_WORKFILE_EXTENSION, VERSION_DELIMITER)
Else
- If CURRENT_NEWFILENAME.Contains("//") Then
- CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("//", "/")
- End If
- If CURRENT_NEWFILENAME.Contains("\\") Then
- CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("\\", "\")
- End If
- Dim exp2WD As Boolean = False
+ 'If CURRENT_NEWFILENAME.Contains("//") Then
+ ' CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("//", "/")
+ 'End If
+ 'If CURRENT_NEWFILENAME.Contains("\\") Then
+ ' CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("\\", "\")
+ 'End If
+ Dim oExportSuccessful As Boolean = False
'Variable Folder
If DropType = "|DROPFROMFSYSTEM|" Or DropType = "|OUTLOOK_ATTACHMENT|" Or DropType = "|ATTMNTEXTRACTED|" Or DropType = "|FW_SIMPLEINDEXER|" Then
- exp2WD = SINGLEFILE_2_WINDREAM(CURR_DOKART_OBJECTTYPE)
+ oExportSuccessful = SINGLEFILE_2_WINDREAM(CURR_DOKART_OBJECTTYPE)
ElseIf DropType = "|OUTLOOK_MESSAGE|" Or DropType = "|FW_MSGONLY|" Or DropType = "|MSGONLY|" Then
- exp2WD = SINGLEFILE_2_WINDREAM(CURR_DOKART_OBJECTTYPE)
+ oExportSuccessful = SINGLEFILE_2_WINDREAM(CURR_DOKART_OBJECTTYPE)
End If
- If exp2WD = True Then
+ If oExportSuccessful = True Then
'Kein Fehler in Export2windream
err = False
If Write_Indizes() = True Then
@@ -2339,99 +2339,105 @@ Public Class frmIndex
Dim oRootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(LOGCONFIG)
- '######
- Dim oRegexString As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
- ' einen Regulären Ausdruck laden
- Dim oRegex As Regex = New Regex(oRegexString)
- ' die Vorkommen im Folder-String auslesen
- Dim oMatches As MatchCollection = oRegex.Matches(DynamicFolderConfig)
- '####
- ' alle Vorkommen innerhalb des Ordnerstrings durchlaufen
- For Each oMatch As Match In oMatches
- LOGGER.Info("Elementname in FolderString: '" & oMatch.ToString & "'")
- Select Case oMatch.Value.Substring(2, 1).ToUpper
+
+ If DynamicFolderConfig <> String.Empty Then
+ '######
+ Dim oRegexString As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
+ ' einen Regulären Ausdruck laden
+ Dim oRegex As Regex = New Regex(oRegexString)
+ ' die Vorkommen im Folder-String auslesen
+ Dim oMatches As MatchCollection = oRegex.Matches(DynamicFolderConfig)
+ '####
+
+ ' alle Vorkommen innerhalb des Ordnerstrings durchlaufen
+ For Each oMatch As Match In oMatches
+ LOGGER.Info("Elementname in FolderString: '" & oMatch.ToString & "'")
+ Select Case oMatch.Value.Substring(2, 1).ToUpper
'Manueller Indexwert
- Case "M"
- Dim oManIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
- Dim oIsOptional As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & oManIndexName & "')", MyConnectionString, True)
- LOGGER.Info("Versuch den Indexwert aus '" & oManIndexName & "' auszulesen.")
- Dim oManIndexValue As String = GetManIndex_Value(oManIndexName, "FILE", oIsOptional)
- LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oManIndexName & "'")
- If Not oManIndexValue = String.Empty Then
- If IsDate(oManIndexValue) Then
- oManIndexValue = CDate(oManIndexValue).ToString("yyyyMMdd")
+ Case "M"
+ Dim oManIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
+ Dim oIsOptional As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & oManIndexName & "')", MyConnectionString, True)
+ LOGGER.Info("Versuch den Indexwert aus '" & oManIndexName & "' auszulesen.")
+ Dim oManIndexValue As String = GetManIndex_Value(oManIndexName, "FILE", oIsOptional)
+ LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oManIndexName & "'")
+ If Not oManIndexValue = String.Empty Then
+ If IsDate(oManIndexValue) Then
+ oManIndexValue = CDate(oManIndexValue).ToString("yyyyMMdd")
+ End If
+
+ oManIndexValue = oFilesystem.GetCleanPath(oManIndexValue)
+ 'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "")
+ DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue)
+
+ LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
+ Else
+
+ If oIsOptional = True Then
+ LOGGER.Info("Optionaler Indexwert ist NICHT gefüllt")
+ Else
+ LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
+ Return True
+ End If
End If
+ Case "A"
+ Dim oAutoIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
+ LOGGER.Info("Versuch den Auto-Indexwert aus '" & oAutoIndexName & "' auszulesen.")
+ Dim oAutoIndexValue As String = GetAutoIndex_Value(oAutoIndexName)
+ LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oAutoIndexName & "'")
+ If Not oAutoIndexValue = String.Empty Then
- oManIndexValue = oFilesystem.GetCleanPath(oManIndexValue)
- 'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "")
- DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue)
+ oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue)
+ 'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "")
+ If oAutoIndexValue = "EMPTY_OI" Then
+ DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "")
+ Else
+ DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oAutoIndexValue)
+ LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
+ End If
- LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
- Else
-
- If oIsOptional = True Then
- LOGGER.Info("Optionaler Indexwert ist NICHT gefüllt")
Else
LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
- Return True
End If
- End If
- Case "A"
- Dim oAutoIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
- LOGGER.Info("Versuch den Auto-Indexwert aus '" & oAutoIndexName & "' auszulesen.")
- Dim oAutoIndexValue As String = GetAutoIndex_Value(oAutoIndexName)
- LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oAutoIndexName & "'")
- If Not oAutoIndexValue = String.Empty Then
+ Case "V"
+ Dim oElementTemp As String
+ Dim _Month As String = My.Computer.Clock.LocalTime.Month
+ If _Month.Length = 1 Then
+ _Month = "0" & _Month
+ End If
+ Dim _day As String = My.Computer.Clock.LocalTime.Day
+ If _day.Length = 1 Then
+ _day = "0" & _day
+ End If
+ Dim type = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
+ If type.StartsWith("_") Then
+ type = type.Replace("_", "")
+ End If
+ Select Case type
+ Case "YYYY/MM/DD"
+ oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month & "\" & _day
+ Case "YYYY/MM"
+ oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month
+ Case "YYYY"
+ oElementTemp = My.Computer.Clock.LocalTime.Year
+ Case "YYYY-MM"
+ oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month
+ End Select
+ DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oElementTemp)
+ LOGGER.Info("FolderPatter nach V-Element: '" & DynamicFolderConfig & "'")
+ Case Else
+ LOGGER.Info(" - Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper)
- oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue)
- 'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "")
- If oAutoIndexValue = "EMPTY_OI" Then
- DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "")
+ If USER_LANGUAGE = "de-DE" Then
+ MsgBox("Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
Else
- DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oAutoIndexValue)
- LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
+ MsgBox("Attention - One element in Namingconvention could not be matched!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
End If
+ End Select
+ Next
+ End If
- Else
- LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
- End If
- Case "V"
- Dim oElementTemp As String
- Dim _Month As String = My.Computer.Clock.LocalTime.Month
- If _Month.Length = 1 Then
- _Month = "0" & _Month
- End If
- Dim _day As String = My.Computer.Clock.LocalTime.Day
- If _day.Length = 1 Then
- _day = "0" & _day
- End If
- Dim type = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
- If type.StartsWith("_") Then
- type = type.Replace("_", "")
- End If
- Select Case type
- Case "YYYY/MM/DD"
- oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month & "\" & _day
- Case "YYYY/MM"
- oElementTemp = My.Computer.Clock.LocalTime.Year & "\" & _Month
- Case "YYYY"
- oElementTemp = My.Computer.Clock.LocalTime.Year
- Case "YYYY-MM"
- oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month
- End Select
- DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oElementTemp)
- LOGGER.Info("FolderPatter nach V-Element: '" & DynamicFolderConfig & "'")
- Case Else
- LOGGER.Info(" - Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper)
- If USER_LANGUAGE = "de-DE" Then
- MsgBox("Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
- Else
- MsgBox("Attention - One element in Namingconvention could not be matched!" & vbNewLine & "Elementname: " & oMatch.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
- End If
- End Select
- Next
LOGGER.Info("Den Root-Folder zusammenfügen>> ")
@@ -2451,7 +2457,8 @@ Public Class frmIndex
LOGGER.Info("Fullpath (ohne SZ) '" & oNewFullpath & "'")
If Directory.Exists(oNewFullpath) = False Then
Try
- Directory.CreateDirectory(oNewFullpath)
+ Dim oCreatedPath = Directory.CreateDirectory(oNewFullPath)
+ oNewFullPath = oCreatedPath.FullName
LOGGER.Info("Folder '" & oNewFullpath & "' wurde angelegt")
Catch ex As Exception
LOGGER.Info("Error in CreateFolderforIndex-Method - Root Folder '" & oNewFullpath & "' could not be created. " & ex.Message)