VB/VB.Net Problème connection HelloConnectMessage

Inscrit
17 Avril 2015
Messages
119
Reactions
0
#23
Je testerais que je rentre alors merci encore.
 
Inscrit
17 Avril 2015
Messages
119
Reactions
0
#24
Je pense que cela viens de mon reader qui est t
Code:
Imports System.IO

Namespace IO
    Public Class DataReader
        Inherits BinaryReader

#Region "New"
        Sub New(ByVal input As Stream)
            MyBase.New(input)
        End Sub

        Sub New(ByVal input As Stream, ByVal encoding As System.Text.Encoding)
            MyBase.New(input, encoding)
        End Sub
#End Region

#Region "Function"
        Public Function readUnsignedByte()
            Return ReadByte()
        End Function
        Public Overrides Function ReadByte() As Byte
            Return MyBase.ReadByte()
        End Function

        Public Function readVarInt()
            Return ReadUInt16()
        End Function

        Public Overrides Function ReadUInt16() As UShort
            Return (CUShort(ReadByte()) << 8) + ReadByte()
        End Function

        Public Overrides Function ReadBoolean() As Boolean
            Return ReadByte() = 1
        End Function

        Public Function ReadShort()
            Return ReadInt16()
        End Function

        Public Overrides Function ReadInt16() As Short
            Dim Value As UShort = ReadUInt16()
            If Value > Short.MaxValue Then
                Dim Value2 As Short = -(UShort.MaxValue - Value) - 1
                Return Value2
            End If
            Return Value
        End Function

        Public Function ReadInt()
            Return ReadInt32()
        End Function

        Public Overrides Function ReadInt32() As Integer
            Dim Value As UInteger = ReadUInt32()
            If Value > Integer.MaxValue Then
                Dim Value2 As Integer = -(UInteger.MaxValue - Value) - 1
                Return Value2
            End If
            Return Value
        End Function

        Public Overrides Function ReadUInt32() As UInteger
            Return (CUInt(ReadByte()) << 24) + (CUInt(ReadByte()) << 16) + (CUInt(ReadByte()) << 8) + ReadByte()
        End Function

        Public Overrides Function ReadDouble() As Double
            Dim Bytes() As Byte = ReadBytes(8)
            Array.Reverse(Bytes)
            Return BitConverter.ToDouble(Bytes, 0)
        End Function

        Public Function ReadUTF()
            Return ReadString()
        End Function

        Public Overrides Function ReadString() As String
            Dim ByteArray() As Byte = MyBase.ReadBytes(ReadUInt16())
            Return System.Text.Encoding.UTF8.GetString(ByteArray)
        End Function
#End Region

    End Class
End Namespace
rop ancien, je vous le montre si je me souvient bien je l'avais pris du Forum. Le jeu ne dois plus fonctionner comme sa.
 
Inscrit
18 Février 2015
Messages
228
Reactions
7
#25
Je pense que cela viens de mon reader qui est t
Code:
#Region "Function"


        Public Function readVarInt()
            Return ReadUInt16()
        End Function


    End Class
End Namespace
rop ancien, je vous le montre si je me souvient bien je l'avais pris du Forum. Le jeu ne dois plus fonctionner comme sa.
c'est pas bon ce que tu as fait là le VarInt est une fonction qu'ils ont créé eux même ^^"


Code:
        private static int CHUNCK_BIT_SIZE = 7;
        private static int MASK_10000000 = 128;

        private static int MASK_01111111 = 127;


public int ReadVarInt()
        {
            int b = 0;
            int value = 0;
            int offset = 0;
            bool hasNext = false;
            while (offset < INT_SIZE)
            {
                b = ReadByte();
                hasNext = (b & MASK_10000000) == MASK_10000000;
                if (offset > 0)
                {
                    value = value + ((b & MASK_01111111) << offset);
                }
                else
                {
                    value = value + (b & MASK_01111111);
                }
                offset = offset + CHUNCK_BIT_SIZE;
                if (!hasNext)
                {
                    return value;
                }
            }
            throw new Exception("Too much data");
        }
ça c'est mon code en C# pour mon émulateur 2.34
tu n'a pus qu'à le traduire en VB
pour ce coup je m'y connais très peu en VB :/
 
Inscrit
17 Avril 2015
Messages
119
Reactions
0
#26
Ok merci je m'étais complètement tromper alors, merci pour tout !
 
Haut Bas