/// <summary>
        /// Returns directories and files that are stored in the specified directory
        /// </summary>
        /// <param name="dir">Start directory</param>
        /// <param name="cancelRecursionFlag">Flag to cancel searching</param>
        /// <returns>Directories and files that are stored in the specified directory</returns>
        private IEnumerable <FileSystemInfoBase> GetDirectoryItems(DirectoryInfoBase dir, ref bool cancelRecursionFlag)
        {
            var result = new List <FileSystemInfoBase>();

            if (cancelRecursionFlag)
            {
                return(result);
            }

            foreach (var directory in dir.EnumerateDirectories())
            {
                var eventParams = new ItemFindedEventArgs {
                    FullName = directory.FullName
                };
                OnDirectoryFinded(eventParams);

                if (eventParams.CancelSearching)
                {
                    cancelRecursionFlag = true;
                    result.Add(directory);
                    return(result);
                }

                if (!eventParams.ExcludeItemFromResult)
                {
                    result.Add(directory);
                }

                result.AddRange(GetDirectoryItems(directory, ref cancelRecursionFlag));
                if (cancelRecursionFlag)
                {
                    return(result);
                }
            }
            foreach (var fileInfo in dir.EnumerateFiles())
            {
                var eventParams = new ItemFindedEventArgs {
                    FullName = fileInfo.FullName
                };
                OnFileFinded(eventParams);

                if (eventParams.CancelSearching)
                {
                    cancelRecursionFlag = true;
                    result.Add(fileInfo);
                    return(result);
                }

                if (!eventParams.ExcludeItemFromResult)
                {
                    result.Add(fileInfo);
                }
            }
            return(result);
        }
        /// <summary>
        /// Raises the FileSystemVisitor FilteredDirectoryFinded event
        /// </summary>
        /// <param name="args">The event data for the FilteredDirectoryFinded event</param>
        protected virtual void OnFilteredDirectoryFinded(ItemFindedEventArgs args)
        {
            var tmp = FilteredDirectoryFinded;

            tmp?.Invoke(this, args);
        }