From ebea9da232458820d527986102a1aa375c66e572 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sun, 17 May 2020 11:52:55 -0400 Subject: [PATCH] Remove serializer registration at startup --- GamecraftModdingAPI/GamecraftModdingAPI.csproj | 2 +- GamecraftModdingAPI/Utility/VersionTracking.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/GamecraftModdingAPI/GamecraftModdingAPI.csproj b/GamecraftModdingAPI/GamecraftModdingAPI.csproj index a27b050..55339fa 100644 --- a/GamecraftModdingAPI/GamecraftModdingAPI.csproj +++ b/GamecraftModdingAPI/GamecraftModdingAPI.csproj @@ -3,7 +3,7 @@ net472 true - 1.0.1 + 1.0.2 Exmods GNU General Public Licence 3+ https://git.exmods.org/modtainers/GamecraftModdingAPI diff --git a/GamecraftModdingAPI/Utility/VersionTracking.cs b/GamecraftModdingAPI/Utility/VersionTracking.cs index 3b83cc2..780ac38 100644 --- a/GamecraftModdingAPI/Utility/VersionTracking.cs +++ b/GamecraftModdingAPI/Utility/VersionTracking.cs @@ -35,6 +35,12 @@ namespace GamecraftModdingAPI.Utility /// public static void Enable() { + if (!SerializerManager.ExistsSerializer(typeof(ModVersionStruct).FullName)) + { + SerializerManager.AddSerializer(new SimpleEntitySerializer( + (_) => { return new EGID[1] { new EGID(0u, ApiExclusiveGroups.versionGroup) }; } + )); + } EventManager.AddEventEmitter(versionEngine); isEnabled = true; } @@ -48,12 +54,8 @@ namespace GamecraftModdingAPI.Utility isEnabled = false; } - public static void Init() - { - SerializerManager.AddSerializer(new SimpleEntitySerializer( - (_) => { return new EGID[1] { new EGID(0u, ApiExclusiveGroups.versionGroup) }; } - )); - } + public static void Init() { } + } internal class VersionTrackingEngine : IEventEmitterEngine