Exemplo n.º 1
0
 /// <summary>
 /// Converts the specified absolute path into a relative path (relative to <c>this</c>).
 /// </summary>
 public FileName GetRelativePath(FileName path)
 {
     if (path == null)
     {
         return(null);
     }
     return(FileName.Create(DirectoryName.GetRelativePath(normalizedPath, path)));
 }
Exemplo n.º 2
0
        ////[Obsolete("The input already is a DirectoryName")]
        ////public static DirectoryName Create(DirectoryName directoryName)
        ////{
        ////	return directoryName;
        ////}

        /// <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)));
        }
Exemplo n.º 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)));
 }
Exemplo n.º 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));
 }
Exemplo 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, "..")));
     }
     return(DirectoryName.Create(Path.GetDirectoryName(NormalizedPath)));
 }
Exemplo n.º 6
0
 public bool Equals(DirectoryName other)
 {
     if (other != null)
     {
         return(string.Equals(NormalizedPath, other.NormalizedPath, StringComparison.OrdinalIgnoreCase));
     }
     return(false);
 }
Exemplo n.º 7
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(Create(GetRelativePath(NormalizedPath, path)));
 }