Beispiel #1
0
        internal string ReadStr()
        {
            var varInt = new VarInt(Bytes, Cursor);

            if (varInt.Value == 0)
            {
                Cursor += 1;
                return("");
            }
            var characters = new byte[varInt.Value];

            Array.Copy(Bytes, Cursor, characters, 0, characters.Length);
            Cursor += varInt.SizeInBytes;
            return(Encoding.UTF8.GetString(characters, 0, characters.Length));
        }
Beispiel #2
0
 internal ulong ReadVarInt()
 {
     var varint = new VarInt(Bytes, Cursor);
     Cursor += varint.SizeInBytes;
     return varint.Value;
 }
Beispiel #3
0
 internal string ReadStr()
 {
     var varInt = new VarInt(Bytes, Cursor);
     if (varInt.Value == 0)
     {
         Cursor += 1;
         return "";
     }
     var characters = new byte[varInt.Value];
     Array.Copy(Bytes, Cursor, characters, 0, characters.Length);
     Cursor += varInt.SizeInBytes;
     return Encoding.UTF8.GetString(characters, 0, characters.Length);
 }