static void Main(string[] args) { // Parse Argument... var cmdArgs = new CommandlineArguments(args); if (!cmdArgs.IsParsed) { return; } var csprojPath = cmdArgs.InputPath; var separate = cmdArgs.IsSeparate; var outputpath = cmdArgs.OutputPath; var unuse = cmdArgs.UnuseUnityAttr; // Generator Start... var sw = Stopwatch.StartNew(); Console.WriteLine("Project Compilation Start:" + csprojPath); var tc = new TypeCollector(csprojPath, cmdArgs.ConditionalSymbols, cmdArgs.AllowCustomTypes, cmdArgs.DisallowInternalType, cmdArgs.PropertyEnumOnly, cmdArgs.DisallowInMetadata, cmdArgs.GenerateComparerKeyEnumOnly, cmdArgs.NamespaceRoot); Console.WriteLine("Project Compilation Complete:" + sw.Elapsed.ToString()); Console.WriteLine(); sw.Restart(); Console.WriteLine("Type Collect Start"); ObjectGenerator[] objectGen; EnumGenerator[] enumGen; GenericType[] genericTypes; StructGenerator[] structGen; UnionGenerator[] unionGen; tc.Visit(out enumGen, out objectGen, out structGen, out unionGen, out genericTypes); Console.WriteLine("Type Collect Complete:" + sw.Elapsed.ToString()); Console.WriteLine(); if (!separate) { Console.WriteLine("String Generation Start"); sw.Restart(); var sb = new StringBuilder(); sb.AppendLine(new InitializerGenerator() { Objects = objectGen, Enums = enumGen, Structs = structGen, GenericTypes = genericTypes, UnuseUnityAttribute = unuse, Unions = unionGen, ResolverName = cmdArgs.ResolverName, Namespace = cmdArgs.NamespaceRoot, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }.TransformText()); foreach (var item in objectGen) { item.ForceDefaultResolver = cmdArgs.ForceDefaultResolver; sb.AppendLine(item.TransformText()); } foreach (var item in structGen) { item.ForceDefaultResolver = cmdArgs.ForceDefaultResolver; sb.AppendLine(item.TransformText()); } foreach (var item in unionGen) { item.ForceDefaultResolver = cmdArgs.ForceDefaultResolver; sb.AppendLine(item.TransformText()); } foreach (var item in enumGen) { item.ForceDefaultResolver = cmdArgs.ForceDefaultResolver; sb.AppendLine(item.TransformText()); } Console.WriteLine("String Generation Complete:" + sw.Elapsed.ToString()); Console.WriteLine(); Output(outputpath, sb.ToString()); } else { Console.WriteLine("Output Generation Start"); sw.Restart(); var initializerPath = Path.Combine(outputpath, "ZeroFormatterInitializer.cs"); Output(initializerPath, new InitializerGenerator() { Objects = objectGen, Enums = enumGen, Structs = structGen, GenericTypes = genericTypes, UnuseUnityAttribute = unuse, Unions = unionGen, ResolverName = cmdArgs.ResolverName, Namespace = cmdArgs.NamespaceRoot, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }.TransformText()); foreach (var item in objectGen.SelectMany(x => x.Types)) { var path = Path.Combine(outputpath, item.FullName.Replace(".", "\\") + ".cs"); var gen = new ObjectGenerator { Namespace = item.Namespace, Types = new[] { item }, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }; Output(path, gen.TransformText()); } foreach (var item in structGen.SelectMany(x => x.Types)) { var path = Path.Combine(outputpath, item.FullName.Replace(".", "\\") + ".cs"); var gen = new StructGenerator { Namespace = item.Namespace, Types = new[] { item }, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }; Output(path, gen.TransformText()); } foreach (var item in unionGen.SelectMany(x => x.Types)) { var path = Path.Combine(outputpath, item.FullName.Replace(".", "\\") + ".cs"); var gen = new UnionGenerator { Namespace = item.Namespace, Types = new[] { item }, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }; Output(path, gen.TransformText()); } foreach (var e in enumGen) { foreach (var item in e.Types) { var path = Path.Combine(outputpath, item.FullName.Replace(".", "\\") + ".cs"); var gen = new EnumGenerator { Namespace = e.Namespace, Types = new[] { item }, ForceDefaultResolver = cmdArgs.ForceDefaultResolver }; Output(path, gen.TransformText()); } } } }