Guest User

Untitled

a guest
May 18th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.20 KB | None | 0 0
  1. Public Function read_Metadata()
  2.         Dim x As Byte = frmMain.buffer(0)
  3.         Dim last As Integer = 0
  4.         Clear_Bytes(1)
  5.         While x <> 127
  6.             Dim index As Byte = x << 3
  7.             Dim type As Byte = x >> 5
  8.             Select Case type
  9.                 Case 0
  10.                     Clear_Bytes(1)
  11.                 Case 1
  12.                     Clear_Bytes(2)
  13.                 Case 2
  14.                     Clear_Bytes(4)
  15.                 Case 3
  16.                     Clear_Bytes(4)
  17.                 Case 4
  18.                     'Handle string
  19.                     Dim lenbytes(1) As Byte
  20.                     Array.Copy(frmMain.buffer, lenbytes, 2)
  21.                     Array.Reverse(lenbytes)
  22.                     Clear_Bytes(2)
  23.                     Clear_Bytes(BitConverter.ToInt16(lenbytes, 0) * 2)
  24.                 Case 5
  25.                     Clear_Bytes(5)
  26.                 Case 6
  27.                     Clear_Bytes(12)
  28.                 Case 7
  29.                     Stop
  30.  
  31.             End Select
  32.             last = type
  33.             x = frmMain.buffer(0)
  34.         End While
  35.         If frmMain.buffer(0) = 127 Then
  36.             Clear_Bytes(1)
  37.         End If
  38.         Return Nothing
  39.     End Function
Add Comment
Please, Sign In to add comment