Remove serializer registration at startup

This commit is contained in:
NGnius (Graham) 2020-05-17 11:52:55 -04:00
parent 500cb9b716
commit ebea9da232
2 changed files with 9 additions and 7 deletions

View file

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version>1.0.1</Version> <Version>1.0.2</Version>
<Authors>Exmods</Authors> <Authors>Exmods</Authors>
<PackageLicenseExpression>GNU General Public Licence 3+</PackageLicenseExpression> <PackageLicenseExpression>GNU General Public Licence 3+</PackageLicenseExpression>
<PackageProjectUrl>https://git.exmods.org/modtainers/GamecraftModdingAPI</PackageProjectUrl> <PackageProjectUrl>https://git.exmods.org/modtainers/GamecraftModdingAPI</PackageProjectUrl>

View file

@ -35,6 +35,12 @@ namespace GamecraftModdingAPI.Utility
/// </summary> /// </summary>
public static void Enable() public static void Enable()
{ {
if (!SerializerManager.ExistsSerializer(typeof(ModVersionStruct).FullName))
{
SerializerManager.AddSerializer<ModVersionDescriptor>(new SimpleEntitySerializer<ModVersionDescriptor>(
(_) => { return new EGID[1] { new EGID(0u, ApiExclusiveGroups.versionGroup) }; }
));
}
EventManager.AddEventEmitter(versionEngine); EventManager.AddEventEmitter(versionEngine);
isEnabled = true; isEnabled = true;
} }
@ -48,12 +54,8 @@ namespace GamecraftModdingAPI.Utility
isEnabled = false; isEnabled = false;
} }
public static void Init() public static void Init() { }
{
SerializerManager.AddSerializer<ModVersionDescriptor>(new SimpleEntitySerializer<ModVersionDescriptor>(
(_) => { return new EGID[1] { new EGID(0u, ApiExclusiveGroups.versionGroup) }; }
));
}
} }
internal class VersionTrackingEngine : IEventEmitterEngine internal class VersionTrackingEngine : IEventEmitterEngine