VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsPacketReader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public buffer As String, offset As Long

Public Sub Skip(ByRef bytes As Long)
    offset = offset + bytes
End Sub

Public Function GetByte() As Byte
    GetByte = Asc(Mid$(buffer, offset, 1))
    Skip 1
End Function

Public Function GetInt16() As Integer
    GetInt16 = ExtractInt16(Mid$(buffer, offset, 2))
    Skip 2
End Function

Public Function GetInt32() As Long
    GetInt32 = ExtractInt32(Mid$(buffer, offset, 4))
    Skip 4
End Function

Public Function GetInt64() As Currency
    GetInt64 = ExtractInt32(Mid$(buffer, offset, 8))
    Skip 8
End Function

Public Function GetFixedString(ByRef size As Long) As String
    GetFixedString = Mid$(buffer, offset, size)
    Skip size
End Function

Public Function GetCString() As String
    GetCString = Split(Mid$(buffer, offset), vbNullChar)(0)
    Skip Len(GetCString) + 1
End Function
