Code Select
Public m_PacketLengths() As Variant
m_PacketLengths = Array(&H1, &H8, &H1, &HC, &H1, &H1, &H1, &H6, &H6, &HB, &H6, &H6, &H9, &HD, &HC, &H10, _
&H10, &H8, &H1A, &HE, &H12, &HB, &H0, &H0, &HF, &H2, &H2, &H3, &H5, &H3, &H4, &H6, _
&HA, &HC, &HC, &HD, &H5A, &H5A, &H0, &H28, &H67, &H61, &HF, &H0, &H8, &H0, &H0, _
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H22, _
&H8, &HD, &H0, &H6, &H0, &H0, &HD, &H0, &HB, &HB, &H0, &H0, &H0, &H10, &H11, _
&H7, &H1, &HF, &HE, &H2A, &HA, &H3, &H0, &H0, &HE, &H7, &H1A, &H28, &H0, _
&H5, &H6, &H26, &H5, &H7, &H2, &H7, &H15, &H0, &H7, &H7, &H10, &H15, &HC, _
&HC, &H10, &H10, &HA, &H1, &H1, &H1, &H1, &H1, &H20, &HA, &HD, &H6, &H2, _
&H15, &H6, &HD, &H8, &H6, &H12, &H5, &HA, &H4, &H14, &H1D, &H0, &H0, &H0, _
&H0, &H0, &H0, &H2, &H6, &H6, &HB, &H7, &HA, &H21, &HD, &H1A, &H6, &H8, &H0, _
&HD, &H9, &H1, &H7, &H10, &H11, &H7, &H0, &H0, &H7, &H8, &HA, &H7, &H8, &H18, _
&H3, &H8, &H0, &H7, &H0, &H7, &H0, &H7, &H0, &H0, &H0, &H0, &H1)
Public Function GetSize(ByVal id As Byte, ByVal Data As String) As Integer
Dim interimVal As Integer
If id > 179 Then
GetSize = -2: Exit Function
End If
interimVal = m_PacketLengths(id)
If interimVal = 0 Then
Select Case id
Case &H9C
GetSize = Asc(Mid$(Data, 3, 1)): Exit Function
Case &H9D
GetSize = Asc(Mid$(Data, 3, 1)): Exit Function
Case &H5B
GetSize = Asc(Mid$(Data, 2, 1)): Exit Function
Case &HA8
GetSize = Asc(Mid$(Data, 7, 1)): Exit Function
Case &HAA
GetSize = Asc(Mid$(Data, 7, 1)): Exit Function
Case &HAC
GetSize = Asc(Mid$(Data, 13, 1)): Exit Function
Case &HAE
GetSize = GetDWORD2(Mid(data, 2, 2)) + 3: Exit Function
Case &H26
p_data = Mid$(Data, 2)
GetSize = Parsechat: Exit Function
Case &H94
GetSize = 6 + (Asc(Mid$(Data, 1, 1)) * 3): Exit Function
End Select
End If
GetSize = interimVal: Exit Function
End Function