Exemple #1
0
 /// <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)));
 }
Exemple #2
0
 /// <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)));
 }
Exemple #3
0
 /// <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)));
 }
Exemple #4
0
 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));
 }
Exemple #5
0
 public bool Equals(DirectoryName other)
 {
     if (other != null)
     {
         return(string.Equals(normalizedPath, other.normalizedPath, StringComparison.OrdinalIgnoreCase));
     }
     else
     {
         return(false);
     }
 }
Exemple #6
0
 /// <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)));
     }
 }
Exemple #7
0
 public static DirectoryName Create(DirectoryName directoryName)
 {
     return(directoryName);
 }
Exemple #8
0
 public DirectoryName(DirectoryName path)
     : base(path)
 {
 }