diff --git a/Base/DocumentPathHandler.vb b/Base/DocumentPathHandler.vb index 7dc21135..8d0af405 100644 --- a/Base/DocumentPathHandler.vb +++ b/Base/DocumentPathHandler.vb @@ -55,6 +55,52 @@ Public Class DocumentPathHandler Return False End Try End Function + Public Sub CleanupTempFolder() + Try + If String.IsNullOrEmpty(TEMP_DOCUMENT_FOLDER) Then + _Logger.Debug("TEMP_DOCUMENT_FOLDER ist nicht gesetzt → Kein Cleanup erforderlich") + Return + End If + + If Not System.IO.Directory.Exists(TEMP_DOCUMENT_FOLDER) Then + _Logger.Debug($"Temp-Ordner [{TEMP_DOCUMENT_FOLDER}] existiert nicht → Kein Cleanup erforderlich") + Return + End If + + ' Alle Dateien im Ordner ermitteln + Dim files As String() = System.IO.Directory.GetFiles(TEMP_DOCUMENT_FOLDER) + + If files.Length = 0 Then + _Logger.Debug($"Temp-Ordner [{TEMP_DOCUMENT_FOLDER}] ist bereits leer") + Return + End If + + ' Alle Dateien löschen + Dim deletedCount As Integer = 0 + Dim errorCount As Integer = 0 + + For Each filePath As String In files + Try + System.IO.File.Delete(filePath) + deletedCount += 1 + _Logger.Debug($"Datei gelöscht: [{System.IO.Path.GetFileName(filePath)}]") + Catch fileEx As Exception + errorCount += 1 + _Logger.Warn($"⚠️ Datei konnte nicht gelöscht werden: [{System.IO.Path.GetFileName(filePath)}] - {fileEx.Message}") + End Try + Next + + If errorCount = 0 Then + _Logger.Debug($"✓ Temp-Ordner bereinigt: {deletedCount} Datei(en) gelöscht") + Else + _Logger.Warn($"⚠️ Temp-Ordner teilweise bereinigt: {deletedCount} gelöscht, {errorCount} Fehler") + End If + + Catch ex As Exception + _Logger.Error($"❌ Fehler beim Bereinigen des Temp-Ordners: {ex.Message}") + _Logger.Error(ex) + End Try + End Sub ''' ''' Verarbeitet einen Dokumentenpfad: Optional Mapping, dann Temp-Kopie ''' diff --git a/Base/My Project/AssemblyInfo.vb b/Base/My Project/AssemblyInfo.vb index de248c93..8f06e843 100644 --- a/Base/My Project/AssemblyInfo.vb +++ b/Base/My Project/AssemblyInfo.vb @@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices - - + + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' indem Sie "*" wie unten gezeigt eingeben: ' - - + + diff --git a/Patterns/My Project/AssemblyInfo.vb b/Patterns/My Project/AssemblyInfo.vb index 45d3546b..c32b1d87 100644 --- a/Patterns/My Project/AssemblyInfo.vb +++ b/Patterns/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Patterns/Patterns.vb b/Patterns/Patterns.vb index 859c27ff..d84179f9 100644 --- a/Patterns/Patterns.vb +++ b/Patterns/Patterns.vb @@ -20,6 +20,7 @@ Public Class ClassPatterns ' Complex patterns that rely on a datasource like a Database or Windream Public Const PATTERN_WMI = "WMI" Public Const PATTERN_CTRL = "CTRL" + Public Const PATTERN_TBCOL = "TBCOL" ' Simple patterns that only rely on .NET functions Public Const PATTERN_INT = "INT" ' Simple patterns that rely on Data from the TBDD_USER table @@ -63,8 +64,8 @@ Public Class ClassPatterns Private ReadOnly _LogConfig As LogConfig Private ReadOnly _Regex As Regex = New Regex("{#(\w+)#([\w\s_-]+)}+") - Private ReadOnly _AllPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_USER, PATTERN_INT, PATTERN_WMDOCID, PATTERN_IDBOBJID} - Private ReadOnly _ComplexPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL} + Private ReadOnly _AllPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_TBCOL, PATTERN_USER, PATTERN_INT, PATTERN_WMDOCID, PATTERN_IDBOBJID} + Private ReadOnly _ComplexPatterns As New List(Of String) From {PATTERN_WMI, PATTERN_CTRL, PATTERN_TBCOL} Private ReadOnly _SimplePatterns As New List(Of String) From {PATTERN_USER, PATTERN_INT} ''' diff --git a/ZooFlow/My Project/AssemblyInfo.vb b/ZooFlow/My Project/AssemblyInfo.vb index 3fafdade..6b3ad9fb 100644 --- a/ZooFlow/My Project/AssemblyInfo.vb +++ b/ZooFlow/My Project/AssemblyInfo.vb @@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/ZooFlow/State/SettingsState.vb b/ZooFlow/State/SettingsState.vb index 68a6f86a..fd89da8e 100644 --- a/ZooFlow/State/SettingsState.vb +++ b/ZooFlow/State/SettingsState.vb @@ -5,5 +5,6 @@ Public WM_SUFFIX As String = "\\WINDREAM\OBJECTS" Public MAP_SHAREDRIVE As String = "" Public MAP_BLACKLIST As String = "" + Public SavetoDrive As Boolean = False End Class End Namespace \ No newline at end of file