/// <summary>
        /// Uses <see cref="Includes" /> and <see cref="Excludes" /> search criteria (relative to 
        /// <see cref="BaseDirectory" /> or absolute), to search for filesystem objects.
        /// </summary>
        /// <history>
        ///     <change date="20020220" author="Ari Hännikäinen">Totally changed the scanning strategy</change>
        ///     <change date="20020221" author="Ari Hännikäinen">Changed it again because of performance reasons</change>
        /// </history>
        public new void Scan()
        {
            _includePatterns = new ArrayList();
            _includeNames = new StringCollectionWithGoodToString ();
            _excludePatterns = new ArrayList();
            _excludeNames = new StringCollectionWithGoodToString ();
            _fileNames = new ArrayList();
            _directoryNames = new DirScannerStringCollection(_conn);
            _searchDirectories = new DirScannerStringCollection(_conn);
            _searchDirIsRecursive = new ArrayList();
            _scannedDirectories = new DirScannerStringCollection(_conn);

               	_conn.Log(_conn.LevelExec, "Scanning remotely for <get ... /> include patterns...");

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

            Console.WriteLine("Base Directory: " + BaseDirectory);
            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
        }
 /// <summary>
 /// Creates a shallow copy of the <see cref="StringCollectionWithGoodToString" />.
 /// </summary>
 /// <returns>
 /// A shallow copy of the <see cref="StringCollectionWithGoodToString" />.
 /// </returns>
 public virtual object Clone()
 {
     string[] strings = new string[Count];
     CopyTo(strings, 0);
     StringCollectionWithGoodToString clone = new StringCollectionWithGoodToString();
     clone.AddRange(strings);
     return clone;
 }