Summary
Used for searching filesystem based on given include/exclude rules.
- Assembly
- NAnt
.Core .dll - Namespace
- NAnt
.Core - Interfaces
-
- ICloneable
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["ICloneable"]
Type["DirectoryScanner"]
class Type type-node
Syntax
[Serializable()]
public class DirectoryScanner : ICloneable
Examples
Simple client code for testing the class.
while (true) {
DirectoryScanner scanner = new DirectoryScanner();
Console.Write("Scan Basedirectory : ");
string s = Console.ReadLine();
if (s.Length == 0) break;
scanner.BaseDirectory = s;
while(true) {
Console.Write("Include pattern : ");
s = Console.ReadLine();
if (s.Length == 0) break;
scanner.Includes.Add(s);
}
while(true) {
Console.Write("Exclude pattern : ");
s = Console.ReadLine();
if (s.Length == 0) break;
scanner.Excludes.Add(s);
}
foreach (string name in scanner.FileNames)
Console.WriteLine("file:" + name);
foreach (string name in scanner.DirectoryNames)
Console.WriteLine("dir :" + name);
Console.WriteLine("");
}
Attributes
Type | Description |
---|---|
Serializable |
Constructors
Name | Summary |
---|---|
DirectoryScanner |
Initializes a new instance of the NAnt.Core.DirectoryScanner .
|
DirectoryScanner |
Initializes a new instance of the NAnt.Core.DirectoryScanner
specifying whether patterns are to be match case-sensitively.
|
Properties
Name | Value | Summary |
---|---|---|
BaseDirectory | DirectoryInfo |
The base directory to scan. The default is the
System.Environment.CurrentDirectory .
|
CaseSensitive | bool |
Gets or set a value indicating whether or not to use case-sensitive
pattern matching.
|
DirectoryNames | StringCollection |
Gets the list of directories that match the given included patterns.
|
Excluded |
StringCollection |
Gets the list of directories that match the given excluded patterns.
|
ExcludedFileNames | StringCollection |
Gets the list of files that match the given excluded patterns.
|
Excludes | StringCollection |
Gets the collection of exclude patterns.
|
FileNames | StringCollection |
Gets the list of files that match the given included patterns.
|
HasEmptyDirectories | bool |
Indicates whether or not
BaseDirectory contains
any empty directories.
|
Includes | StringCollection |
Gets the collection of include patterns.
|
IsEverythingIncluded | bool |
Indicates whether or not the directory scanner included everything
that it scanned.
|
ScannedDirectories | StringCollection |
Gets the list of directories that were scanned for files.
|
Methods
Name | Value | Summary |
---|---|---|
Clone |
Object |
Creates a shallow copy of the
NAnt.Core.DirectoryScanner .
|
Scan |
void |
Uses
NAnt.Core.DirectoryScanner.Includes and NAnt.Core.DirectoryScanner.Excludes search criteria (relative to
NAnt.Core.DirectoryScanner.BaseDirectory or absolute), to search for filesystem objects.
|