Dependencies/XamlFileSystemExplorer/FSExplorer/FileSystemInfoEx/Tools/IOTools.cs
//0.13: Added HasParent
/// <summary>
/// Return whether parent directory contain child directory.
/// Aware UserFiles and Public directory too.
/// </summary>
/// <param name="child"></param>
/// <param name="parentFullName"></param>
/// <returns></returns>
Return whether parent directory contain child directory.
Aware UserFiles and Public directory too.
Return whether parent directory contain child directory . Aware UserFiles and Public directory too .
public static bool HasParent(FileSystemInfoEx child, string parentFullName)
        {
            if (child.FullName.StartsWith(parentFullName, StringComparison.InvariantCultureIgnoreCase))
                return true;
            if (parentFullName == DirectoryInfoEx.DesktopDirectory.FullName)
                return true;
            if ((child.FullName.StartsWith(IID_UserFiles) || child.FullName.StartsWith(IID_Public)))
                return false;
            FileSystemInfoEx current = child.Parent;
            while (current != null && parentFullName != current.FullName)
                current = current.Parent;
            return (current != null);
        }
public static bool HasParent ( FileSystemInfoEx child , string parentFullName ) { if ( child . FullName . StartsWith ( parentFullName , StringComparison . InvariantCultureIgnoreCase ) ) return true ; if ( parentFullName == DirectoryInfoEx . DesktopDirectory . FullName ) return true ; if ( ( child . FullName . StartsWith ( IID_UserFiles ) || child . FullName . StartsWith ( IID_Public ) ) ) return false ; FileSystemInfoEx current = child . Parent ; while ( current != null && parentFullName != current . FullName ) current = current . Parent ; return ( current != null ) ; }
Return whether parent directory contain child directory.
Return whether parent directory contain child directory .
None
child
FileSystemInfoEx
None
parentFullName
string
None