Check dropped files by hash instead of filename #GI-12

This commit is contained in:
Jonathan Jenne
2021-05-03 10:30:38 +02:00
parent 7a15ef9895
commit f39b79e13c
6 changed files with 142 additions and 80 deletions

View File

@@ -160,19 +160,35 @@ Public Class frmStart
Sub Check_Dropped_Files()
Try
ClassDatabase.Execute_non_Query("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')")
Dim i As Integer
For Each Str As Object In ClassFileDrop.files_dropped
If Not Str Is Nothing Then
LOGGER.Info(">> Check Drop-File: " & Str.ToString)
Dim handleType As String = Str.Substring(0, Str.LastIndexOf("|") + 1)
Dim filename As String = Str.Substring(Str.LastIndexOf("|") + 1)
If ClassIndexFunctions.FileExistsinDropTable(filename) = False Then
ClassFilehandle.Decide_FileHandle(filename, handleType)
i += 1
Else
' Console.WriteLine("File gibt es bereits")
End If
Dim oIndex As Integer
For Each oFiledropString As String In ClassFileDrop.files_dropped
If oFiledropString IsNot Nothing Then
LOGGER.Info(">> Check Drop-File: " & oFiledropString.ToString)
Dim oLastPipe = oFiledropString.LastIndexOf("|")
Dim oHandleType As String = oFiledropString.Substring(0, oLastPipe + 1)
Dim oFilename As String = oFiledropString.Substring(oLastPipe + 1)
Dim oFileExists As Boolean = ClassIndexFunctions.FileExistsinDropTable(oFilename)
If oFileExists = False Then
ClassFilehandle.Decide_FileHandle(oFilename, oHandleType)
oIndex += 1
ElseIf oFileExists Then
Dim oResult As DialogResult
If USER_LANGUAGE = "de-DE" Then
oResult = MsgBox("Die Datei wurde bereits verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
Else
oResult = MsgBox("This file has already been processed. Do you want to process the same file again?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, Text)
End If
If oResult = DialogResult.Yes Then
ClassFilehandle.Decide_FileHandle(oFilename, oHandleType)
oIndex += 1
End If
Else
End If
End If
Next
@@ -200,6 +216,8 @@ Public Class frmStart
CURRENT_FILENAME = Filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_GUID = Filerow.Item(0)
CURRENT_WORKFILE = Filerow.Item("FILENAME2WORK")
CURRENT_WORKFILE_HASH = Filerow.Item("FILE_HASH")
LOGGER.Info(">> CURRENT_WORKFILE: " & CURRENT_WORKFILE)
If File.Exists(CURRENT_WORKFILE) = True And DTACTUAL_FILES.Rows.Count > 0 Then
Open_IndexDialog()