StauffConsulting.Essentials.

FileSystemPath

C#: 
public class FileSystemPath :
    object,
    System.IComparable

VB: 
Public Class FileSystemPath
    Inherits Object
    Implements System.IComparable

Type Ancestry:  Object
+---FileSystemPath


An immutable object representing a file system path.

Summary Info

Constructor Summary

FileSystemPath constructor
FileSystemPath constructor, using DefaultDirectorySeparator

Field Summary

staticchar DefaultDirectorySeparator Used for the creation of FileSystemPaths. Changing this variable does *NOT* affect existing FileSystemPaths.
readonlychar DirectorySeparator The directory separator character used in this path.
readonlybool IsRelative Returns whether the path is relative. Always equal to ! IsAbsolute.
readonlystring PathName The normalized path name (not necessarily rooted). Redundant "." and ".." directories have been removed.

Property Summary

bool ContainsWildcards Returns whether the path contains any wildcards.
bool IsAbsolute Returns whether the path is absolute. Always equal to ! IsRelative.
string ParentDirectory The parent directory of this file system object. If no parent directory was specified, returns null.
string TerminalExtension The (final) extension on the terminal name, NOT including the dot. Returns an empty string if there's no extension.
string TerminalName The terminal name in the path; that is, the file name (if the path denotes a file).
string TerminalNameWithoutExtension The terminal name, minus its (final) extension, if any. If the terminal name has multiple extensions, only the final one is removed; e.g. "a.b.c" -> "a.b".

Method Summary

CompareTo
Contains Returns whether this path contains the given sub-path.
CreateTemporaryFile Creates a temporary file with (hopefully) a name that won't collide with some other file. An empty file is created.
Equals
Exists Queries the file system to determine whether the path denotes an existing file or directory.
GetHashCode
GetParentDirectoryName Returns the name of the parent directory; that is, the path minus the terminal name.
GetParts Returns an array containing the parts (directories) of the path.
GetRelativeTo Returns a path equivalent to this path, relative to the given path. Returns null if the paths are equal.
IsDirectory Queries the file system to determine whether the path denotes an existing directory.
IsFile Queries the file system to determine whether the path denotes an existing file.
NormalizePath Normalizes the given path by removing "." and extraneous "..", and making directory separators consistent. Does *NOT* convert a relative path to a fully qualified path.
op_Addition Concatenates two paths. The second path must be a relative path.
op_Addition Concatenates two paths. The second path must be a relative path.
op_Equality Tests two paths for equality.
op_Inequality Tests two paths for equality.
RemoveTerminalComponent
ToString

Miscellany Summary

Constructor Details


FileSystemPath

C#: 
FileSystemPath (string path,
    char directorySeparator)

VB: 
Sub New(ByVal path As String, ByVal directorySeparator As Char)

constructor

Parameters

path   an absolute or relative path
directorySeparator   the directory separator character


FileSystemPath

C#: 
FileSystemPath (string path)

VB: 
Sub New(ByVal path As String)

constructor, using DefaultDirectorySeparator

Parameters

path   an absolute or relative path

Field Details


DefaultDirectorySeparator

C#: 
static char DefaultDirectorySeparator;

VB: 
Shared DefaultDirectorySeparator As Char

Used for the creation of FileSystemPaths. Changing this variable does *NOT* affect existing FileSystemPaths.


DirectorySeparator

C#: 
readonly char DirectorySeparator;

VB: 
ReadOnly DirectorySeparator As Char

The directory separator character used in this path.


IsRelative

C#: 
readonly bool IsRelative;

VB: 
ReadOnly IsRelative As Boolean

Returns whether the path is relative. Always equal to ! IsAbsolute.


PathName

C#: 
readonly string PathName;

VB: 
ReadOnly PathName As String

The normalized path name (not necessarily rooted). Redundant "." and ".." directories have been removed.

Property Details


ContainsWildcards

C#: 
bool ContainsWildcards

VB: 
Property ContainsWildcards() As Boolean

Accessors:   get only

Returns whether the path contains any wildcards.


IsAbsolute

C#: 
bool IsAbsolute

VB: 
Property IsAbsolute() As Boolean

Accessors:   get only

Returns whether the path is absolute. Always equal to ! IsRelative.


ParentDirectory

C#: 
string ParentDirectory

VB: 
Property ParentDirectory() As String

Accessors:   get only

The parent directory of this file system object. If no parent directory was specified, returns null.


TerminalExtension

C#: 
string TerminalExtension

VB: 
Property TerminalExtension() As String

Accessors:   get only

The (final) extension on the terminal name, NOT including the dot. Returns an empty string if there's no extension.


TerminalName

C#: 
string TerminalName

VB: 
Property TerminalName() As String

Accessors:   get only

The terminal name in the path; that is, the file name (if the path denotes a file).


TerminalNameWithoutExtension

C#: 
string TerminalNameWithoutExtension

VB: 
Property TerminalNameWithoutExtension() As String

Accessors:   get only

The terminal name, minus its (final) extension, if any. If the terminal name has multiple extensions, only the final one is removed; e.g. "a.b.c" -> "a.b".

