
API in VB dot NET
158
Case 0
output.Add(o)
If o.Substring(0, 5) = "!done" Then
Exit While
Else
o = ""
Continue While
End If
Case Is < &H80
count = tmp(3)
Case Is < &HC0
count = BitConverter.ToInt32(New Byte() {tcpStream.ReadByte(), tmp(3), 0, 0}, 0) ^ &H8000
Case Is < &HE0
tmp(2) = tcpStream.ReadByte()
count = BitConverter.ToInt32(New Byte() {tcpStream.ReadByte(), tmp(2), tmp(3), 0}, 0) ^ &HC00000
Case Is < &HF0
tmp(2) = tcpStream.ReadByte()
tmp(1) = tcpStream.ReadByte()
count = BitConverter.ToInt32(New Byte() {tcpStream.ReadByte(), tmp(1), tmp(2), tmp(3)}, 0) ^ &HE0000000
Case &HF0
tmp(3) = tcpStream.ReadByte()
tmp(2) = tcpStream.ReadByte()
tmp(1) = tcpStream.ReadByte()
tmp(0) = tcpStream.ReadByte()
count = BitConverter.ToInt32(tmp, 0)
Case Else
Exit While 'err
End Select
For i = 0 To count - 1
o += ChrW(tcpStream.ReadByte())
Next
End While
Return output
End Function
Function EncodeLength(ByVal l As Integer) As Byte()
If l < &H80 Then
Dim tmp = BitConverter.GetBytes(l)
Return New Byte() {tmp(0)}
ElseIf l < &H4000 Then
Dim tmp = BitConverter.GetBytes(l Or &H8000)
Return New Byte() {tmp(1), tmp(0)}
ElseIf l < &H200000 Then
Dim tmp = BitConverter.GetBytes(l Or &HC00000)
Return New Byte() {tmp(2), tmp(1), tmp(0)}
ElseIf l < &H10000000 Then
Commenti su questo manuale