More cleanup
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
|
using System;
|
||||||
// ReSharper disable BitwiseOperatorOnEnumWithoutFlags
|
|
||||||
using Kaitai;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.CodeDom;
|
using System.CodeDom;
|
||||||
using System.CodeDom.Compiler;
|
using System.CodeDom.Compiler;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Kaitai;
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
|
using Microsoft.CodeAnalysis.Text;
|
||||||
using Microsoft.CSharp;
|
using Microsoft.CSharp;
|
||||||
using BlendFile = Kaitai.BlenderBlend;
|
using BlendFile = Kaitai.BlenderBlend;
|
||||||
|
|
||||||
|
// ReSharper disable BitwiseOperatorOnEnumWithoutFlags
|
||||||
namespace CodeGenerator {
|
namespace CodeGenerator {
|
||||||
public class Program {
|
public class Program {
|
||||||
public static BlendFile blendfile;
|
public static BlendFile blendfile;
|
||||||
@@ -207,20 +209,16 @@ namespace CodeGenerator {
|
|||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OutputCodeFiles(CodeNamespace ns) {
|
private static void SetupCCU(out CodeGeneratorOptions codeGeneratorOptions, out CSharpCodeProvider provider,
|
||||||
CodeNamespace tempNs = new CodeNamespace(Namespace);
|
out CodeCompileUnit ccu) {
|
||||||
if (!Path.Exists(OutPath)) {
|
codeGeneratorOptions = new CodeGeneratorOptions() {
|
||||||
Directory.CreateDirectory(OutPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeGeneratorOptions codeGeneratorOptions = new CodeGeneratorOptions() {
|
|
||||||
BlankLinesBetweenMembers = false,
|
BlankLinesBetweenMembers = false,
|
||||||
BracingStyle = "Block",
|
BracingStyle = "Block",
|
||||||
ElseOnClosing = false,
|
ElseOnClosing = false,
|
||||||
IndentString = " ",
|
IndentString = " ",
|
||||||
VerbatimOrder = true
|
VerbatimOrder = true
|
||||||
};
|
};
|
||||||
var provider = new CSharpCodeProvider();
|
provider = new CSharpCodeProvider();
|
||||||
var date = DateTime.Now.ToString();
|
var date = DateTime.Now.ToString();
|
||||||
|
|
||||||
CodeNamespace globalNs = new CodeNamespace();
|
CodeNamespace globalNs = new CodeNamespace();
|
||||||
@@ -230,8 +228,14 @@ namespace CodeGenerator {
|
|||||||
globalNs.Imports.Add(new("System"));
|
globalNs.Imports.Add(new("System"));
|
||||||
globalNs.Imports.Add(new("BlendFile.CompatTypes"));
|
globalNs.Imports.Add(new("BlendFile.CompatTypes"));
|
||||||
|
|
||||||
CodeCompileUnit ccu = new CodeCompileUnit();
|
ccu = new CodeCompileUnit();
|
||||||
ccu.Namespaces.Add(globalNs);
|
ccu.Namespaces.Add(globalNs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OutputCodeFiles(CodeNamespace ns) {
|
||||||
|
if (!Path.Exists(OutPath)) Directory.CreateDirectory(OutPath);
|
||||||
|
SetupCCU(out var codeGeneratorOptions, out var provider, out var ccu);
|
||||||
|
CodeNamespace tempNs = new CodeNamespace(Namespace);
|
||||||
ccu.Namespaces.Add(tempNs);
|
ccu.Namespaces.Add(tempNs);
|
||||||
foreach (var type in ns.Types.OfType<CodeTypeDeclaration>()) {
|
foreach (var type in ns.Types.OfType<CodeTypeDeclaration>()) {
|
||||||
tempNs.Types.Add(type);
|
tempNs.Types.Add(type);
|
||||||
|
|||||||
Reference in New Issue
Block a user