示例#1
0
        Project GenerateProject(ProjectGenerationOptions options, int index)
        {
            var project = Services.ProjectService.CreateDotNetProject(options.Generator.Language);

            project.BaseDirectory = "project" + index;
            project.Name          = project + "index";

            int i = 0;

            foreach (var fileOptions in options.FileOptions)
            {
                var file = GenerateFile(fileOptions, project.BaseDirectory, i++);
                project.Files.Add(file);
            }

            return(project);
        }
        static ProjectGenerationOptions[] DispersedProjects(DisperseOptions options)
        {
            var result = new ProjectGenerationOptions[options.ProjectCount];

            for (int i = 0; i < options.ProjectCount; ++i)
            {
                // TODO: Use stddev to disperse files and loc between projects. for now, hacky equal distribution
                int lineCountInProject = options.LineCount / options.ProjectCount;
                int fileCountInProject = options.FileCount / options.ProjectCount;

                // HACK: Choose a good generator.
                var generator = options.PossibleGenerators.Single(x => x.Language == "C#");

                result[i] = ProjectGenerationOptions.Dispersed(generator, fileCountInProject, lineCountInProject);
            }
            return(result);
        }