void GenerateSupportFiles(ProjectOutput output) { // Search for the location of support directory and bundle files with output. try { var path = GetSupportDirectory(); foreach (var file in Directory.EnumerateFiles(path)) { Output.WriteOutput(Path.GetFileName(file), File.ReadAllText(file)); } } catch (Exception) { Diagnostics.Warning("Could not find directory with support API."); } }
void Generate() { Output = new ProjectOutput(); Generators.Generator generator = null; switch (Options.Language) { case GeneratorKind.C: generator = new CGenerator(Context, Options); break; case GeneratorKind.ObjectiveC: generator = new ObjCGenerator(Context, Options); break; default: throw new NotImplementedException(); } foreach (var unit in Context.ASTContext.TranslationUnits) { var templates = generator.Generate(unit); foreach (var template in templates) { template.Process(); var text = template.Generate(); var path = string.Format("{0}.{1}", template.Name, template.FileExtension); Output.WriteOutput(path, text); } } if (Options.GenerateSupportFiles) { GenerateSupportFiles(Output); } }