Example #1
0
        void StreamInitialContent(IEnumerable <string> folders)
        {
            folders.ForEach(folder =>
            {
                var allFiles = new List <string>();

                CSharpProject.CollectFiles(folder, allFiles);

                allFiles.ForEach(file => _fsStream.OnNext(new FSChange(folder, file)));
            });
        }
Example #2
0
        public void TransfromDirectory(string projectDirectory)
        {
            using (var scope = _containerFactory.CreateScope())
            {
                var logStream             = scope.Resolve <ILogStream>();
                var projectTransformation = scope.Resolve <IQuokkaProjectTransformation>();

                var config            = QuokkaConfigLoader.Load(projectDirectory);
                var projectPath       = CSharpProject.GetSingleProjectFromFolder(projectDirectory);
                var projectReferences = CSharpProject.RecursiveCollectProjectReferences(projectPath);
                var projectFolders    = projectReferences.Select(p => Path.GetDirectoryName(p));

                var codeFiles = projectFolders.Select(folder =>
                {
                    var allFiles = new List <string>();
                    CSharpProject.CollectFiles(folder, allFiles);

                    return(allFiles.Select(f =>
                    {
                        var content = "";
                        FileTools.TryReadAllText(f, out content);

                        return new SourceFileSnapshot()
                        {
                            ProjectName = CSharpProject.GetSingleProjectFromFolder(folder),
                            FullPath = f,
                            Content = content
                        };
                    }));
                }).SelectMany(s => s);


                var transformedCode = new SourceCodeSnapshot(
                    projectTransformation.Transform(
                        new TransformationRequest()
                {
                    Sources        = codeFiles.ToList(),
                    Configurations = config.Configurations
                }).Result.Result);

                new QuartusProjectTools(logStream).SaveCodeSnapshot(
                    transformedCode,
                    config.Project,
                    config.ProjectLocation,
                    config.Configurations.Select(c => c.Name).ToHashSet());
            }
        }