コード例 #1
0
        /// <summary>
        /// Create a project instance corresponding to the vschromium project file
        /// on disk at <paramref name="rootPath"/>.
        /// Return <code>null</code> if there is no project file.
        /// </summary>
        private Project CreateProject(FullPath rootPath)
        {
            var projectFilePath = rootPath.Combine(new RelativePath(ConfigurationFileNames.ProjectFileName));
            var sectionName     = ConfigurationSectionNames.SourceExplorerIgnore;

            if (!_fileSystem.FileExists(projectFilePath))
            {
                projectFilePath = rootPath.Combine(new RelativePath(ConfigurationFileNames.ProjectFileNameObsolete));
                sectionName     = ConfigurationSectionNames.SourceExplorerIgnoreObsolete;
                if (!_fileSystem.FileExists(projectFilePath))
                {
                    return(null);
                }
            }

            var fileWithSections      = new FileWithSections(_fileSystem, projectFilePath);
            var configurationProvider = new FileWithSectionConfigurationProvider(fileWithSections);
            var s1                    = ConfigurationSectionContents.Create(configurationProvider, sectionName);
            var s2                    = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesIgnore);
            var s3                    = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesInclude);
            var fileFilter            = new FileFilter(s1);
            var directoryFilter       = new DirectoryFilter(s1);
            var searchableFilesFilter = new SearchableFilesFilter(s2, s3);

            return(new Project(rootPath, fileFilter, directoryFilter, searchableFilesFilter, fileWithSections.Hash));
        }
コード例 #2
0
        public ChromiumDiscovery(IFileSystem fileSystem, IConfigurationSectionProvider configurationSectionProvider)
        {
            _fileSystem = fileSystem;
            var contents = ConfigurationSectionContents.Create(configurationSectionProvider, ConfigurationFileNames.ChromiumEnlistmentDetectionPatterns);

            _chromiumEnlistmentFilePatterns = new FilePatternsPathMatcherProvider(contents);
        }
コード例 #3
0
        public ChromiumSourceFiles(IConfigurationFileLocator configurationFileLocator, IFileSystem fileSystem)
        {
            var configurationSectionProvider = new ConfigurationFileConfigurationSectionProvider(configurationFileLocator);
            var contents = ConfigurationSectionContents.Create(configurationSectionProvider, ConfigurationStyleFilenames.ChromiumCodingStyleIgnore);

            _chromiumCodingStyleFilePatterns = new FilePatternsPathMatcherProvider(contents);
            _chromiumDiscoveryProvider       = new ChromiumDiscoveryWithCache <FullPath>(configurationSectionProvider, fileSystem);
        }
コード例 #4
0
        private Project CreateProject(FullPath rootPath)
        {
            var configurationProvider = _configurationSectionProvider;
            var section1              = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SourceExplorerIgnoreObsolete);
            var section2              = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesIgnore);
            var section3              = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesInclude);
            var fileFilter            = new FileFilter(section1);
            var directoryFilter       = new DirectoryFilter(section1);
            var searchableFilesFilter = new SearchableFilesFilter(section2, section3);
            var hash = MD5Hash.CreateHash(section1.Contents.Concat(section2.Contents).Concat(section3.Contents));

            return(new Project(rootPath, fileFilter, directoryFilter, searchableFilesFilter, hash));
        }
コード例 #5
0
        private Project CreateProject(FullPath rootPath)
        {
            var configurationProvider         = _configurationSectionProvider;
            var ignorePathsSection            = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SourceExplorerIgnoreObsolete);
            var ignoreSearchableFilesSection  = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesIgnore);
            var includeSearchableFilesSection = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesInclude);
            var fileFilter            = new FileFilter(ignorePathsSection);
            var directoryFilter       = new DirectoryFilter(ignorePathsSection);
            var searchableFilesFilter = new SearchableFilesFilter(ignoreSearchableFilesSection, includeSearchableFilesSection);
            var hash = MD5Hash.CreateHash(ignorePathsSection.Contents.Concat(ignoreSearchableFilesSection.Contents).Concat(includeSearchableFilesSection.Contents));

            return(new Project(rootPath, ignorePathsSection, ignoreSearchableFilesSection, includeSearchableFilesSection, fileFilter, directoryFilter, searchableFilesFilter, hash));
        }
コード例 #6
0
        /// <summary>
        /// Create a project instance corresponding to the vschromium project file
        /// on disk at <paramref name="rootPath"/>.
        /// Return <code>null</code> if there is no project file.
        /// </summary>
        private Project CreateProject(FullPath rootPath, FullPath searchPath)
        {
            var projectFilePath = rootPath.Combine(new RelativePath(ConfigurationFileNames.ProjectFileName));

            var ignorePathsSectionName = ConfigurationSectionNames.SourceExplorerIgnore;

            if (!_fileSystem.FileExists(projectFilePath))
            {
                projectFilePath        = rootPath.Combine(new RelativePath(ConfigurationFileNames.ProjectFileNameObsolete));
                ignorePathsSectionName = ConfigurationSectionNames.SourceExplorerIgnoreObsolete;
                if (!_fileSystem.FileExists(projectFilePath))
                {
                    return(null);
                }
            }

            var fileWithSections              = new FileWithSections(_fileSystem, projectFilePath);
            var configurationProvider         = new FileWithSectionConfigurationProvider(fileWithSections);
            var propertiesSection             = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.Properties);
            var ignorePathsSection            = ConfigurationSectionContents.Create(configurationProvider, ignorePathsSectionName);
            var ignoreSearchableFilesSection  = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesIgnore);
            var includeSearchableFilesSection = ConfigurationSectionContents.Create(configurationProvider, ConfigurationSectionNames.SearchableFilesInclude);
            var propertyCollection            = new PropertyCollection(propertiesSection);
            var fileFilter            = new FileFilter(ignorePathsSection);
            var directoryFilter       = new DirectoryFilter(ignorePathsSection);
            var searchableFilesFilter = new SearchableFilesFilter(ignoreSearchableFilesSection, includeSearchableFilesSection);

            int      rootDepth        = 0;
            FullPath modifiedRootPath = rootPath;

            if (propertyCollection.TryGetInt("RootDepth", out rootDepth) && rootDepth > 0)
            {
                int rootPathDepth = rootPath.ToString().Split(Path.DirectorySeparatorChar).Count();
                IEnumerable <string> pathComponents = searchPath.ToString().Split(Path.DirectorySeparatorChar);
                modifiedRootPath = new FullPath(string.Join(Path.DirectorySeparatorChar.ToString(), pathComponents.Take(rootPathDepth + rootDepth)));
            }

            return(new Project(modifiedRootPath, ignorePathsSection, ignoreSearchableFilesSection, includeSearchableFilesSection, fileFilter, directoryFilter, searchableFilesFilter, fileWithSections.Hash));
        }