protected override void OnGenerate(TextWriter writer, FileGenerationOptions options)
 {
     // HACK: Fix this X.
     writer.WriteLine("class MyClass" + options.X);
     writer.WriteLine("{");
     writer.WriteLine("}");
 }
예제 #2
0
 protected override void OnGenerate(TextWriter writer, FileGenerationOptions options)
 {
     for (int i = 0; i < options.LineCount; ++i)
     {
         writer.WriteLine("test");
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 protected abstract void OnGenerate(TextWriter writer, FileGenerationOptions options);
예제 #6
0
 public void Generate(TextWriter writer, FileGenerationOptions options)
 {
     OnGenerate(writer, options);
 }