private bool ShouldBrowseDirectory(IDirectoryInfo directory)
        {
            var result = true;

            if (!directory.Exists)
            {
                _log.DebugFormat("Skipping scanning directory {0}.", directory.FullName);
                result = false;
            }
            else if (directory.Parent == null)
            {
// ReSharper disable RedundantAssignment
                result = true;
// ReSharper restore RedundantAssignment
            }
            else if (_defautExclussions.Contains(directory.Name) &&
                     (directory.Attributes & FileAttributes.System) == FileAttributes.System)
            {
                _log.DebugFormat("Skipping scanning directory {0} because it is directory that is a part of default exclusion.", directory.FullName);
                result = false;
            }
            else if ((directory.Attributes & FileAttributes.Offline) == FileAttributes.Offline ||
                     (directory.Attributes & FileAttributes.Device) == FileAttributes.Device)
            {
                _log.DebugFormat("Skipping scanning directory {0} because it is a Offline or a Device.", directory.FullName);
                result = false;
            }
            else if (!ScanSystem && (directory.Attributes & FileAttributes.System) == FileAttributes.System)
            {
                _log.DebugFormat("Skipping scanning directory {0} because it is a System directory.", directory.FullName);
                result = false;
            }
            else if (!ScanHidden && (directory.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
            {
                _log.DebugFormat("Skipping scanning directory {0} because it is a Hidden directory.", directory.FullName);
                result = false;
            }

            if (IncludeFilters.Count > 0 && !FindFilesRegEx.MatchesFilePattern(directory.FullName, IncludeFilters.ToArray()))
            {
                return(false);
            }

            if (ExcludeFilters.Count > 0 && FindFilesRegEx.MatchesFilePattern(directory.FullName, ExcludeFilters.ToArray()))
            {
                return(false);
            }
            return(result);
        }
        private bool ShouldAddFile(IFileSystemInfo fileInfo)
        {
            var result = true;

            if (!ScanHidden && (fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
            {
                _log.DebugFormat("Skipping scanning file {0}.", fileInfo.FullName);
                result = false;
            }
            else if (!ScanSystem && (fileInfo.Attributes & FileAttributes.System) == FileAttributes.System)
            {
                _log.DebugFormat("Skipping scanning file {0}.", fileInfo.FullName);
                result = false;
            }
            else if (IncludeFilters.Count > 0 && !FindFilesRegEx.MatchesFilePattern(fileInfo.FullName, IncludeFilters.ToArray()))
            {
                return(false);
            }
            else if (ExcludeFilters.Count > 0 && FindFilesRegEx.MatchesFilePattern(fileInfo.FullName, ExcludeFilters.ToArray()))
            {
                return(false);
            }
            return(result);
        }