/// <summary> /// Combines this directory name with a relative path. /// </summary> public DirectoryName Combine(DirectoryName relativePath) { if (relativePath == null) { return(null); } return(DirectoryName.Create(Path.Combine(normalizedPath, relativePath))); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { return(DirectoryName.Create((string)value)); } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// Converts the specified absolute path into a relative path (relative to <c>this</c>). /// </summary> public DirectoryName GetRelativePath(DirectoryName path) { if (path == null) { return(null); } return(DirectoryName.Create(FileUtility.GetRelativePath(normalizedPath, path))); }
/// <summary> /// Combines this directory name with a relative path. /// </summary> public DirectoryName CombineDirectory(string relativeDirectoryName) { if (relativeDirectoryName == null) { return(null); } return(DirectoryName.Create(Path.Combine(normalizedPath, relativeDirectoryName))); }
/// <summary> /// Gets the directory name. /// </summary> /// <remarks> /// Corresponds to <c>System.IO.Path.GetDirectoryName</c> /// </remarks> public DirectoryName GetParentDirectory() { if (normalizedPath.Length < 2 || normalizedPath[1] != ':') { return(DirectoryName.Create(Path.Combine(normalizedPath, ".."))); } else { return(DirectoryName.Create(Path.GetDirectoryName(normalizedPath))); } }
public bool Equals(DirectoryName other) { if (other != null) { return(string.Equals(normalizedPath, other.normalizedPath, StringComparison.OrdinalIgnoreCase)); } else { return(false); } }
public static DirectoryName Create(DirectoryName directoryName) { return(directoryName); }