Inheritance: StringCollectionWithGoodToString
コード例 #1
0
        /// <summary>
        /// Creates a shallow copy of the <see cref="DirScannerStringCollection" />.
        /// </summary>
        /// <returns>
        /// A shallow copy of the <see cref="DirScannerStringCollection" />.
        /// </returns>
        public override object Clone()
        {
            string[] strings = new string[Count];
            CopyTo(strings, 0);
            DirScannerStringCollection clone = new DirScannerStringCollection();

            clone.AddRange(strings);
            return(clone);
        }
コード例 #2
0
 private void Reset()
 {
     _includePatterns      = null;
     _includeNames         = null;
     _excludePatterns      = null;
     _excludeNames         = null;
     _fileNames            = null;
     _directoryNames       = null;
     _searchDirectories    = null;
     _searchDirIsRecursive = null;
     _scannedDirectories   = null;
 }
コード例 #3
0
        /// <summary>
        /// Uses <see cref="Includes" /> and <see cref="Excludes" /> search criteria (relative to
        /// <see cref="BaseDirectory" /> or absolute), to search for filesystem objects.
        /// </summary>
        public void Scan()
        {
            _includePatterns = new ArrayList();
            _includeNames    = new StringCollectionWithGoodToString();
            _excludePatterns = new ArrayList();
            _excludeNames    = new StringCollectionWithGoodToString();
            _fileNames       = new StringCollectionWithGoodToString();
            _directoryNames  = new DirScannerStringCollection(CaseSensitive);

            _searchDirectories    = new DirScannerStringCollection(CaseSensitive);
            _searchDirIsRecursive = new ArrayList();
            _scannedDirectories   = new DirScannerStringCollection(CaseSensitive);

#if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
            Console.WriteLine("DirectoryScanner.Scan()");
            Console.WriteLine("*********************************************************************");
            Console.WriteLine(new System.Diagnostics.StackTrace().ToString());


            Console.WriteLine("Base Directory: " + BaseDirectory.FullName);
            Console.WriteLine("Includes:");
            foreach (string strPattern in _includes)
            {
                Console.WriteLine(strPattern);
            }
            Console.WriteLine("Excludes:");
            foreach (string strPattern in _excludes)
            {
                Console.WriteLine(strPattern);
            }

            Console.WriteLine("--- Starting Scan ---");
#endif

            // convert given NAnt patterns to regex patterns with absolute paths
            // side effect: searchDirectories will be populated
            ConvertPatterns(_includes, _includePatterns, _includeNames, true);
            ConvertPatterns(_excludes, _excludePatterns, _excludeNames, false);

            for (int index = 0; index < _searchDirectories.Count; index++)
            {
                ScanDirectory(_searchDirectories[index], (bool)_searchDirIsRecursive[index]);
            }

#if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
#endif
        }
コード例 #4
0
ファイル: DirectoryScanner.cs プロジェクト: RoastBoy/nant
 private void Reset () 
 {
     _isEverythingIncluded = true;
     _hasEmptyDirectories = false;
     _baseDirFileSystem.Clear();
     _includePatterns = null;
     _includeNames = null;
     _excludePatterns = null;
     _excludeNames = null;
     _fileNames = null;
     _directoryNames = null;
     _excludedFileNames = null;
     _excludedDirectoryNames = null;
     _searchDirectories = null;
     _searchDirIsRecursive = null;
     _scannedDirectories = null;
 }
