private void OpenFiles() { for (var i = 0; i < _fileStreams;) { try { _fs[i] = FileEqualityComparer.OpenFile(_df._files[_start + i]); i++; } catch (FileSystemInfoException ex) { _df.OnError(ex); _fileStreams--; _df._files.Swap(_start + i, _start + _fileStreams); } } }
private void AddDirectory(DirectoryInfo curDir) { try { foreach (var fsi in curDir.EnumerateFileSystemInfos()) { if (fsi is FileInfo file) { AddFile(file); } else if (fsi is DirectoryInfo dir) { _stack.Add(dir); } } } catch (Exception ex) when(ex is IOException || ex is UnauthorizedAccessException || ex is SecurityException) { _df.OnError(new FileSystemInfoException(curDir, ex)); } }