Table of Contents

Class PathInternal

Namespace
SunamoShared.SE.Helpers.FileSystem.RelPath
Assembly
SunamoShared.dll

Provides internal path manipulation utilities for relative path resolution.

public class PathInternal
Inheritance
PathInternal
Inherited Members
Extension Methods

Fields

AltDirectorySeparatorChar

The alternative directory separator character (forward slash).

public const char AltDirectorySeparatorChar = '/'

Field Value

char

DevicePrefixLength

Length of the device prefix (\?\ or \.).

public const int DevicePrefixLength = 4

Field Value

int

DirectorySeparatorChar

The primary directory separator character (backslash on Windows).

public const char DirectorySeparatorChar = '\\'

Field Value

char

UncExtendedPrefixLength

Length of the extended UNC prefix (\?\UNC\ or \.\UNC).

public const int UncExtendedPrefixLength = 8

Field Value

int

UncPrefixLength

Length of the UNC prefix (\).

public const int UncPrefixLength = 2

Field Value

int

VolumeSeparatorChar

The volume separator character (colon on Windows).

public const char VolumeSeparatorChar = ':'

Field Value

char

Properties

IsCaseSensitive

Gets whether the system is case-sensitive.

public static bool IsCaseSensitive { get; }

Property Value

bool

StringComparison

Returns a comparison that can be used to compare file and directory names for equality.

public static StringComparison StringComparison { get; }

Property Value

StringComparison

Methods

AreRootsEqual(string, string, StringComparison)

Returns true if the two paths have the same root.

public static bool AreRootsEqual(string first, string second, StringComparison comparisonType)

Parameters

first string

The first path to compare.

second string

The second path to compare.

comparisonType StringComparison

The string comparison type to use.

Returns

bool

EndsInDirectorySeparator(ReadOnlySpan<char>)

Returns true if the path ends in a directory separator character.

public static bool EndsInDirectorySeparator(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to check.

Returns

bool

EndsInDirectorySeparator2(ReadOnlySpan<char>)

Returns true if the path ends in a directory separator character.

public static bool EndsInDirectorySeparator2(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to check.

Returns

bool

EqualStartingCharacterCount(string, string, bool)

Returns the number of characters that match at the start of two strings.

public static int EqualStartingCharacterCount(string first, string second, bool ignoreCase)

Parameters

first string

The first string to compare.

second string

The second string to compare.

ignoreCase bool

Whether to ignore character casing during comparison.

Returns

int

GetCommonPathLength(string, string, bool)

Get the common path length from the start of the string.

public static int GetCommonPathLength(string first, string second, bool ignoreCase)

Parameters

first string

The first path to compare.

second string

The second path to compare.

ignoreCase bool

Whether to ignore character casing during comparison.

Returns

int

GetRootLength(ReadOnlySpan<char>)

Gets the length of the root of the path (drive, share, etc.).

public static int GetRootLength(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to analyze.

Returns

int

IsDevice(ReadOnlySpan<char>)

Returns true if the path uses any of the DOS device path syntaxes. ("\.", @"\\?\", or "??")

public static bool IsDevice(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to check.

Returns

bool

IsDeviceUNC(ReadOnlySpan<char>)

Returns true if the path is a device UNC (\?\UNC, \.\UNC)

public static bool IsDeviceUNC(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to check.

Returns

bool

IsDirectorySeparator(char)

True if the given character is a directory separator.

public static bool IsDirectorySeparator(char c)

Parameters

c char

The character to check.

Returns

bool

IsExtended(ReadOnlySpan<char>)

Returns true if the path uses the canonical form of extended syntax (@"\\?\" or "??"). If the path matches exactly (cannot use alternate directory separators) Windows will skip normalization and path length checks.

public static bool IsExtended(ReadOnlySpan<char> path)

Parameters

path ReadOnlySpan<char>

The path to check.

Returns

bool

IsValidDriveChar(char)

Returns true if the given character is a valid drive letter

public static bool IsValidDriveChar(char value)

Parameters

value char

The character to check.

Returns

bool