-
Notifications
You must be signed in to change notification settings - Fork 0
/
PathInformation.cs
134 lines (121 loc) · 4.15 KB
/
PathInformation.cs
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* Copyright 2013 Corey Bonnell
This file is part of Aufs4Win.
Aufs4Win is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Aufs4Win is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Aufs4Win. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace Cbonnell.Aufs4Win
{
/// <summary>
/// Represents the kinds of file system objects
/// </summary>
public enum FileSystemObjectKind
{
/// <summary>
/// Represents a file system object that does not exist or is unknown
/// </summary>
None = 0,
/// <summary>
/// Represents a file system object that is a file
/// </summary>
File,
/// <summary>
/// Represents a file system object that is a directory
/// </summary>
Directory,
}
/// <summary>
/// Represents information about the physical (real) path of a file system object
/// </summary>
public class PathInformation
{
/// <summary>
/// Constructor for PathInformation.
/// </summary>
/// <param name="member">The<see cref="Member"/> in which the file system object at the designated path is contained</param>
/// <param name="objectKind">The <see cref="FileSystemObjectKind"/> of file system object</param>
/// <param name="realPath">The absolute path to the physical file system object</param>
public PathInformation(Member member, FileSystemObjectKind objectKind, string realPath)
{
if (member == null)
{
throw new ArgumentNullException("member");
}
if (realPath == null)
{
throw new ArgumentNullException("realPath");
}
this.member = member;
this.objectKind = objectKind;
this.realPath = realPath;
}
private readonly Member member;
/// <summary>
/// The <see cref="Member"/> in which the file system object is contained
/// </summary>
public Member ContainingMember
{
get
{
return this.member;
}
}
private readonly FileSystemObjectKind objectKind;
/// <summary>
/// The <see cref="FileSystemObjectKind"/> of the file system object
/// </summary>
public FileSystemObjectKind ObjectKind
{
get
{
return this.objectKind;
}
}
private readonly string realPath;
/// <summary>
/// The absolute path of the physical file system object
/// </summary>
public string RealPath
{
get
{
return this.realPath;
}
}
/// <summary>
/// Returns a string that contains human-readable information concerning the object
/// </summary>
/// <returns>Returns a human-readable string which contains information about the object</returns>
public override string ToString()
{
return String.Format("File object kind: {0}, Physical path: {1}", this.objectKind, this.realPath);
}
/// <summary>
/// Overridden GetHashCode
/// </summary>
public override int GetHashCode()
{
return this.realPath.GetHashCode();
}
/// <summary>
/// Overridden Equals
/// </summary>
public override bool Equals(object obj)
{
PathInformation otherPathInfo = obj as PathInformation;
if (otherPathInfo == null)
{
return false;
}
return (this.realPath == otherPathInfo.realPath);
}
}
}