using System.IO; using System.Text; namespace Wabbajack.DTOs.ConverterGenerators; public class CFile { private readonly StringBuilder _sb; private int _indent; public CFile() { _sb = new StringBuilder(); Code("// THIS FILE IS AUTOGENERATED DO NOT EDIT BY HAND"); Code("using System;"); Code("using System.Text.Json;"); Code("using System.Text.Json.Serialization;"); Code("using Wabbajack.Hashing.xxHash64;"); Code("using Microsoft.Extensions.DependencyInjection;"); Code(""); } public void Write(string path) { File.WriteAllText(path, _sb.ToString()); } public void Code(string c) { if (c.EndsWith("}")) _indent--; for (var i = 0; i < _indent; i++) _sb.Append(" "); _sb.AppendLine(c); if (c.EndsWith("{")) _indent++; } }