public BootstrappedSolution BootstrapSolution(SolutionConfiguration solutionConfig)
        {
            MarkMessagesAsEvents(solutionConfig);

            var solution           = new BootstrappedSolution();
            var projects           = new List <BootstrappedProject>();
            var globalDependencies = new List <ProjectReferenceData>();

            var messagesProject = GenerateMessagesProject(solutionConfig);

            var messagesProjectDependencies =
                dependencyMapper.GetDependencies(solutionConfig.NServiceBusVersion, solutionConfig.Transport);

            projects.Add(messagesProject);

            solution.ProjectDependencyDictionary.Add(messagesProject.ProjectName, messagesProjectDependencies);

            globalDependencies.Add(new ProjectReferenceData()
            {
                Name              = messagesProject.ProjectName,
                ProjectGuid       = messagesProject.ProjectGuid,
                QualifiedLocation = "",
            });

            foreach (var endpointConfig in solutionConfig.EndpointConfigurations)
            {
                var endpointProject = GenerateEndpoint(endpointConfig, globalDependencies);
                var dependencies    = dependencyMapper.GetEndpointDependencies(endpointConfig);
                solution.ProjectDependencyDictionary.Add(endpointProject.ProjectName, dependencies);
                projects.Add(endpointProject);
            }

            var consoleApplication = GenerateConsoleProject(solutionConfig, globalDependencies);

            projects.Add(consoleApplication);

            foreach (var project in projects)
            {
                var projectFolder = new FolderAbstraction()
                {
                    Name    = project.ProjectName,
                    Files   = project.ProjectRoot.Files,
                    Folders = project.ProjectRoot.Folders
                };

                solution.SolutionRoot.Folders.Add(projectFolder);
            }

            var solutionFile = SolutionFileTemplator.CreateSolutionFile(solutionConfig);

            solution.SolutionRoot.Files.Add(solutionFile);

            return(solution);
        }
        private static void CrawlAndSaveFiles(string path, FolderAbstraction folder)
        {
            foreach (var file in folder.Files)
            {
                File.WriteAllText(path + file.Name, file.Content);
            }

            foreach (var child in folder.Folders)
            {
                var newDirectory = path + child.Name;
                Directory.CreateDirectory(newDirectory);
                CrawlAndSaveFiles(newDirectory + @"\", child);
            }
        }
        private static IncludesData CrawlFoldersForIncludes(FolderAbstraction folder, IncludesData includes = null)
        {
            //TODO: add support for nested paths, this doesn't work yet
            includes = includes ?? new IncludesData();

            var forCompile = folder.Files.Where(f => f.Name.EndsWith(".cs"));
            var forContent = folder.Files.Where(f => !f.Name.EndsWith(".cs"));

            includes.Compile.AddRange(forCompile.Select(f => CreateCompileReference(f.Name)));
            includes.Content.AddRange(forContent.Select(f => CreateContentReference(f.Name)));

            foreach (var child in folder.Folders)
            {
                CrawlFoldersForIncludes(child, includes);
            }

            return(includes);
        }
 public BootstrappedSolution()
 {
     SolutionRoot = new FolderAbstraction();
     ProjectDependencyDictionary = new Dictionary<string, List<NugetDependency>>();
 }
 public BootstrappedProject()
 {
     ProjectGuid = Guid.NewGuid();
     ProjectRoot = new FolderAbstraction();
 }
 public BootstrappedSolution()
 {
     SolutionRoot = new FolderAbstraction();
     ProjectDependencyDictionary = new Dictionary <string, List <NugetDependency> >();
 }
 public BootstrappedProject()
 {
     ProjectGuid = Guid.NewGuid();
     ProjectRoot = new FolderAbstraction();
 }
        private static void CrawlAndSaveFiles(string path, FolderAbstraction folder)
        {
            foreach (var file in folder.Files)
            {
                File.WriteAllText(path + file.Name, file.Content);
            }

            foreach (var child in folder.Folders)
            {
                var newDirectory = path + child.Name;
                Directory.CreateDirectory(newDirectory);
                CrawlAndSaveFiles(newDirectory + @"\", child);
            }
        }
        private static IncludesData CrawlFoldersForIncludes(FolderAbstraction folder, IncludesData includes = null)
        {
            //TODO: add support for nested paths, this doesn't work yet
            includes = includes ?? new IncludesData();

            var forCompile = folder.Files.Where(f => f.Name.EndsWith(".cs"));
            var forContent = folder.Files.Where(f => !f.Name.EndsWith(".cs"));

            includes.Compile.AddRange(forCompile.Select(f => CreateCompileReference(f.Name)));
            includes.Content.AddRange(forContent.Select(f => CreateContentReference(f.Name)));

            foreach (var child in folder.Folders)
            {
                CrawlFoldersForIncludes(child, includes);
            }

            return includes;
        }