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

@ -14,13 +14,11 @@
*************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Runtime.CompilerServices;
using System.Text;
using Server.Network;
using Server.Text;
namespace Server
@ -387,35 +385,6 @@ namespace Server
Write((byte)(value?.RaceIndex ?? 0xFF));
}
public void Write(ISerializable value)
{
Write(value?.Deleted != false ? Serial.MinusOne : value.Serial);
}
public void Write<T>(ICollection<T> coll) where T : class, ISerializable
{
Write(coll.Count);
foreach (var entry in coll)
{
Write(entry);
}
}
public void Write<T>(ICollection<T> coll, Action<IGenericWriter, T> action) where T : class, ISerializable
{
if (coll == null)
{
Write(0);
return;
}
Write(coll.Count);
foreach (var entry in coll)
{
action(this, entry);
}
}
internal void InternalWriteString(string value)
{
var remaining = m_Encoding.GetByteCount(value);