fix(core): Updates to serialization (#590)

- [X] Adds `AdhocPersistence` which replaces RunUO `Persistence`
- [X] Fixes a few minor bugs with EntityPersistence deserialization
- [X] Reverts/updates some serialization changes
This commit is contained in:
Kamron Batman 2021-05-09 00:10:39 -07:00 • committed by GitHub
parent f0969223f7
commit 6e9477ea13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 370 additions and 248 deletions

View file

@ -172,7 +172,6 @@ namespace System.Buffers
var remaining = Remaining;
int size;
if (isFixedLength)
{
size = fixedLength * sizeT;
@ -183,13 +182,14 @@ namespace System.Buffers
}
else
{
// In case the remaining is not evenly divisible
size = remaining - (remaining & (sizeT - 1));
int index = _buffer.Slice(Position, size).IndexOfTerminator(sizeT);
size = index < 0 ? size : index;
}
int index = _buffer.Slice(Position, size).IndexOfTerminator(sizeT);
var span = _buffer.Slice(Position, index < 0 ? size : index);
Position += isFixedLength || index < 0 ? size : index + sizeT;
var span = _buffer.Slice(Position, size);
Position += size;
return TextEncoding.GetString(span, encoding, safeString);
}