allow backslash in dynamic folderpaths
This commit is contained in:
parent
491d76c842
commit
d8bb4e3caa
@ -160,11 +160,13 @@
|
|||||||
<Reference Include="DigitalData.Modules.Config">
|
<Reference Include="DigitalData.Modules.Config">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Filesystem">
|
<Reference Include="DigitalData.Modules.Filesystem, Version=1.0.1.1, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Logging">
|
<Reference Include="DigitalData.Modules.Logging, Version=2.0.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="DigitalData.Modules.Windream">
|
<Reference Include="DigitalData.Modules.Windream">
|
||||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
||||||
|
|||||||
@ -435,6 +435,7 @@ Public Class frmIndex
|
|||||||
Try
|
Try
|
||||||
LOGGER.Debug("#### Name_Generieren ####")
|
LOGGER.Debug("#### Name_Generieren ####")
|
||||||
Dim sql As String = "select VERSION_DELIMITER, FILE_DELIMITER FROM TBDD_MODULES WHERE GUID = 1"
|
Dim sql As String = "select VERSION_DELIMITER, FILE_DELIMITER FROM TBDD_MODULES WHERE GUID = 1"
|
||||||
|
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(LOGCONFIG)
|
||||||
Dim DT1 As DataTable = ClassDatabase.Return_Datatable(sql)
|
Dim DT1 As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||||
For Each row As DataRow In DT1.Rows
|
For Each row As DataRow In DT1.Rows
|
||||||
FILE_DELIMITER = row.Item("FILE_DELIMITER")
|
FILE_DELIMITER = row.Item("FILE_DELIMITER")
|
||||||
@ -606,8 +607,8 @@ Public Class frmIndex
|
|||||||
End Select
|
End Select
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
CURRENT_NEWFILENAME = oFilesystem.GetCleanFilename(NewFileString)
|
||||||
CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
|
'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
|
||||||
CURRENT_NEWFILENAME = oRAWZielordner & "\" & CURRENT_NEWFILENAME
|
CURRENT_NEWFILENAME = oRAWZielordner & "\" & CURRENT_NEWFILENAME
|
||||||
|
|
||||||
If CURRENT_NEWFILENAME.EndsWith("_") Then
|
If CURRENT_NEWFILENAME.EndsWith("_") Then
|
||||||
@ -2333,40 +2334,43 @@ Public Class frmIndex
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function CreateFolderForIndex(myDynamicFolder As String)
|
Private Function CreateFolderForIndex(DynamicFolderConfig As String)
|
||||||
Try
|
Try
|
||||||
Dim ORootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
|
Dim oRootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
|
||||||
|
Dim oFilesystem As New DigitalData.Modules.Filesystem.File(LOGCONFIG)
|
||||||
|
|
||||||
'######
|
'######
|
||||||
Dim p_reg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
Dim oRegexString As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||||
' einen Regulären Ausdruck laden
|
' einen Regulären Ausdruck laden
|
||||||
Dim regularExpression As Regex = New Regex(p_reg)
|
Dim oRegex As Regex = New Regex(oRegexString)
|
||||||
' die Vorkommen im Folder-String auslesen
|
' die Vorkommen im Folder-String auslesen
|
||||||
Dim elemente As MatchCollection = regularExpression.Matches(myDynamicFolder)
|
Dim oMatches As MatchCollection = oRegex.Matches(DynamicFolderConfig)
|
||||||
'####
|
'####
|
||||||
' alle Vorkommen innerhalb des Ordnerstrings durchlaufen
|
' alle Vorkommen innerhalb des Ordnerstrings durchlaufen
|
||||||
For Each element As Match In elemente
|
For Each oMatch As Match In oMatches
|
||||||
LOGGER.Info("Elementname in FolderString: '" & element.ToString & "'")
|
LOGGER.Info("Elementname in FolderString: '" & oMatch.ToString & "'")
|
||||||
Select Case element.Value.Substring(2, 1).ToUpper
|
Select Case oMatch.Value.Substring(2, 1).ToUpper
|
||||||
|
|
||||||
'Manueller Indexwert
|
'Manueller Indexwert
|
||||||
Case "M"
|
Case "M"
|
||||||
Dim ManIndexname = element.Value.Substring(3, element.Value.Length - 4)
|
Dim oManIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
|
||||||
Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & ManIndexname & "')", MyConnectionString, True)
|
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 '" & ManIndexname & "' auszulesen.")
|
LOGGER.Info("Versuch den Indexwert aus '" & oManIndexName & "' auszulesen.")
|
||||||
Dim ManIndex_Value As String = GetManIndex_Value(ManIndexname, "FILE", optional_index)
|
Dim oManIndexValue As String = GetManIndex_Value(oManIndexName, "FILE", oIsOptional)
|
||||||
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & ManIndexname & "'")
|
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oManIndexName & "'")
|
||||||
If Not ManIndex_Value = String.Empty Then
|
If Not oManIndexValue = String.Empty Then
|
||||||
If IsDate(ManIndex_Value) Then
|
If IsDate(oManIndexValue) Then
|
||||||
ManIndex_Value = CDate(ManIndex_Value).ToString("yyyyMMdd")
|
oManIndexValue = CDate(oManIndexValue).ToString("yyyyMMdd")
|
||||||
End If
|
End If
|
||||||
ManIndex_Value = ClassFilehandle.CleanFilename(ManIndex_Value, "")
|
|
||||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, ManIndex_Value)
|
|
||||||
|
|
||||||
LOGGER.Info("FolderPattern: '" & myDynamicFolder & "'")
|
oManIndexValue = oFilesystem.GetCleanPath(oManIndexValue)
|
||||||
|
'oManIndexValue = ClassFilehandle.CleanFilename(oManIndexValue, "")
|
||||||
|
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oManIndexValue)
|
||||||
|
|
||||||
|
LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
|
||||||
Else
|
Else
|
||||||
|
|
||||||
If optional_index = True Then
|
If oIsOptional = True Then
|
||||||
LOGGER.Info("Optionaler Indexwert ist NICHT gefüllt")
|
LOGGER.Info("Optionaler Indexwert ist NICHT gefüllt")
|
||||||
Else
|
Else
|
||||||
LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
|
LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
|
||||||
@ -2374,17 +2378,19 @@ Public Class frmIndex
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Case "A"
|
Case "A"
|
||||||
Dim AutoIndexname = element.Value.Substring(3, element.Value.Length - 4)
|
Dim oAutoIndexName = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
|
||||||
LOGGER.Info("Versuch den Auto-Indexwert aus '" & AutoIndexname & "' auszulesen.")
|
LOGGER.Info("Versuch den Auto-Indexwert aus '" & oAutoIndexName & "' auszulesen.")
|
||||||
Dim AutoIndex_Value As String = GetAutoIndex_Value(AutoIndexname)
|
Dim oAutoIndexValue As String = GetAutoIndex_Value(oAutoIndexName)
|
||||||
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & AutoIndexname & "'")
|
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & oAutoIndexName & "'")
|
||||||
If Not AutoIndex_Value = String.Empty Then
|
If Not oAutoIndexValue = String.Empty Then
|
||||||
AutoIndex_Value = ClassFilehandle.CleanFilename(AutoIndex_Value, "")
|
|
||||||
If AutoIndex_Value = "EMPTY_OI" Then
|
oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue)
|
||||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, "")
|
'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "")
|
||||||
|
If oAutoIndexValue = "EMPTY_OI" Then
|
||||||
|
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "")
|
||||||
Else
|
Else
|
||||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, AutoIndex_Value)
|
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oAutoIndexValue)
|
||||||
LOGGER.Info("FolderPattern: '" & myDynamicFolder & "'")
|
LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@ -2400,7 +2406,7 @@ Public Class frmIndex
|
|||||||
If _day.Length = 1 Then
|
If _day.Length = 1 Then
|
||||||
_day = "0" & _day
|
_day = "0" & _day
|
||||||
End If
|
End If
|
||||||
Dim type = element.Value.Substring(3, element.Value.Length - 4)
|
Dim type = oMatch.Value.Substring(3, oMatch.Value.Length - 4)
|
||||||
If type.StartsWith("_") Then
|
If type.StartsWith("_") Then
|
||||||
type = type.Replace("_", "")
|
type = type.Replace("_", "")
|
||||||
End If
|
End If
|
||||||
@ -2414,26 +2420,23 @@ Public Class frmIndex
|
|||||||
Case "YYYY-MM"
|
Case "YYYY-MM"
|
||||||
oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month
|
oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month
|
||||||
End Select
|
End Select
|
||||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, oElementTemp)
|
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oElementTemp)
|
||||||
LOGGER.Info("FolderPatter nach V-Element: '" & myDynamicFolder & "'")
|
LOGGER.Info("FolderPatter nach V-Element: '" & DynamicFolderConfig & "'")
|
||||||
Case Else
|
Case Else
|
||||||
LOGGER.Info(" - Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & element.Value.ToUpper)
|
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
|
If USER_LANGUAGE = "de-DE" Then
|
||||||
MsgBox("Achtung - in der Namenkonvention wurde ein Element gefunden welches nicht zugeordnet werden kann!" & vbNewLine & "Elementname: " & element.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
|
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
|
Else
|
||||||
MsgBox("Attention - One element in Namingconvention could not be matched!" & vbNewLine & "Elementname: " & element.Value.ToUpper, MsgBoxStyle.Exclamation, "Unexpected error in Name generieren:")
|
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 If
|
||||||
End Select
|
End Select
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LOGGER.Info("Den Root-Folder zusammenfügen>> ")
|
LOGGER.Info("Den Root-Folder zusammenfügen>> ")
|
||||||
Dim oNewFullpath As String = ORootFolder & "\" & myDynamicFolder & "\"
|
|
||||||
oNewFullpath = oNewFullpath.Replace("\\", "\")
|
|
||||||
|
|
||||||
oNewFullpath = Path.Combine(ORootFolder, myDynamicFolder)
|
Dim oNewFullPath As String = System.IO.Path.Combine(oRootFolder, DynamicFolderConfig)
|
||||||
|
|
||||||
LOGGER.Info("Fullpath (mit evtl. Sonderzeichen (SZ)) '" & oNewFullpath & "'")
|
LOGGER.Info("Fullpath (mit evtl. Sonderzeichen (SZ)) '" & oNewFullpath & "'")
|
||||||
Dim invalidPathChars() As Char = Path.GetInvalidPathChars()
|
Dim invalidPathChars() As Char = Path.GetInvalidPathChars()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user