allow backslash in dynamic folderpaths
This commit is contained in:
parent
491d76c842
commit
d8bb4e3caa
@ -160,11 +160,13 @@
|
||||
<Reference Include="DigitalData.Modules.Config">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Filesystem, Version=1.0.1.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.0.0.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Windream">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Windream\bin\Debug\DigitalData.Modules.Windream.dll</HintPath>
|
||||
|
||||
@ -435,6 +435,7 @@ Public Class frmIndex
|
||||
Try
|
||||
LOGGER.Debug("#### Name_Generieren ####")
|
||||
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)
|
||||
For Each row As DataRow In DT1.Rows
|
||||
FILE_DELIMITER = row.Item("FILE_DELIMITER")
|
||||
@ -606,8 +607,8 @@ Public Class frmIndex
|
||||
End Select
|
||||
Next
|
||||
|
||||
|
||||
CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
|
||||
CURRENT_NEWFILENAME = oFilesystem.GetCleanFilename(NewFileString)
|
||||
'CURRENT_NEWFILENAME = ClassFilehandle.CleanFilename(NewFileString, "")
|
||||
CURRENT_NEWFILENAME = oRAWZielordner & "\" & CURRENT_NEWFILENAME
|
||||
|
||||
If CURRENT_NEWFILENAME.EndsWith("_") Then
|
||||
@ -2333,40 +2334,43 @@ Public Class frmIndex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function CreateFolderForIndex(myDynamicFolder As String)
|
||||
Private Function CreateFolderForIndex(DynamicFolderConfig As String)
|
||||
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
|
||||
Dim regularExpression As Regex = New Regex(p_reg)
|
||||
Dim oRegex As Regex = New Regex(oRegexString)
|
||||
' 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
|
||||
For Each element As Match In elemente
|
||||
LOGGER.Info("Elementname in FolderString: '" & element.ToString & "'")
|
||||
Select Case element.Value.Substring(2, 1).ToUpper
|
||||
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 ManIndexname = element.Value.Substring(3, element.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)
|
||||
LOGGER.Info("Versuch den Indexwert aus '" & ManIndexname & "' auszulesen.")
|
||||
Dim ManIndex_Value As String = GetManIndex_Value(ManIndexname, "FILE", optional_index)
|
||||
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & ManIndexname & "'")
|
||||
If Not ManIndex_Value = String.Empty Then
|
||||
If IsDate(ManIndex_Value) Then
|
||||
ManIndex_Value = CDate(ManIndex_Value).ToString("yyyyMMdd")
|
||||
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
|
||||
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
|
||||
|
||||
If optional_index = True Then
|
||||
If oIsOptional = True Then
|
||||
LOGGER.Info("Optionaler Indexwert ist NICHT gefüllt")
|
||||
Else
|
||||
LOGGER.Info(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!")
|
||||
@ -2374,17 +2378,19 @@ Public Class frmIndex
|
||||
End If
|
||||
End If
|
||||
Case "A"
|
||||
Dim AutoIndexname = element.Value.Substring(3, element.Value.Length - 4)
|
||||
LOGGER.Info("Versuch den Auto-Indexwert aus '" & AutoIndexname & "' auszulesen.")
|
||||
Dim AutoIndex_Value As String = GetAutoIndex_Value(AutoIndexname)
|
||||
LOGGER.Info("Ergebnis/Wert für neuen Ordner: '" & AutoIndexname & "'")
|
||||
If Not AutoIndex_Value = String.Empty Then
|
||||
AutoIndex_Value = ClassFilehandle.CleanFilename(AutoIndex_Value, "")
|
||||
If AutoIndex_Value = "EMPTY_OI" Then
|
||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, "")
|
||||
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
|
||||
|
||||
oAutoIndexValue = oFilesystem.GetCleanPath(oAutoIndexValue)
|
||||
'oAutoIndexValue = ClassFilehandle.CleanFilename(oAutoIndexValue, "")
|
||||
If oAutoIndexValue = "EMPTY_OI" Then
|
||||
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, "")
|
||||
Else
|
||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, AutoIndex_Value)
|
||||
LOGGER.Info("FolderPattern: '" & myDynamicFolder & "'")
|
||||
DynamicFolderConfig = DynamicFolderConfig.Replace(oMatch.ToString, oAutoIndexValue)
|
||||
LOGGER.Info("FolderPattern: '" & DynamicFolderConfig & "'")
|
||||
End If
|
||||
|
||||
Else
|
||||
@ -2400,7 +2406,7 @@ Public Class frmIndex
|
||||
If _day.Length = 1 Then
|
||||
_day = "0" & _day
|
||||
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
|
||||
type = type.Replace("_", "")
|
||||
End If
|
||||
@ -2414,26 +2420,23 @@ Public Class frmIndex
|
||||
Case "YYYY-MM"
|
||||
oElementTemp = My.Computer.Clock.LocalTime.Year & "-" & _Month
|
||||
End Select
|
||||
myDynamicFolder = myDynamicFolder.Replace(element.ToString, oElementTemp)
|
||||
LOGGER.Info("FolderPatter nach V-Element: '" & myDynamicFolder & "'")
|
||||
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: " & 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
|
||||
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
|
||||
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 Select
|
||||
Next
|
||||
|
||||
|
||||
|
||||
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 & "'")
|
||||
Dim invalidPathChars() As Char = Path.GetInvalidPathChars()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user