From e978a7aeb38d3edb58083ff288d8ea2b7718437e Mon Sep 17 00:00:00 2001 From: Nicolas Gnyra Date: Fri, 17 May 2024 21:33:55 -0400 Subject: [PATCH] Fix debug build exploding --- .../Directory.Build.targets | 1 - .../Util/DocumentationDataGenerator.cs | 19 +++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/BeatSaberMarkupLanguage/Directory.Build.targets b/BeatSaberMarkupLanguage/Directory.Build.targets index 2f802881..59036c0f 100644 --- a/BeatSaberMarkupLanguage/Directory.Build.targets +++ b/BeatSaberMarkupLanguage/Directory.Build.targets @@ -70,7 +70,6 @@ - diff --git a/BeatSaberMarkupLanguage/Util/DocumentationDataGenerator.cs b/BeatSaberMarkupLanguage/Util/DocumentationDataGenerator.cs index 261914be..90ed087c 100644 --- a/BeatSaberMarkupLanguage/Util/DocumentationDataGenerator.cs +++ b/BeatSaberMarkupLanguage/Util/DocumentationDataGenerator.cs @@ -15,25 +15,24 @@ namespace BeatSaberMarkupLanguage.Util { internal class DocumentationDataGenerator { - private readonly ISerializer serializer; - private readonly IDeserializer deserializer; private readonly IReadOnlyList typeHandlerTypes; internal DocumentationDataGenerator(IEnumerable typeHandlers) { - this.serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); - this.deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); this.typeHandlerTypes = typeHandlers.Select(t => t.GetCustomAttribute(true).type).OrderBy(t => t.Name).ToList(); } internal void Generate() { - GenerateTags(); - GenerateMacros(); - GenerateTypeHandlers(); + IDeserializer deserializer = new DeserializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); + ISerializer serializer = new SerializerBuilder().WithNamingConvention(CamelCaseNamingConvention.Instance).Build(); + + GenerateTags(serializer); + GenerateMacros(deserializer, serializer); + GenerateTypeHandlers(deserializer, serializer); } - private void GenerateTags() + private void GenerateTags(ISerializer serializer) { GameObject dummy = new(); List tags = new(); @@ -59,7 +58,7 @@ private void GenerateTags() UnityEngine.Object.Destroy(dummy); } - private void GenerateMacros() + private void GenerateMacros(IDeserializer deserializer, ISerializer serializer) { GameObject dummy = new(); List macros = deserializer.Deserialize>(File.ReadAllText("Macros.yml")); @@ -99,7 +98,7 @@ private void GenerateMacros() UnityEngine.Object.Destroy(dummy); } - private void GenerateTypeHandlers() + private void GenerateTypeHandlers(IDeserializer deserializer, ISerializer serializer) { GameObject dummy = new(); List typeHandlers = deserializer.Deserialize>(File.ReadAllText("TypeHandlers.yml"));