NodePath Class
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.Common.dll (version 7.0.9119)
Represents a file system path.
Syntax
public sealed class NodePath : IEnumerable<string>, IEnumerable, IEquatable<NodePath>
Inherited Members
Remarks
Instances of NodePath are case-insensitive, which means that Equals(NodePath) method (and the default IEqualityComparer available in Comparer property) treat all the following paths as equal:
- /ab/
- /AB/
- /aB/
- /Ab/
Constructors
Name | Description |
---|---|
NodePath(String) | Initializes a new instance of the NodePath. Examples of the valid path: / /dir1 /dir1/ /dir1/dir2 /dir1/dir2/ /dir1/dir2/file.txt |
Fields
Name | Description |
---|---|
DirectorySeparator | Used directory separator. |
Empty | Represents the empty NodePath. |
RootDirectoryName | Name of the root directory. |
Properties
Name | Description |
---|---|
AllowBackslashInFileName | Gets or sets a value indicating whether the backslash ('') character is allowed in FileName property. The default value is false, the backslash character is not allowed. Be aware that after the property is set to true, custom providers derived from the ReadOnlyFileSystemProvider and ReadWriteFileSystemProvider MUST check and sanitize all paths to prevent miscellaneous variations of path/directory traversal attacks. |
Comparer | Gets the IEqualityComparer that is used to determine equality of NodePath. |
Extension | Gets the file name extension, or Empty if this path does not have extension. |
FileName | Gets the name of the DirectoryNode or the FileNode. |
FileNameWithoutExtension | Gets the name without an extension. |
HasExtension | Indicates whether a path contains file name extension. |
IsEmpty | Returns true if this path equals to Empty path, otherwise returns false. |
IsRootPath | Indicates if this instance is the root path ('/'). |
Item[Int32] | Returns an element of this path. |
ParentPath | Gets the parent path, or Empty path if this path does not have parent. |
PathParts | Gets an enumerator that iterates through the elements of this path. |
PathPartsCount | Returns the number of elements in the path. |
StringPath |
Methods
Name | Description |
---|---|
AddExtension(String) | |
AddPathPart(String) | Creates new NodePath with |
ChangeExtension(String) | Creates new NodePath based on this NodePath and with the new |
Combine(String[]) | Combines strings in the |
Equals(NodePath) | Indicates whether the current NodePath is equal to another NodePath. |
Equals(Object) | Determines whether the specified NodePath is equal to the current NodePath. |
GetEnumerator() | Gets an enumerator that iterates through the elements of this path. |
GetHashCode() | Gets a hash code of this object. |
GetInvalidFileNameChars() | Returns an array of characters not allowed in Name. |
GetSubPath(Int32) | Returns a subpath that is a subsequence of the parts of this path.
Subpath starts with the first part (on the index 0) of this path
and ends with the part on the index Root path ('/') does not have any subpath.
For the NodePath with the path '/dir1/dir2/file.txt'; GetSubPath(0) returns '/dir1'. GetSubPath(1) returns '/dir1/dir2'. GetSubPath(2) returns 'dir1/dir2/file.txt'. GetSubPath(3) throws ArgumentOutOfRangeException. |
IsNullOrEmpty(NodePath) | Indicates whether the specified NodePath is null or an Empty instance of the NodePath. |
RemoveExtension() | Creates new NodePath based on this NodePath and with the extension deleted. |
StartsWith(NodePath) | Tests if this NodePath starts with the given |
ToString() | Returns a string that represents the current NodePath. |
Operators
Name | Description |
---|---|
Equality(NodePath, NodePath) | Determines whether two specified NodePath have the same value. |
Explicit(NodePath to String) | Convert the value of the |
Implicit(String to NodePath) | Convert the value of |
Inequality(NodePath, NodePath) | Determines whether two specified NodePath have different values. |
Explicit Interface Implementations
Name | Description |
---|---|
IEnumerable.GetEnumerator() | Gets an enumerator that iterates through the elements of this path. |