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

@ -53,7 +53,6 @@ namespace Server
void Deserialize(string savePath)
{
var path = Path.Combine(savePath, name);
AssemblyHandler.EnsureDirectory(path);
string binPath = Path.Combine(path, $"{name}.bin");
@ -65,10 +64,9 @@ namespace Server
try
{
using FileStream bin = new FileStream(binPath, FileMode.Open, FileAccess.Read, FileShare.Read);
var buffer = GC.AllocateUninitializedArray<byte>((int)bin.Length);
bin.Read(buffer);
deserializer(new BufferReader(buffer));
using FileStream fs = new FileStream(binPath, FileMode.Open, FileAccess.Read, FileShare.Read);
using var br = new BinaryFileReader(fs);
deserializer(br);
}
catch (Exception e)
{