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(); } }
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))); }
bool ContainsExcludedExtension(string fullPath) { var extension = Path.GetExtension(fullPath).ToUpperInvariant(); return(ExcludedExtensions.Contains(extension) || IncludedExtensions.Length > 0 && !IncludedExtensions.Contains(extension)); }