This little function compares two files byte for byte and returns true if they are equal.
Public Shared Function Compare(ByVal aFilename1 As String, ByVal aFilename2 As String) As Boolean Dim fs1 As New System.IO.FileStream(aFilename1, IO.FileMode.Open, IO.FileAccess.Read) Dim fs2 As New System.IO.FileStream(aFilename1, IO.FileMode.Open, IO.FileAccess.Read) If fs1.Length <> fs2.Length Then Return False End If For i As Integer = 0 To fs1.Length - 1 Step i + 1 If fs1.ReadByte <> fs2.ReadByte Then Return False End If Next fs1.Close() fs2.Close() Return True End Function
0 Antworten zu VB .NET: Binary compare files