Duplicate files message box with top most, only hash filename for msg files directly from outlook

This commit is contained in:
Jonathan Jenne
2021-07-07 10:59:23 +02:00
parent 47a66e1220
commit 82be34b28e
6 changed files with 35 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
Imports System.IO
Public Class ClassIndexFunctions
Public Shared Function FileExistsinDropTable(pFilename As String) As Date
Public Shared Function FileExistsinDropTable(pFilename As String, pHandleType As String) As Date
Dim oSQL As String
Dim oHash As String
@@ -10,7 +10,7 @@ Public Class ClassIndexFunctions
pFilename = pFilename.Replace("'", "''")
End If
If pFilename.ToUpper.EndsWith(".MSG") Then
If pFilename.ToUpper.EndsWith(".MSG") And pHandleType = "|OUTLOOK_MESSAGE|" Then
' MSG Files cannot be hashed based on filecontents, so we use the filename instead
oHash = FILESYSTEM.GetChecksumFromString(pFilename)
Else
@@ -55,25 +55,27 @@ Public Class ClassIndexFunctions
End Try
End Function
Public Shared Function CheckDuplicateFiles(Filepath As String, ModuleTitle As String)
Dim oFileInfo As New FileInfo(Filepath)
Public Shared Function CheckDuplicateFiles(pFilepath As String, pModuleTitle As String, Optional pHandleType As String = "")
Dim oFileInfo As New FileInfo(pFilepath)
Dim oFilename As String = oFileInfo.Name
Dim oFileExists As Date = FileExistsinDropTable(Filepath)
Dim oFileExists As Date = FileExistsinDropTable(pFilepath, pHandleType)
If oFileExists.Equals(Date.MinValue) Then
Return True
Else
Dim oResult As DialogResult
Dim oDate As String = oFileExists.ToString("d")
Dim oBoxTitle = $"GLOBIX - {ModuleTitle}"
Dim oBoxOptions = MsgBoxStyle.Question Or MsgBoxStyle.YesNo
Dim oBoxTitle = $"GLOBIX - {pModuleTitle}"
Dim oMessage As String
If USER_LANGUAGE = "de-DE" Then
oResult = MsgBox($"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?", oBoxOptions, oBoxTitle)
oMessage = $"Die Datei [{oFilename}] wurde bereits am [{oDate}] verarbeitet. Wollen Sie die gleiche Datei noch einmal verarbeiten?"
Else
oResult = MsgBox($"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?", oBoxOptions, oBoxTitle)
oMessage = $"The file [{oFilename}] has already been processed at [{oDate}]. Do you want to process the same file again?"
End If
oResult = MessageBox.Show(oMessage, oBoxTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)
If oResult = DialogResult.Yes Then
Return True
End If