Skip to main content

ClassSerializationHelper

A static class in Root.Township, the global namespace.

Builds the cached read/write delegate that syncs a class's fields, using emitted getters and setters per field. Used for [Sync] fields and save data.

Methods​

MemberWhat it is
static ClassSerializer<T> Prepare<T>(ref Action<T, Stream, ChunkVersioning> staticSync, NetworkEntity entity, T target, EntityMessageType type)Builds the static sync delegate for a type once, from its fields (all, or only [Sync] ones), and for [Sync] also returns a ClassSerializer.
static void Prepare(Type type, ref Action<SaveData, Stream, ChunkVersioning> staticSync)Builds the static sync delegate for a type once, from its fields (all, or only [Sync] ones), and for [Sync] also returns a ClassSerializer.
static void Prepare<T>(Type type, ref Action<T, Stream, ChunkVersioning> staticSync)Builds the static sync delegate for a type once, from its fields (all, or only [Sync] ones), and for [Sync] also returns a ClassSerializer.
static void Prepare<T>(Type type, ref Action<T, Stream, ChunkVersioning> staticSync, Func<MemberInfo, bool> predicate, Func<MemberInfo, ClassSerializationHelper.MemberHandler<T>> getHandler, ClassSerializationHelper.Finalize<T> finalize)Builds the static sync delegate for a type once, from its fields (all, or only [Sync] ones), and for [Sync] also returns a ClassSerializer.
1 private and internal method
MemberWhat it is
private static ClassSerializationHelper.MemberHandler<T> SerializeByType<T>(MemberInfo member)Picks the field's type serializer from TypeSerializationHelper, using its array handler for arrays.