P
programmervb.net
Guest
how use the function array of bytes
Private Function ByteSearch(ByVal searchIn As Byte(), ByVal searchBytes As Byte(), Optional ByVal start As Integer = 0) As Integer
Dim found As Integer = -1
Dim matched As Boolean = False
If searchIn.Length > 0 AndAlso searchBytes.Length > 0 AndAlso start <= (searchIn.Length - searchBytes.Length) AndAlso searchIn.Length >= searchBytes.Length Then
For i As Integer = start To searchIn.Length - searchBytes.Length
If searchIn(i) = searchBytes(0) Then
If searchIn.Length > 1 Then
matched = True
For y As Integer = 1 To searchBytes.Length - 1
If searchIn(i + y) <> searchBytes
Then
matched = False
Exit For
End If
Next
If matched Then
found = i
Exit For
End If
Else
found = i
Exit For
End If
End If
Next
End If
Return found
End Function
Continue reading...
Private Function ByteSearch(ByVal searchIn As Byte(), ByVal searchBytes As Byte(), Optional ByVal start As Integer = 0) As Integer
Dim found As Integer = -1
Dim matched As Boolean = False
If searchIn.Length > 0 AndAlso searchBytes.Length > 0 AndAlso start <= (searchIn.Length - searchBytes.Length) AndAlso searchIn.Length >= searchBytes.Length Then
For i As Integer = start To searchIn.Length - searchBytes.Length
If searchIn(i) = searchBytes(0) Then
If searchIn.Length > 1 Then
matched = True
For y As Integer = 1 To searchBytes.Length - 1
If searchIn(i + y) <> searchBytes

matched = False
Exit For
End If
Next
If matched Then
found = i
Exit For
End If
Else
found = i
Exit For
End If
End If
Next
End If
Return found
End Function
Continue reading...