Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 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;
 }