Filesystem: Catch exceptions while generating checksums
This commit is contained in:
parent
49ec173c36
commit
828063447e
@ -73,12 +73,19 @@ Public Class File
|
||||
End Function
|
||||
|
||||
Public Function GetChecksum(FilePath As String) As String
|
||||
Using oFileStream = IO.File.OpenRead(FilePath)
|
||||
Using oStream As New BufferedStream(oFileStream, 1200000)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oStream)
|
||||
Return BitConverter.ToString(oChecksum).Replace("-", String.Empty)
|
||||
Try
|
||||
Using oFileStream = IO.File.OpenRead(FilePath)
|
||||
Using oStream As New BufferedStream(oFileStream, 1200000)
|
||||
Dim oChecksum() As Byte = SHA256.Create.ComputeHash(oStream)
|
||||
Return BitConverter.
|
||||
ToString(oChecksum).
|
||||
Replace("-", String.Empty)
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user