Vixen
02b45cc4
csharp
public static class SerializerRegistry

Where serializers are found.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Lookup by type is a single static field read — the JIT specialises Get``1 per type and the field is the whole implementation. There is no dictionary on the serialisation path.

Generated serializers register themselves from a [ModuleInitializer] the generator emits per assembly, so referencing an assembly is enough to be able to read its types. Vixen.Core.Reflection will subsume this with the wider type registry it needs anyway; until then this is self-contained, which is what lets serialisation be tested without it.

Fields and properties (2)

  • public static int Count

    How many serializers are registered.

  • public static IReadOnlyCollection<Type> RegisteredTypes

    Every registered type. For diagnostics and for the editor's type list.

Methods (10)

  • public static int Evict(Assembly assembly)

    Forgets every serializer an assembly registered.

  • public static void Register<T>(DataSerializer<T> serializer)

    Registers a serializer, replacing any previous one for the same type.

  • public static bool TryGetByTypeId(ulong typeId, out DataSerializer? serializer)

    Finds the serializer for the type a chunk header names.

  • public static void Register<T>(string alias, DataSerializer<T> serializer, params string[] formerAliases)

    Registers a serializer under a name the wire format can carry.

  • public static bool TryGetByAlias(string alias, out DataSerializer? serializer)

    Finds the serializer registered under a name.

  • public static bool TryGetAlias(Type type, out string? alias)

    Finds the name a type is written under.

  • public static DataSerializer<T> Get<T>()

    Finds the serializer for a type.

  • public static bool TryGet<T>(out DataSerializer<T>? serializer)

    Finds the serializer for a type, if there is one.

  • public static bool IsRegistered<T>()

    Whether a type has a serializer.

  • public static bool IsRegistered(Type type)

    Whether a type has a serializer. For tooling that has a Type and not a generic parameter.

Used by (11)

  • SerializerRegistrationAddressablesRemote
  • BuiltInSerializersVixen.Core.Serialization
  • ObjectDatabaseVixen.Core.Serialization
  • SceneBehaviorRegistryVixen.Engine
  • SceneComponentRegistryVixen.Engine
  • SerializationReaderVixen.Core.Serialization
  • SerializationTestsVixen.Core.Serialization.Tests
  • SerializationWriterVixen.Core.Serialization
  • SerializerVixen.Core.Serialization
  • TypeDescriptorVixen.Core.Reflection
  • ProjectAssembliesVixen.Editor.App