Check dropped files by hash instead of filename #GI-12
This commit is contained in:
@@ -144,8 +144,21 @@ Public Class ClassFilehandle
|
||||
Try
|
||||
filename = filename.Replace("'", "''")
|
||||
|
||||
Dim oHash As String
|
||||
|
||||
If File.Exists(filename) Then
|
||||
Try
|
||||
oHash = FILESYSTEM.GetChecksum(filename)
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
oHash = String.Empty
|
||||
End Try
|
||||
Else
|
||||
oHash = String.Empty
|
||||
End If
|
||||
|
||||
Dim filename_only As String = Path.GetFileName(filename)
|
||||
Dim ins As String = "INSERT INTO TBGI_FILES_USER (FILENAME2WORK, USER@WORK,HANDLE_TYPE,FILENAME_ONLY) VALUES ('" & filename & "','" & Environment.UserName & "','" & handleType & "','" & filename_only & "')"
|
||||
Dim ins As String = $"INSERT INTO TBGI_FILES_USER (FILENAME2WORK, USER@WORK, HANDLE_TYPE, FILENAME_ONLY, FILE_HASH) VALUES ('{filename}','{Environment.UserName}','{handleType}','{filename_only}', '{oHash}')"
|
||||
Return ClassDatabase.Execute_non_Query(ins, True)
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -157,7 +170,7 @@ Public Class ClassFilehandle
|
||||
' Prüft, ob die angegeben Datei aktuell durch eine
|
||||
' andere Anwendung in Benutzung ist
|
||||
Dim ff As Integer = FreeFile()
|
||||
If System.IO.File.Exists(fullFilePath) Then
|
||||
If File.Exists(fullFilePath) Then
|
||||
Try
|
||||
' Versuchen, die Datei mit *exklusiven* Lese- und
|
||||
' Schreibrechten zu öffnen
|
||||
|
||||
Reference in New Issue
Block a user