30 new FileEntry(
"FileA.txt", 101, DateTime.Now),
31 new FileEntry(
"FileB.txt", 102, DateTime.Now),
32 new FileEntry(
"FileC.txt", 103, DateTime.Now),
33 new DirEntry(
"subdir1", DateTime.Now, new FileDirEntry[] {
34 new FileEntry(
"FileD.txt", 104, DateTime.Now),
35 new FileEntry(
"FileE.txt", 105, DateTime.Now),
36 new DirEntry(
"subdir2", DateTime.Now, new FileDirEntry[] {
37 new FileEntry(
"FileF.txt", 106, DateTime.Now),
38 new FileEntry(
"FileG.txt", 107, DateTime.Now)
56 string[] pathComponents = filepath.Split(
'/');
57 int numComponents = pathComponents.
Length;
58 for (
int index = 0; index < numComponents; ++index)
60 if (root.
Name != pathComponents[index])
66 if (index + 1 >= numComponents)
85 string childComponent = pathComponents[index + 1];
88 if (childComponent == child.
Name)
120 filepath = filepath.Replace(
'\\',
'/');
123 if (filedirEntry ==
null)
125 string msg = String.Format(
"Unable to find '{0}'", filepath);
126 throw new FileNotFoundException(msg);
static FileDirEntry * _FindEntry(char *path)
Search the file/directory "tree" for an entry that matches the given file "path". The file path is a ...
Static class containing functions for accessing a hardcoded "file" and "directory" hierarchy.
static FileDirEntry GetEntry(string filepath)
Return a FileDirEntry object representing the specified file "path" in an internal list of data entri...
static ? FileDirEntry _FindEntry(string filepath)
Helper method to search the static data list for the specified file/dir entry.
static FileDirEntry rootEntry
Represents a Directory entry.
Base class representing a File or Directory entry.
virtual long Length
The length in bytes of this entry. Directory entries are the sum of the length of all children.
virtual ? FileDirEntry[] Children
The children of this entry. Is null if the entry can never have any children (that is,...
virtual string Name
The name of this entry.
The namespace containing all Design Pattern Examples implemented in C#.