private IEnumerable <string> SearchInDirectory(string root)
        {
            foreach (var file in SearchInFiles(root))
            {
                yield return(file);
            }

            foreach (var subDirectory in Directory.EnumerateDirectories(root))
            {
                var directoryEventArgs = new DirectoryEventArgs {
                    Path = subDirectory
                };
                OnDirectoryFound(directoryEventArgs);

                if (directoryEventArgs.Stop)
                {
                    yield break;
                }

                if (!directoryEventArgs.Exclude && _filter(subDirectory))
                {
                    var filteredDirectoryEventArgs = new DirectoryEventArgs {
                        Path = subDirectory
                    };
                    OnFilteredDirectoryFound(directoryEventArgs);

                    if (filteredDirectoryEventArgs.Stop)
                    {
                        yield break;
                    }

                    if (!filteredDirectoryEventArgs.Exclude)
                    {
                        yield return(subDirectory);
                    }
                }

                foreach (var item in SearchInDirectory(subDirectory))
                {
                    yield return(item);
                }
            }
        }
 protected virtual void OnFilteredDirectoryFound(DirectoryEventArgs args)
 {
     FilteredDirectoryFound?.Invoke(this, args);
 }