Esempio n. 1
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)));
        }
Esempio n. 2
0
        bool ContainsExcludedExtension(string fullPath)
        {
            var extension = Path.GetExtension(fullPath).ToUpperInvariant();

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