fix name generation for optional indexes

This commit is contained in:
Jonathan Jenne 2020-05-15 15:39:43 +02:00
parent 6983e4dac3
commit fe21ae8409

View File

@ -491,29 +491,22 @@ Public Class frmIndex
Else
If optional_index = True Then
Dim result As MsgBoxResult
oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value & "-", "-")
oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value & "_", "_")
oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value & "-", "_")
oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value & "_", "-")
'If USER_LANGUAGE = "de-DE" Then
' result = MessageBox.Show("Achtung der optionale Index ist leer, wird aber für die Benennung der Datei benutzt." & vbNewLine & "Wollen Sie stattdessen den Originaldateinamen verwenden?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
'Else
' result = MessageBox.Show("Attention: optional index is empty, but is being used in renaming the file." & vbNewLine & "Do you want to use the original filename instead?", "Confirmation needed:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
'End If
oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value, "-")
oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value, "_")
oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "-", "-")
oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "_", "_")
oNamenkonvention = oNamenkonvention.Replace(oElement.Value, oManValue)
'If result = MsgBoxResult.Yes Then
' oNamenkonvention = oNamenkonvention.Replace(oElement.Value, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
' NewFileString = oNamenkonvention
' sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString
' AnzahlIndexe += 1
' sql_history_Index_Values = sql_history_Index_Values & ", '" & System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE).Replace("'", "''") & "'"
'Else
oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value, oManValue)
oNamenkonvention = oNamenkonvention.Replace("-" & oElement.Value, oManValue)
NewFileString = oNamenkonvention
sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString
AnzahlIndexe += 1
sql_history_Index_Values = sql_history_Index_Values & ", '" & oManValue.Replace("'", "''") & "'"
' End If
Else
LOGGER.Debug("Der Indexvalue für Index '" & Indexname & "' ist String.Empty")
err = True
@ -2454,6 +2447,8 @@ Public Class frmIndex
End If
End If
Next sonderChar
oNewFullPath = WINDREAM.GetCleanedPath(oNewFullPath)
LOGGER.Info("Fullpath (ohne SZ) '" & oNewFullpath & "'")
If Directory.Exists(oNewFullpath) = False Then
Try
@ -2466,7 +2461,6 @@ Public Class frmIndex
MsgBox("Attention: Root Folder '" & oNewFullpath & "' could not be created." & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
End If
CURRENT_NEWFILENAME = Path.Combine(oNewFullpath, Path.GetFileName(CURRENT_NEWFILENAME))