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