From fe21ae8409bde6fba60d92eecdad6ceab8b93b37 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Fri, 15 May 2020 15:39:43 +0200 Subject: [PATCH] fix name generation for optional indexes --- Global_Indexer/frmIndex.vb | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index c562398..2872a8a 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -491,29 +491,22 @@ Public Class frmIndex Else If optional_index = True Then - Dim result As MsgBoxResult - - '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 - - '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) + 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, "-") + oNamenkonvention = oNamenkonvention.Replace("_" & oElement.Value, "_") + oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "-", "-") + oNamenkonvention = oNamenkonvention.Replace(oElement.Value & "_", "_") + + 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))