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
DevicePrefixLength
Length of the device prefix (\?\ or \.).
public const int DevicePrefixLength = 4
Field Value
DirectorySeparatorChar
The primary directory separator character (backslash on Windows).
public const char DirectorySeparatorChar = '\\'
Field Value
UncExtendedPrefixLength
Length of the extended UNC prefix (\?\UNC\ or \.\UNC).
public const int UncExtendedPrefixLength = 8
Field Value
UncPrefixLength
Length of the UNC prefix (\).
public const int UncPrefixLength = 2
Field Value
VolumeSeparatorChar
The volume separator character (colon on Windows).
public const char VolumeSeparatorChar = ':'
Field Value
Properties
IsCaseSensitive
Gets whether the system is case-sensitive.
public static bool IsCaseSensitive { get; }
Property Value
StringComparison
Returns a comparison that can be used to compare file and directory names for equality.
public static StringComparison StringComparison { get; }
Property Value
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
firststringThe first path to compare.
secondstringThe second path to compare.
comparisonTypeStringComparisonThe string comparison type to use.
Returns
EndsInDirectorySeparator(ReadOnlySpan<char>)
Returns true if the path ends in a directory separator character.
public static bool EndsInDirectorySeparator(ReadOnlySpan<char> path)
Parameters
pathReadOnlySpan<char>The path to check.
Returns
EndsInDirectorySeparator2(ReadOnlySpan<char>)
Returns true if the path ends in a directory separator character.
public static bool EndsInDirectorySeparator2(ReadOnlySpan<char> path)
Parameters
pathReadOnlySpan<char>The path to check.
Returns
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
firststringThe first string to compare.
secondstringThe second string to compare.
ignoreCaseboolWhether to ignore character casing during comparison.
Returns
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
firststringThe first path to compare.
secondstringThe second path to compare.
ignoreCaseboolWhether to ignore character casing during comparison.
Returns
GetRootLength(ReadOnlySpan<char>)
Gets the length of the root of the path (drive, share, etc.).
public static int GetRootLength(ReadOnlySpan<char> path)
Parameters
pathReadOnlySpan<char>The path to analyze.
Returns
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
pathReadOnlySpan<char>The path to check.
Returns
IsDeviceUNC(ReadOnlySpan<char>)
Returns true if the path is a device UNC (\?\UNC, \.\UNC)
public static bool IsDeviceUNC(ReadOnlySpan<char> path)
Parameters
pathReadOnlySpan<char>The path to check.
Returns
IsDirectorySeparator(char)
True if the given character is a directory separator.
public static bool IsDirectorySeparator(char c)
Parameters
ccharThe character to check.
Returns
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
pathReadOnlySpan<char>The path to check.
Returns
IsValidDriveChar(char)
Returns true if the given character is a valid drive letter
public static bool IsValidDriveChar(char value)
Parameters
valuecharThe character to check.