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:
parent
f0969223f7
commit
6e9477ea13
18 changed files with 370 additions and 248 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue