public bool Iterate(DirectoryIterator.Delegate directoryIteratorDelegate) { bool hasError = false; this._callback = directoryIteratorDelegate; try { if (File.Exists(this._path)) { ProcessFile(this._path); } else if (Directory.Exists(this._path)) { ProcessDirectory(this._path); } } catch (UnauthorizedAccessException uaex) { this._lastException = uaex; hasError = true; } catch (Exception ex) { throw ex; } return(!hasError); }
static bool ExecuteIterator(Options options, DirectoryIterator.Delegate callback, bool processFiles) { bool hasError = false; DirectoryIterator dirIter = new DirectoryIterator(options.SourcePath); dirIter.ProcessFiles = processFiles; dirIter.Tag = options; if (!dirIter.Iterate(callback)) { ReportIterateError(dirIter); hasError = true; } return(hasError); }
public bool Iterate(DirectoryIterator.Delegate directoryIteratorDelegate) { bool hasError = false; this._callback = directoryIteratorDelegate; try { if (File.Exists(this._path)) { ProcessFile(this._path); } else if (Directory.Exists(this._path)) { ProcessDirectory(this._path); } } catch (UnauthorizedAccessException uaex) { this._lastException = uaex; hasError = true; } catch (Exception ex) { throw ex; } return !hasError; }