AbsRelPaths

References
public sealed class AbsRelPaths : IEquatable<AbsRelPaths>
A pair consisting of an absolute and relative path on a file system.

Constructors

AbsRelPaths

#
public AbsRelPaths(FileSystemPath absolute, FileSystemPath relative)
Create a new file path. Arguments may not both be null. If both are specified, it is up to the caller to ensure they are mutually correct.
absolute (FileSystemPath)Absolute path.
relative (FileSystemPath)Relative path.
ArgumentNullExceptionThrown if both the uris are null.

Properties

Absolute

#
public FileSystemPath Absolute { get; }
Gets the absolute path. If null, the relative path will be set.

FileExtension

#
public string FileExtension { get; }
Gets the file extension as specified by either path.

FileName

#
public string FileName { get; }
Gets the filename as specified by either path.

HasAbsolute

#
public bool HasAbsolute { get; }
Gets whether the Absolute uri has been set.

HasBoth

#
public bool HasBoth { get; }
Gets whether both the Absolute and Relative uris have been set.

HasRelative

#
public bool HasRelative { get; }
Gets whether the Relative uri has been set.

Relative

#
public FileSystemPath Relative { get; }
Gets the relative path. If null, the absolute path will be set.

Methods

Equals

#
public bool Equals(AbsRelPaths other)
other (AbsRelPaths)

Equals

#
public override bool Equals(object obj)
obj (object)
Object.Equals

FromAbsolute

#
public static AbsRelPaths FromAbsolute(string absolute, string origin = null)
Create a path pair from an absolute file path and a base uri.
absolute (string)
origin (string = null)

GetHashCode

#
public override int GetHashCode()

Resolve

#
public string Resolve(string origin, out string absolute, out string relative, out bool absoluteExists, out bool relativeExists)
Resolve the absolute paths implied by this pair.
origin (string)Origin, required to resolve the relative path.
absolute (out string)The absolute path, if available.
relative (out string)The absolute path as implied by the origin and the relative path.
absoluteExists (out bool)If the 'absolute' path was set, a value indicating whether there's a file there.
relativeExists (out bool)If the 'relative' path was resolved, a value indicating whether there's a file there.
The suggested path. This is the relative path if it can be resolved and points to an existing file, otherwise it's the absolute path if it points to an existing file. If neither path specify a file, null is returned.

Resolve

#
public string Resolve(string origin, out string absolute, out string relative)
Resolve the absolute paths implied by this pair.
origin (string)Origin, required to resolve the relative path.
absolute (out string)The absolute path, if available.
relative (out string)The absolute path as implied by the origin and the relative path.
The suggested path. This is always the relative path if it can be resolved.

ToString

#
public override string ToString()
Object.ToString

WithRelative

#
public AbsRelPaths WithRelative(FileSystemPath origin)
If this pair contains an absolute but not a relative uri, create a new pair with a relative Uri from the baseUri to the Absolute uri.
origin (FileSystemPath)Base uri.
This pair, or a pair with a specified relative uri.