More Cleanup

This commit is contained in:
Samuele Lorefice
2025-01-22 02:22:39 +01:00
parent 56c5654c52
commit 85631f707c

View File

@@ -27,9 +27,10 @@ namespace CodeGenerator {
} }
public static void Main(string[] args) { public static void Main(string[] args) {
Log("Reading blend file");
ReadBlendFile(); ReadBlendFile();
Log("Generating C# code"); Log("Generating C# code...");
Log("Pass 1: Generating types"); Log("Pass 1: Generating types");
CodeNamespace ns = GenerateTypes(); CodeNamespace ns = GenerateTypes();
@@ -37,7 +38,7 @@ namespace CodeGenerator {
Log("Pass 2: Writing out code"); Log("Pass 2: Writing out code");
OutputCodeFiles(ns); OutputCodeFiles(ns);
Log("Finished generating C# code"); Log("Finished generating C# code!");
File.AppendAllText("Log.txt", sb.ToString()); File.AppendAllText("Log.txt", sb.ToString());
} }
@@ -217,10 +218,13 @@ namespace CodeGenerator {
BracingStyle = "Block", BracingStyle = "Block",
ElseOnClosing = false, ElseOnClosing = false,
IndentString = " ", IndentString = " ",
VerbatimOrder = false VerbatimOrder = true
}; };
var provider = new CSharpCodeProvider(); var provider = new CSharpCodeProvider();
var date = DateTime.Now.ToString();
CodeComment comment = new CodeComment("Automatically generated by BlenderSharp at " + date, false);
tempNs.Comments.Add(new(comment));
foreach (var type in ns.Types.OfType<CodeTypeDeclaration>()) { foreach (var type in ns.Types.OfType<CodeTypeDeclaration>()) {
tempNs.Types.Add(type); tempNs.Types.Add(type);
Log($"Writing out {(type.IsStruct ? "struct" : "class")} {type.Name}"); Log($"Writing out {(type.IsStruct ? "struct" : "class")} {type.Name}");