///<Summary>returns True if the beginning of A matches B exactly for B's entire length</Summary> public static bool StartsWith(cPidl A, cPidl B) { return A.StartsWith(B); }
///<Summary> Compares a candidate Ancestor PIDL with a Child PIDL and /// returns True if Ancestor is an ancestor of the child. /// if fParent is True, then only return True if Ancestor is the immediate /// parent of the Child</Summary> public static bool IsAncestorOf(IntPtr AncestorPidl, IntPtr ChildPidl, bool fParent) { bool returnValue; if (ShellDll.Is2KOrAbove()) { return ExpTreeLib.ShellDll.ILIsParent(AncestorPidl, ChildPidl, fParent); } else { cPidl Child = new cPidl(ChildPidl); cPidl Ancestor = new cPidl(AncestorPidl); returnValue = Child.StartsWith(Ancestor); if (! returnValue) { return returnValue; } if (fParent) // check for immediate ancestor, if desired { object[] oAncBytes = Ancestor.Decompose(); object[] oChildBytes = Child.Decompose(); if (oAncBytes.Length != (oChildBytes.Length - 1)) { returnValue = false; } } } return returnValue; }