Example #1
0
        private DirectoryEntityCollection FilterFiles(DirectoryEntityCollection collection)
        {
            collection.Files = _filterAction?.Invoke(collection.Files) ?? collection.Files;

            for (var i = 0; i < collection.SubEntities.Length; i++)
            {
                collection.SubEntities[i] = FilterFiles(collection.SubEntities[i]);
            }

            FilteredFileFinded?.Invoke(ref args);
            if (args.RemoveDirectories.Any())
            {
                collection.RemoveFolder(args.RemoveDirectories);
            }
            if (args.RemoveFiles.Any())
            {
                collection.RemoveFiles(args.RemoveFiles);
            }
            if (args.StopSearching)
            {
                return(collection);
            }

            return(collection);
        }
Example #2
0
        private DirectoryEntityCollection GetDirectories(string path)
        {
            var result = new DirectoryEntityCollection();

            result.Directories = _systemEntityService.GetDirectories(path);

            var subFolders = new List <DirectoryEntityCollection>();

            if (result.Directories.Length > 0)
            {
                foreach (var item in result.Directories)
                {
                    subFolders.Add(GetDirectories(item));
                }
            }

            result.SubEntities = subFolders.ToArray();

            DirectoryFinded?.Invoke(ref args);
            if (args.RemoveDirectories.Any())
            {
                result.RemoveFolder(args.RemoveDirectories);
            }
            if (args.RemoveFiles.Any())
            {
                result.RemoveFiles(args.RemoveFiles);
            }
            if (args.StopSearching)
            {
                return(result);
            }

            return(result);
        }