Ejemplo n.º 1
0
        public List <File> SearchFile(Regex regex)
        {
            var files = new List <File>();

            LoadFiles();
            LoadSubDirectories();

            ContainedFiles.ToList().ForEach(file =>
            {
                if (regex.IsMatch(file.Name))
                {
                    files.Add(file);
                }
            }
                                            );
            SubDirectories.ToList().ForEach(directory =>
            {
                try
                {
                    files.AddRange(directory.SearchFile(regex));
                }
                catch (UnauthorizedAccessException e)
                {
                    Debug.WriteLine(e.Source);
                }
            });
            return(files);
        }
Ejemplo n.º 2
0
        public override long GetSize()
        {
            long occupiedSpace = 0;

            LoadFiles();
            LoadSubDirectories();

            ContainedFiles.ToList().ForEach(file => occupiedSpace      += file.GetSize());
            SubDirectories.ToList().ForEach(directory => occupiedSpace += directory.GetSize());
            return(occupiedSpace);
        }