FileExists in DropTable: generate hash from filename for msg files
This commit is contained in:
parent
a0c725163a
commit
5c44668002
@ -1,21 +1,26 @@
|
|||||||
Imports System.IO
|
Imports System.IO
|
||||||
|
|
||||||
Public Class ClassIndexFunctions
|
Public Class ClassIndexFunctions
|
||||||
Public Shared Function FileExistsinDropTable(Filename As String) As Date
|
Public Shared Function FileExistsinDropTable(pFilename As String) As Date
|
||||||
Dim oSQL As String
|
Dim oSQL As String
|
||||||
Dim oHash As String
|
Dim oHash As String
|
||||||
|
|
||||||
Try
|
Try
|
||||||
If Filename.Contains("'") Then
|
If pFilename.Contains("'") Then
|
||||||
Filename = Filename.Replace("'", "''")
|
pFilename = pFilename.Replace("'", "''")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' If file cannot be accessed, checksum cannot be generated
|
If pFilename.ToUpper.EndsWith(".MSG") Then
|
||||||
' In this case, the file should be treated as not yet existing
|
' MSG Files cannot be hashed based on filecontents, so we use the filename instead
|
||||||
oHash = FILESYSTEM.GetChecksum(Filename)
|
oHash = FILESYSTEM.GetChecksumFromString(pFilename)
|
||||||
|
Else
|
||||||
|
' If file cannot be accessed, checksum cannot be generated
|
||||||
|
' In this case, the file should be treated as not yet existing
|
||||||
|
oHash = FILESYSTEM.GetChecksum(pFilename)
|
||||||
|
End If
|
||||||
|
|
||||||
If oHash Is Nothing Then
|
If oHash Is Nothing Then
|
||||||
LOGGER.Warn("Checksum for file {0} could not be generated. Treating as new file.", Filename)
|
LOGGER.Warn("Checksum for file {0} could not be generated. Treating as new file.", pFilename)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user