Reset() public method

public Reset ( ) : void
return void
示例#1
0
        private void TesterFileEnumerator(String path, MatchReason reason, WorkerData data)
        {
            if (data.worker.CancellationPending)
            {
                throw new CancelException();
            }

            // first look into directories
            String[] dirs = Directory.GetDirectories(path);
            foreach (String dir in dirs)
            {
                if (data.worker.CancellationPending)
                {
                    throw new CancelException();
                }
                string filename = ChopFilename(dir, data.len);

                // optimization, directory must pass global exclude filters
                // this is here mainly to not traverse .svn subdirectories
                reason.Reset();
                if (data.model.PassesGlobalFilters(filename, reason))
                {
                    TesterFileEnumerator(dir, reason, data);
                }
                else
                {
                    data.worker.ReportProgress(0, new ReportInfo(filename, dir, reason));
                }
                Thread.Sleep(10); // don't hung the UI thread
            }

            String[] files = Directory.GetFiles(path);
            // next look for files
            foreach (String file in files)
            {
                if (data.worker.CancellationPending)
                {
                    throw new CancelException();
                }
                string filename = ChopFilename(file, data.len);
                reason.Reset();
                lock (data.folder)
                {
                    try
                    {
                        if (data.folder.PassesFilters(filename, reason))
                        {
                            data.worker.ReportProgress(0, new ReportInfo(filename, file, reason));
                        }
                        else
                        {
                            data.worker.ReportProgress(0, new ReportInfo(filename, file, reason));
                        }
                    }
                    catch (Exception)
                    {
                        // hack
                    }
                }
                Thread.Sleep(10);                 // don't hung the UI thread
            }
        }