From 09f1684d81102e77531cad9af4b1f74b387b9f74 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 16 Feb 2022 16:02:59 +0100 Subject: [PATCH] clean up files properly --- Global_Indexer/ClassFileHandler.vb | 13 +++++++++++++ Global_Indexer/frmStart.vb | 15 ++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Global_Indexer/ClassFileHandler.vb b/Global_Indexer/ClassFileHandler.vb index 90baa54..d071203 100644 --- a/Global_Indexer/ClassFileHandler.vb +++ b/Global_Indexer/ClassFileHandler.vb @@ -42,6 +42,19 @@ Public Class ClassFileHandler End Try End Function + Public Sub Clear_Tempfiles() + For Each oFile In TempFiles + Try + System.IO.File.Delete(oFile) + Catch ex As Exception + Logger.Error(ex) + End Try + Next + + TempFiles.Clear() + End Sub + + Public Function Decide_FileHandle(pFilepath As String, pHandletype As String) As Boolean Try ''TODO: Before doing anything, clean the filename diff --git a/Global_Indexer/frmStart.vb b/Global_Indexer/frmStart.vb index 923e763..570cf1e 100644 --- a/Global_Indexer/frmStart.vb +++ b/Global_Indexer/frmStart.vb @@ -269,7 +269,7 @@ Public Class frmStart If IO.File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then Open_IndexDialog() Else - Throw New FileNotFoundException("Dropped file does not exist anymore!") + LOGGER.Warn("Trying to index non-existent file [{0}]", CURRENT_WORKFILE) End If ' If multi-indexing is active, all files have been indexed by now, so we can leave the loop @@ -285,7 +285,7 @@ Public Class frmStart Finally ' Clear all temp files after indexing - Clear_Tempfiles() + FILE_HANDLER.Clear_Tempfiles() EMAIL.Clear_TempFiles() FileDrop.RemoveTempDirectory() @@ -565,17 +565,6 @@ Public Class frmStart End Sub #End Region - Private Sub Clear_Tempfiles() - 'TempDateien löschen - For Each oFile In FILE_HANDLER.TempFiles - Try - System.IO.File.Delete(oFile) - Catch ex As Exception - LOGGER.Error(ex) - End Try - Next - End Sub - Sub Open_IndexDialog() Try Hide()