예제 #1
0
        public bool IsRelativelyEqual(IDLWrapper idl2, IShellFolder relativeTo)
        {
            const int SHCIDS_CANONICALONLY = 0x10000000;

            return(!ReferenceEquals(idl2, null) && (ReferenceEquals(this, idl2) ||
                                                    0 == (0xFFFF & relativeTo.CompareIDs((IntPtr)SHCIDS_CANONICALONLY, PIDL, idl2.PIDL))));
        }
예제 #2
0
        public static bool GetIDLHash(IntPtr pIDL, out int hash, out string key)
        {
            IShellFolder ppshf  = null;
            IntPtr       lParam = (IntPtr)0x10000000;

            try {
                if (PInvoke.SHGetDesktopFolder(out ppshf) == 0)
                {
                    foreach (string str in dicCacheIDLs.Keys)
                    {
                        IntPtr ptr2 = ShellMethods.CreateIDL(dicCacheIDLs[str]);
                        if (ptr2 != IntPtr.Zero)
                        {
                            if (ppshf.CompareIDs(lParam, pIDL, ptr2) == 0)
                            {
                                key = str;
                                PInvoke.CoTaskMemFree(ptr2);
                                if (int.TryParse(str.Substring(str.IndexOf("???") + 3), out hash))
                                {
                                    return(true);
                                }
                            }
                            else
                            {
                                PInvoke.CoTaskMemFree(ptr2);
                            }
                        }
                    }
                }
            }
            catch {
            }
            finally {
                if (ppshf != null)
                {
                    Marshal.ReleaseComObject(ppshf);
                }
            }
            key  = string.Empty;
            hash = DateTime.Now.GetHashCode();
            return(false);
        }
예제 #3
0
 public bool IsRelativelyEqual(IDLWrapper idl2, IShellFolder relativeTo)
 {
     const int SHCIDS_CANONICALONLY = 0x10000000;
     return !ReferenceEquals(idl2, null) && (ReferenceEquals(this, idl2) ||
             0 == (0xFFFF & relativeTo.CompareIDs((IntPtr)SHCIDS_CANONICALONLY, PIDL, idl2.PIDL)));
 }
예제 #4
0
파일: ShellFolder.cs 프로젝트: Starwer/Lime
 public int CompareIDs(IntPtr lParam, IntPtr pidl1, IntPtr pidl2)
 {
     checkDisposed();
     return(_iShellFolder.CompareIDs(lParam, pidl1, pidl2));
 }