fix(core): Fixes OPL packets (#395)

- [X] Fixes an issue with OPL packets using the wrong endianness and not updating the position properly.
- [X] Fixes an issue with SpanWriter not updating bytes written when it is used adhoc.
- [X] Moves packet creation for OPL inside the SendInfoTo function.

Bumps release version
This commit is contained in:
Kamron Batman 2021-01-08 23:55:23 -08:00 • committed by GitHub
parent 1a593089e9
commit 5882b1ab3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 10 deletions

View file

@ -117,19 +117,19 @@ namespace Server
AddHash(arguments.GetHashCode(StringComparison.Ordinal));
}
int strLength = Utility.Unicode.GetByteCount(arguments);
int strLength = arguments.Length * 2;
int length = _position + 6 + strLength;
while (length > _buffer.Length)
{
Flush();
}
var writer = new SpanWriter(_buffer);
writer.Seek(_position, SeekOrigin.Begin);
var writer = new SpanWriter(_buffer.AsSpan(_position));
writer.Write(number);
writer.Write((ushort)strLength);
writer.WriteBigUni(arguments);
writer.WriteLittleUni(arguments);
_position += writer.BytesWritten;
}
public void Add(int number, string format, object arg0)