public static void WriteToPath(string basePath) { if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } using var stream = File.CreateText(Path.Combine(basePath, "UwmfSemanticAnalyzer.Generated.cs")); using var output = new IndentedWriter(stream); var includes = new[] { "System.CodeDom.Compiler", "System.Collections.Generic", "System.Collections.Immutable", "Tiledriver.Core.FormatModels.Common", "Tiledriver.Core.FormatModels.Common.Reading", "Tiledriver.Core.FormatModels.Common.Reading.AbstractSyntaxTree", "Tiledriver.Core.FormatModels.Uwmf.Reading.AbstractSyntaxTree", }; output .WriteHeader("Tiledriver.Core.FormatModels.Uwmf.Reading", includes) .Line($"[GeneratedCode(\"{CurrentLibraryInfo.Name}\", \"{CurrentLibraryInfo.Version}\")]") .Line($"public static partial class UwmfSemanticAnalyzer") .OpenParen(); foreach (var block in UwmfDefinitions.Blocks.Where(b => b.Serialization == SerializationType.Normal)) { CreateBlockReader(output, block); } CreateGlobalBlockReader(output, UwmfDefinitions.Blocks.Single(b => b.Serialization == SerializationType.TopLevel)); output.CloseParen(); }