コード例 #5
0
ファイル: DirectoryScanner.cs プロジェクト: RoastBoy/nant
        /// <summary>
        /// Uses <see cref="Includes" /> and <see cref="Excludes" /> search criteria (relative to 
        /// <see cref="BaseDirectory" /> or absolute), to search for filesystem objects.
        /// </summary>
        public void Scan() {
            Thread getDirList;
            
            _includePatterns = new ArrayList();
            _includeNames = new StringCollectionWithGoodToString ();
            _excludePatterns = new ArrayList();
            _excludeNames = new StringCollectionWithGoodToString ();
            _fileNames = new StringCollectionWithGoodToString ();
            _directoryNames = new DirScannerStringCollection(CaseSensitive);
            _excludedFileNames = new StringCollectionWithGoodToString();
            _excludedDirectoryNames = new DirScannerStringCollection(CaseSensitive);

            _searchDirectories = new DirScannerStringCollection(CaseSensitive);
            _searchDirIsRecursive = new ArrayList();
            _scannedDirectories = new DirScannerStringCollection(CaseSensitive);

#if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
            Console.WriteLine("DirectoryScanner.Scan()");
            Console.WriteLine("*********************************************************************");
            Console.WriteLine(new System.Diagnostics.StackTrace().ToString());


            Console.WriteLine("Base Directory: " + BaseDirectory.FullName);
            Console.WriteLine("Includes:");
            foreach (string strPattern in _includes)
                Console.WriteLine(strPattern);
            Console.WriteLine("Excludes:");
            foreach (string strPattern in _excludes)
                Console.WriteLine(strPattern);

            Console.WriteLine("--- Starting Scan ---");
#endif
            // Begin scanning the base directory file system
            if (_baseDirFileSystem != null) _baseDirFileSystem.Clear();
            
            // Gather all of the file system info objects in the background while
            // scan is performing.  Hoping this will save some time.
            getDirList = new Thread(new ParameterizedThreadStart(GetAllFileSystemInfo));
            getDirList.IsBackground = true;
            getDirList.Start(BaseDirectory);

            // convert given NAnt patterns to regex patterns with absolute paths
            // side effect: searchDirectories will be populated
            ConvertPatterns(_includes, _includePatterns, _includeNames, true);
            ConvertPatterns(_excludes, _excludePatterns, _excludeNames, false);

            for (int index = 0; index < _searchDirectories.Count; index++) {
                ScanDirectory(_searchDirectories[index], (bool) _searchDirIsRecursive[index]);
            }
            
            // Wait for the directory scan to finish before checking if
            // everything is included and if there are any empty directories.
            getDirList.Join();

            // Run both "Check" methods in parallel.
#if NET_4_0
            Parallel.Invoke(CheckHasEmptyDirectories, CheckIsEverythingIncluded);
#else
            Thread[] lastTasks = new Thread[2];
            lastTasks[0] = new Thread(new ThreadStart(CheckHasEmptyDirectories));
            lastTasks[1] = new Thread(new ThreadStart(CheckIsEverythingIncluded));
            
            foreach (Thread t in lastTasks)
            {
                t.IsBackground = true;
                t.Start();
            }
            foreach (Thread t in lastTasks) t.Join();
#endif

#if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
#endif
        }
コード例 #6
0
ファイル: DirectoryScanner.cs プロジェクト: RoastBoy/nant
 /// <summary>
 /// Creates a shallow copy of the <see cref="DirScannerStringCollection" />.
 /// </summary>
 /// <returns>
 /// A shallow copy of the <see cref="DirScannerStringCollection" />.
 /// </returns>
 public override object Clone() {
     string[] strings = new string[Count];
     CopyTo(strings, 0);
     DirScannerStringCollection clone = new DirScannerStringCollection(CaseSensitive);
     clone.AddRange(strings);
     return clone;
 }
コード例 #7
0
ファイル: DirectoryScanner.cs プロジェクト: robrich/nant
 private void Reset()
 {
     _includePatterns = null;
     _includeNames = null;
     _excludePatterns = null;
     _excludeNames = null;
     _fileNames = null;
     _directoryNames = null;
     _searchDirectories = null;
     _searchDirIsRecursive = null;
     _scannedDirectories = null;
 }
コード例 #8
0
ファイル: DirectoryScanner.cs プロジェクト: robrich/nant
        /// <summary>
        /// Uses <see cref="Includes" /> and <see cref="Excludes" /> search criteria (relative to 
        /// <see cref="BaseDirectory" /> or absolute), to search for filesystem objects.
        /// </summary>
        public void Scan()
        {
            _includePatterns = new ArrayList();
            _includeNames = new StringCollectionWithGoodToString ();
            _excludePatterns = new ArrayList();
            _excludeNames = new StringCollectionWithGoodToString ();
            _fileNames = new StringCollectionWithGoodToString ();
            _directoryNames = new DirScannerStringCollection(CaseSensitive);

            _searchDirectories = new DirScannerStringCollection(CaseSensitive);
            _searchDirIsRecursive = new ArrayList();
            _scannedDirectories = new DirScannerStringCollection(CaseSensitive);

            #if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
            Console.WriteLine("DirectoryScanner.Scan()");
            Console.WriteLine("*********************************************************************");
            Console.WriteLine(new System.Diagnostics.StackTrace().ToString());

            Console.WriteLine("Base Directory: " + BaseDirectory.FullName);
            Console.WriteLine("Includes:");
            foreach (string strPattern in _includes)
                Console.WriteLine(strPattern);
            Console.WriteLine("Excludes:");
            foreach (string strPattern in _excludes)
                Console.WriteLine(strPattern);

            Console.WriteLine("--- Starting Scan ---");
            #endif

            // convert given NAnt patterns to regex patterns with absolute paths
            // side effect: searchDirectories will be populated
            ConvertPatterns(_includes, _includePatterns, _includeNames, true);
            ConvertPatterns(_excludes, _excludePatterns, _excludeNames, false);

            for (int index = 0; index < _searchDirectories.Count; index++) {
                ScanDirectory(_searchDirectories[index], (bool) _searchDirIsRecursive[index]);
            }

            #if DEBUG_REGEXES
            Console.WriteLine("*********************************************************************");
            #endif
        }