-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileSystemEntry.cs
More file actions
95 lines (81 loc) · 2.22 KB
/
Copy pathFileSystemEntry.cs
File metadata and controls
95 lines (81 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace c2flux
{
public sealed class FileSystemEntry
{
private List<FileSystemEntry> _allFiles;
private List<FileSystemEntry> _children;
private string _fullPath;
internal FileSystemEntry ParentEntry { get; set; }
public string Name { get; set; }
public string FullPath
{
get
{
if (!string.IsNullOrWhiteSpace(_fullPath))
{
return _fullPath;
}
if (ParentEntry == null ||
string.IsNullOrWhiteSpace(Name))
{
return _fullPath;
}
string parentPath = ParentEntry.FullPath;
if (string.IsNullOrWhiteSpace(parentPath))
{
return _fullPath;
}
_fullPath = Path.Combine(parentPath, Name);
return _fullPath;
}
set
{
_fullPath = value;
}
}
public long SizeBytes { get; set; }
public bool IsDirectory { get; set; }
public System.DateTime LastWriteTimeUtc { get; set; }
public List<FileSystemEntry> AllFiles
{
get
{
if (_allFiles == null)
{
_allFiles = new List<FileSystemEntry>();
}
return _allFiles;
}
set
{
_allFiles = value;
}
}
public List<FileSystemEntry> Children
{
get
{
if (_children == null)
{
_children = new List<FileSystemEntry>();
}
return _children;
}
set
{
_children = value;
}
}
public int DirectoryCount
{
get { return Children.Count(child => child.IsDirectory); }
}
public int FileCount
{
get { return Children.Count(child => !child.IsDirectory); }
}
}
}