### Summary - `GenericEntityPersistence` is now a type of `GenericPersistence`. This allows developers to serialize both entities and non-entities in the same system. 🎉 - Each `SerializationThreadWorker` now allocates 1MB of heap for serialization _permanently_. If more memory is needed, that thread will double it's memory, not to exceed increments of 64MB. - Several bugs with serialization introduced with the pure MMF implementation have been fixed. - `BinaryFileReader` has been added back. 🎉 - Adds `world.useMultithreadedSaves` to allow disabling threaded saves. > [!IMPORTANT] > **Developer Note** > The split file serialization has been deprecated and is no longer used. We have effectively gone back to the same file writing we had before the pure MMF implementation.
62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.IO;
|
|
using ModernUO.Serialization;
|
|
|
|
namespace Server.Engines.BulkOrders;
|
|
|
|
[SerializationGenerator(1)]
|
|
public abstract partial class BaseBOBEntry : IBOBEntry
|
|
{
|
|
[SerializableField(0, setter: "protected")]
|
|
private bool _requireExceptional;
|
|
|
|
[SerializableField(1, setter: "protected")]
|
|
private BODType _deedType;
|
|
|
|
[SerializableField(2, setter: "protected")]
|
|
private BulkMaterialType _material;
|
|
|
|
[SerializableField(3, setter: "protected")]
|
|
private int _amountMax;
|
|
|
|
[SerializableField(4)]
|
|
private int _price;
|
|
|
|
public DateTime Created { get; set; } = Core.Now;
|
|
|
|
public Serial Serial { get; }
|
|
|
|
public byte SerializedThread { get; set; }
|
|
public int SerializedPosition { get; set; }
|
|
public int SerializedLength { get; set; }
|
|
|
|
public bool Deleted { get; private set; }
|
|
|
|
public BaseBOBEntry()
|
|
{
|
|
Serial = BOBEntries.NewBOBEntry;
|
|
BOBEntries.Add(this);
|
|
}
|
|
|
|
public virtual void Delete()
|
|
{
|
|
Deleted = true;
|
|
BOBEntries.Remove(this);
|
|
}
|
|
|
|
public abstract Item Reconstruct();
|
|
|
|
private void Deserialize(IGenericReader reader, int version)
|
|
{
|
|
if (version == 0)
|
|
{
|
|
// version 0 - This class didn't exist, so we are going to skip deserializing
|
|
// Seek back 1 byte because encoded int of 0 is 1 byte
|
|
reader.Seek(-1, SeekOrigin.Current);
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("Unknown deserialization error in presource generated BOB Entries");
|
|
}
|
|
}
|
|
}
|