示例#1
0
 ///<Summary>Returns true if the CPidl input parameter exactly matches the
 /// beginning of this instance of CPidl</Summary>
 public bool StartsWith(cPidl cp)
 {
     byte[] b = cp.PidlBytes;
         if (b.Length > m_bytes.Length)
         {
             return false; //input is longer
         }
         int i;
         for (i = 0; i <= b.Length - 3; i++) //allow for nulnul at end of cp.PidlBytes
         {
             if (b[i] != m_bytes[i])
             {
                 return false;
             }
         }
         return true;
 }
示例#2
0
 ///<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);
 }
示例#3
0
 ///<Summary>Returns True if input cPidl's content exactly match the
 /// contents of this instance</Summary>
 public bool IsEqual(cPidl other)
 {
     bool returnValue;
         returnValue = false; //assume not
         if (other.Length != this.Length)
         {
             return returnValue;
         }
         byte[] ob = other.PidlBytes;
         int i;
         for (i = 0; i <= this.Length - 1; i++) //note: we look at nulnul also
         {
             if (ob[i] != m_bytes[i])
             {
                 return returnValue;
             }
         }
         return true; //all equal on fall thru
 }
示例#4
0
 ///<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;
 }