Ejemplo n.º 1
0
        public IEnumerable <VsProjectFile> GetHostSolutions(string fileName)
        {
            var           result = new List <VsProjectFile>();
            VsProjectFile file   = null;

            if (_projectFilesIndex.TryGetValue(fileName.ToUpper(), out file))
            {
                ProcessHostSolutions(file, result);
            }
            return(result);
        }
Ejemplo n.º 2
0
 private void ProcessHostSolutions(VsProjectFile file, List <VsProjectFile> result)
 {
     if (file.Type == VsProjectFileType.Solution)
     {
         result.Add(file);
         return;
     }
     else
     {
         foreach (var refFiles in file.IncludedIn.Values)
         {
             ProcessHostSolutions(refFiles, result);
         }
     }
 }
Ejemplo n.º 3
0
        private void BuildSlnFiles()
        {
            Parallel.ForEach(_slnFiles, (slnFilePath) =>
            {
                try
                {
                    var slnFile = _projectFilesIndex.GetOrAdd(slnFilePath, (key) =>
                    {
                        return(new VsProjectFile()
                        {
                            Path = slnFilePath,
                            Name = Path.GetFileName(slnFilePath),
                            Type = VsProjectFileType.Solution,
                        });
                    });

                    var solution = SolutionParser.Parse(slnFilePath);

                    foreach (var project in solution.Projects)
                    {
                        var projectPath = project.Path;
                        if (!Path.IsPathRooted(projectPath))
                        {
                            projectPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(slnFilePath), projectPath));
                        }
                        VsProjectFile projectFile = null;
                        if (_projectFilesIndex.TryGetValue(projectPath.ToUpper(), out projectFile))
                        {
                            projectFile.IncludedIn.TryAdd(slnFilePath, slnFile);
                        }
                    }
                }
                catch (Exception e)
                {
                    _logger.Log(e.Message);
                }
            });
        }