mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Pass correct length to DecodeImpl
This commit is contained in:
parent
bf4fc7864f
commit
327ebf3bb3
2 changed files with 3 additions and 5 deletions
|
|
@ -208,7 +208,7 @@ public abstract partial class Payload
|
|||
}
|
||||
|
||||
payload ??= new RawPayload((byte)chunkType);
|
||||
payload.DecodeImpl(reader, reader.BaseStream.Position + chunkLen - 1);
|
||||
payload.DecodeImpl(reader, reader.BaseStream.Position + chunkLen);
|
||||
|
||||
// read through the rest of the packet
|
||||
var readBytes = (uint)(reader.BaseStream.Position - packetStart);
|
||||
|
|
|
|||
|
|
@ -95,14 +95,12 @@ public class RawPayload : Payload
|
|||
/// <inheritdoc/>
|
||||
protected override byte[] EncodeImpl()
|
||||
{
|
||||
var chunkLen = this.data.Length + 1;
|
||||
|
||||
var bytes = new List<byte>()
|
||||
{
|
||||
START_BYTE,
|
||||
this.chunkType,
|
||||
(byte)chunkLen,
|
||||
};
|
||||
bytes.AddRange(MakeInteger((uint)this.data.Length)); // chunkLen
|
||||
bytes.AddRange(this.data);
|
||||
|
||||
bytes.Add(END_BYTE);
|
||||
|
|
@ -113,6 +111,6 @@ public class RawPayload : Payload
|
|||
/// <inheritdoc/>
|
||||
protected override void DecodeImpl(BinaryReader reader, long endOfStream)
|
||||
{
|
||||
this.data = reader.ReadBytes((int)(endOfStream - reader.BaseStream.Position + 1));
|
||||
this.data = reader.ReadBytes((int)(endOfStream - reader.BaseStream.Position));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue