Anyone have a Working Packetbuffer class.. i can't seem to get a old vb6 one working in vb.net
Or just a little help on what i need to convert, and maybe i can figure it out after a little bit of work ^_^
Thanks again
- BaDDBLooD
Quote from: BaDDBLooD on June 17, 2004, 10:58 PM
Anyone have a Working Packetbuffer class.. i can't seem to get a old vb6 one working in vb.net
Or just a little help on what i need to convert, and maybe i can figure it out after a little bit of work ^_^
Thanks again
- BaDDBLooD
Translate the class here to VB .NET:
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=4150;start=msg34300#msg34300
how :O
Maybe by learning VB.NET? ;)
.. i am still learning .net Commands =\
Quote from: BaDDBLooD on June 18, 2004, 08:29 AM
.. i am still learning .net Commands =\
Your VB .NET compiler command is:
vbc <arguments> <file-name>
what does that have to do with converting the class?
Quote from: BaDDBLooD on June 18, 2004, 07:16 PM
what does that have to do with converting the class?
Absoultely nothing. You said that you were still learning .net commands. That's one of the basic ones. -_-
haha well
How would i go about Converting a vb packetbuffer, for convienence let's say Dark Minion.
What things am i going to need to convert
K, this is where i am ( Thanks to a Cooperative effort of me and my friend )
Imports System
Imports System.Collections
Imports System.Text
Namespace BaDDChaT
Enum Medium
BNLS
BattleNet
Realm
End Enum
Friend MustInherit Class Packet
Protected alBuffer As ArrayList
Protected m_packetId As Byte
Protected m_medium As Medium
Private Sub New()
Me.alBuffer = New ArrayList(3)
End Sub
Protected Sub New(ByVal PacketID As Byte, ByVal ServerType As Medium)
m_packetId = PacketID
m_medium = ServerType
End Sub
Public ReadOnly Property ServerType() As Medium
Get
Return m_medium
End Get
End Property
Public ReadOnly Property PacketID() As Byte
Get
Return m_packetId
End Get
End Property
Public Overridable Sub InsertDWORDArray(ByVal DWORDList() As Integer)
Dim i As Integer
For Each i In DWORDList
InsertDWORD(i)
Next i
End Sub
Public Overridable Sub InsertDWORD(ByVal DWORD As Integer)
InsertBYTEArray(BitConverter.GetBytes(DWORD))
End Sub
Public Overridable Sub InsertWORD(ByVal WORD As Short)
InsertBYTEArray(BitConverter.GetBytes(WORD))
End Sub
Public Overridable Sub InsertWORDArray(ByVal WORDList() As Short)
Dim s As Short
For Each s In WORDList
InsertWORD(s)
Next s
End Sub
Public Overridable Sub InsertBYTE(ByVal [BYTE] As Byte)
Me.alBuffer.Add([BYTE])
End Sub
Public Overridable Sub InsertBYTEArray(ByVal BYTEList() As Byte)
Dim b As Byte
For Each b In BYTEList
InsertBYTE(b)
Next b
End Sub
Public Overridable Sub InsertNTString(ByVal str As String)
InsertBYTEArray(Encoding.ASCII.GetBytes(str))
If CByte(Me.alBuffer((Me.alBuffer.Count - 1))) <> &HB Then
InsertBYTE(0)
End If
End Sub
Public Overridable Sub InsertNonNTString(ByVal str As String)
Dim car(str.Length) As Char
Dim i As Integer
For i = 0 To str.Length - 1
car(i) = i.ToString
Next i
InsertBYTEArray(Encoding.ASCII.GetBytes(car))
End Sub
Public Sub Clear()
Me.alBuffer.Clear()
End Sub
Friend NotInheritable Class BNLSPacket
Inherits Packet
Public Sub New(ByVal PacketID As Byte)
MyBase.New(PacketID, Medium.BNLS)
End Sub
Public ReadOnly Property Length() As Short
Get
Return CShort(Me.alBuffer.Count + 3)
End Get
End Property
Public ReadOnly Property Data() As Byte()
Get
Return Me.ToSend()
End Get
End Property
Private Function ToSend() As Byte()
Dim al As New ArrayList(Me.alBuffer)
al.InsertRange(0, BitConverter.GetBytes(Me.Length))
al.Insert(2, Me.PacketID)
Dim data(al.Count) As Byte
al.CopyTo(0, data, 0, al.Count)
Return data
End Function
Public Overrides Sub InsertNonNTString(ByVal str As String)
Dim car(str.Length) As Char
Dim i As Integer
For i = 0 To str.Length - 1
car(i) = i.ToString
Next i
InsertBYTEArray(Encoding.ASCII.GetBytes(car))
End Sub
Public Overrides Sub InsertNTString(ByVal str As String)
InsertBYTEArray(Encoding.ASCII.GetBytes(str))
If CByte(Me.alBuffer((Me.alBuffer.Count - 1))) <> &H0 Then
InsertBYTE(0)
End If
End Sub
End Class
Friend NotInheritable Class BnetPacket
Inherits Packet
Public Sub New(ByVal PacketID As Byte)
MyBase.New(PacketID, Medium.BattleNet)
End Sub
Public ReadOnly Property Data() As Byte()
Get
Return Me.ToSend()
End Get
End Property
Public ReadOnly Property Length() As Short
Get
Return CShort(Me.alBuffer.Count + 4)
End Get
End Property
Private Function ToSend() As Byte()
Dim al As New ArrayList(Me.alBuffer)
al.Insert(0, CByte(&HFF))
al.Insert(1, Me.PacketID)
al.InsertRange(2, BitConverter.GetBytes(Me.Length))
Dim data(al.Count) As Byte
al.CopyTo(0, data, 0, al.Count)
Return data
End Function
Public Overrides Sub InsertNTString(ByVal str As String)
InsertBYTEArray(Encoding.UTF8.GetBytes(str))
If CByte(Me.alBuffer((Me.alBuffer.Count - 1))) <> &H0 Then
InsertBYTE(0)
End If
End Sub
Public Overrides Sub InsertNonNTString(ByVal str As String)
Dim car(str.Length) As Char
InsertBYTEArray(Encoding.UTF8.GetBytes(car))
End Sub
End Class
End Namespace
Where is "writepacket" ??
Almost three topics down .. this (http://forum.valhallalegends.com/phpbbs/index.php?board=37;action=display;threadid=6860)? :/
Quote from: Newby on June 25, 2004, 02:34 PM
Almost three topics down .. this (http://forum.valhallalegends.com/phpbbs/index.php?board=37;action=display;threadid=6860)? :/
If you try that, you'll realize it doesn't work.