public override async Task PopulateAsync() { using (var stream = new MinecraftStream(this.PacketData)) { var secretLength = await stream.ReadVarIntAsync(); this.SharedSecret = await stream.ReadUInt8ArrayAsync(secretLength); var tokenLength = await stream.ReadVarIntAsync(); this.VerifyToken = await stream.ReadUInt8ArrayAsync(tokenLength); } }
public override async Task PopulateAsync() { using (var stream = new MinecraftStream(this.PacketData)) { this.ServerId = await stream.ReadStringAsync() ?? string.Empty; var keyLength = await stream.ReadVarIntAsync(); this.PublicKey = await stream.ReadUInt8ArrayAsync(keyLength); var tokenLength = await stream.ReadVarIntAsync(); this.VerifyToken = await stream.ReadUInt8ArrayAsync(tokenLength); } }
public async Task ReadAsync(MinecraftStream stream) { this.Channel = await stream.ReadStringAsync(); var length = stream.Length - stream.Position; this.PluginData = await stream.ReadUInt8ArrayAsync((int)length); }
public static async Task <Packet> ReadCompressedPacketAsync(MinecraftStream stream) { var packetLength = await stream.ReadVarIntAsync(); var dataLength = await stream.ReadVarIntAsync(); using var deStream = new MinecraftStream(new ZlibStream(stream, SharpCompress.Compressors.CompressionMode.Decompress, CompressionLevel.BestSpeed)); var packetId = await deStream.ReadVarIntAsync(); var packetData = await deStream.ReadUInt8ArrayAsync(dataLength - packetId.GetVarIntLength()); return(new Packet(packetId, packetData)); }
public async Task ReadAsync(MinecraftStream stream) { this.Channel = await stream.ReadStringAsync(); this.PluginData = await stream.ReadUInt8ArrayAsync(); }