protected override void OnGenerate(TextWriter writer, FileGenerationOptions options) { // HACK: Fix this X. writer.WriteLine("class MyClass" + options.X); writer.WriteLine("{"); writer.WriteLine("}"); }
protected override void OnGenerate(TextWriter writer, FileGenerationOptions options) { for (int i = 0; i < options.LineCount; ++i) { writer.WriteLine("test"); } }
ProjectFile GenerateFile(FileGenerationOptions options, string baseDirectory, int index) { var file = new ProjectFile("/" + index + options.Generator.FileExtension); using (var sw = new StreamWriter(Path.Combine(baseDirectory, index + options.Generator.FileExtension))) { options.X = index; options.Generator.Generate(sw, options); } return(file); }
static FileGenerationOptions[] DispersedFiles(ProjectGenerator projectGenerator, int fileCount, int lineCount) { var result = new FileGenerationOptions[fileCount]; for (int i = 0; i < fileCount; ++i) { // TODO: Use stddev to disperse files and loc between projects. for now, hacky equal distribution int linesInFile = lineCount / fileCount; // HACK: Choose a good generator. var fileGenerator = projectGenerator.CodeGenerators.Single(); result[i] = new FileGenerationOptions(linesInFile, fileGenerator); } return(result); }
protected abstract void OnGenerate(TextWriter writer, FileGenerationOptions options);
public void Generate(TextWriter writer, FileGenerationOptions options) { OnGenerate(writer, options); }