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