Beispiel #1
0
 public void Merge(Config config)
 {
     if (config.Mode == ConfigFileMode.Override)
     {
         ExcludedExtensions = config.ExcludedExtensions;
         ExcludedDirs       = config.ExcludedDirs;
     }
     else if (config.Mode == ConfigFileMode.Append)
     {
         ExcludedDirs       = ExcludedDirs.Union(config.ExcludedDirs).ToArray();
         ExcludedExtensions = ExcludedExtensions.Union(config.ExcludedExtensions).ToArray();
     }
 }
Beispiel #2
0
        bool IsExcludedFromIndex(string fullPath, WatcherChangeTypes changeType)
        {
            if (changeType == WatcherChangeTypes.Deleted) // Unable to determine path is folder or file under deleted scenario
            {
                var excluded  = ExcludedPaths.Any(u => fullPath.ToUpperInvariant().Contains(u));
                var extension = Path.GetExtension(fullPath).ToUpperInvariant();

                if (extension != string.Empty)
                {
                    excluded = excluded || ExcludedExtensions.Contains(extension) || IncludedExtensions.Length > 0 && !IncludedExtensions.Contains(extension);
                }

                if (excluded)
                {
                    Log.LogDebug($"{IndexConfig.IndexName}: {fullPath} is excluded from index, change type: {WatcherChangeTypes.Deleted}");
                }

                return(excluded);
            }

            return(IsExcludedFromIndex(fullPath, IsDirectory(fullPath)));
        }
Beispiel #3
0
        bool ContainsExcludedExtension(string fullPath)
        {
            var extension = Path.GetExtension(fullPath).ToUpperInvariant();

            return(ExcludedExtensions.Contains(extension) || IncludedExtensions.Length > 0 && !IncludedExtensions.Contains(extension));
        }