Method Details


CompareTo

C#: 
Int32 CompareTo(object obj)

VB: 
Function CompareTo(ByVal obj As Object) As Int32

Parameters

obj  


Contains

C#: 
Boolean Contains(StauffConsulting.Essentials.FileSystemPath that)

VB: 
Function Contains(ByVal that As StauffConsulting.Essentials.FileSystemPath) As [Boolean]

Returns whether this path contains the given sub-path.

Parameters

that  


CreateTemporaryFile

C#: 
static FileStream CreateTemporaryFile(string prefix,
    string suffix,
    string dir)

VB: 
Shared Function CreateTemporaryFile(ByVal prefix As String, ByVal suffix As String, ByVal dir As String) As FileStream

Creates a temporary file with (hopefully) a name that won't collide with some other file. An empty file is created.

Parameters

prefix   a prefix for the file name, or null
suffix   a suffix for the file name (such as an extension), or null
dir   the directory in which to create the file


Equals

C#: 
Boolean Equals(object obj)

VB: 
Function Equals(ByVal obj As Object) As [Boolean]

Parameters

obj  


Exists

C#: 
Boolean Exists()

VB: 
Function Exists() As [Boolean]

Queries the file system to determine whether the path denotes an existing file or directory.


GetHashCode

C#: 
Int32 GetHashCode()

VB: 
Function GetHashCode() As Int32


GetParentDirectoryName

C#: 
String GetParentDirectoryName()

VB: 
Function GetParentDirectoryName() As [String]

Returns the name of the parent directory; that is, the path minus the terminal name.


GetParts

C#: 
String[] GetParts()

VB: 
Function GetParts() As [String]()

Returns an array containing the parts (directories) of the path.


GetRelativeTo

C#: 
FileSystemPath GetRelativeTo(StauffConsulting.Essentials.FileSystemPath relativeToPath)

VB: 
Function GetRelativeTo(ByVal relativeToPath As StauffConsulting.Essentials.FileSystemPath) As FileSystemPath

Returns a path equivalent to this path, relative to the given path. Returns null if the paths are equal.

Parameters

relativeToPath  


IsDirectory

C#: 
Boolean IsDirectory()

VB: 
Function IsDirectory() As [Boolean]

Queries the file system to determine whether the path denotes an existing directory.


IsFile

C#: 
Boolean IsFile()

VB: 
Function IsFile() As [Boolean]

Queries the file system to determine whether the path denotes an existing file.


NormalizePath

C#: 
static String NormalizePath(string path,
    char dirSep)

VB: 
Shared Function NormalizePath(ByVal path As String, ByVal dirSep As Char) As [String]

Normalizes the given path by removing "." and extraneous "..", and making directory separators consistent. Does *NOT* convert a relative path to a fully qualified path.

Parameters

path  
dirSep  


op_Addition

C#: 
static FileSystemPath op_Addition(StauffConsulting.Essentials.FileSystemPath path,
    string str)

VB: 
Shared Function op_Addition(ByVal path As StauffConsulting.Essentials.FileSystemPath, ByVal str As String) As FileSystemPath

Concatenates two paths. The second path must be a relative path.

Parameters

path  
str  


op_Addition

C#: 
static FileSystemPath op_Addition(StauffConsulting.Essentials.FileSystemPath p1,
    StauffConsulting.Essentials.FileSystemPath p2)

VB: 
Shared Function op_Addition(ByVal p1 As StauffConsulting.Essentials.FileSystemPath, ByVal p2 As StauffConsulting.Essentials.FileSystemPath) As FileSystemPath

Concatenates two paths. The second path must be a relative path.

Parameters

p1  
p2  


op_Equality

C#: 
static Boolean op_Equality(StauffConsulting.Essentials.FileSystemPath p1,
    StauffConsulting.Essentials.FileSystemPath p2)

VB: 
Shared Function op_Equality(ByVal p1 As StauffConsulting.Essentials.FileSystemPath, ByVal p2 As StauffConsulting.Essentials.FileSystemPath) As [Boolean]

Tests two paths for equality.

Parameters

p1  
p2  


op_Inequality

C#: 
static Boolean op_Inequality(StauffConsulting.Essentials.FileSystemPath p1,
    StauffConsulting.Essentials.FileSystemPath p2)

VB: 
Shared Function op_Inequality(ByVal p1 As StauffConsulting.Essentials.FileSystemPath, ByVal p2 As StauffConsulting.Essentials.FileSystemPath) As [Boolean]

Tests two paths for equality.

Parameters

p1  
p2  


RemoveTerminalComponent

C#: 
static String RemoveTerminalComponent(string path,
    System.String& terminalComponent)

VB: 
Shared Function RemoveTerminalComponent(ByVal path As String, ByVal terminalComponent As System.String&) As [String]

Parameters

path  
terminalComponent  


ToString

C#: 
String ToString()

VB: 
Function ToString() As [String]


generated by DocGenDotNet on 18 Nov 2008 6:35:01 PM