public static object GetProperty(FileInfoEx file, PropertyKey propKey)
 {
     if (file.Exists)
     {
         using (ShellFolder2 sf2 = file.Parent.ShellFolder)
         {
             ShellDll.PropertyKey pkey = propKey;
             return(GetProperty(sf2, file, ref pkey));
         }
     }
     return(null);
 }
예제 #2
0
 public int MapColumnToSCID(uint iColumn, out PropertyKey pscid)
 {
     checkDisposed();
     return _iShellFolder2.MapColumnToSCID(iColumn, out pscid);
 }
예제 #3
0
 public int GetDetailsEx(IntPtr pidl, ref PropertyKey pscid, out object pv)
 {
     checkDisposed();
     return _iShellFolder2.GetDetailsEx(pidl, ref pscid, out pv);
 }
 public static object GetProperty(FileInfoEx file, PropertyKey propKey)
 {
     if (file.Exists)
         using (ShellFolder2 sf2 = file.Parent.ShellFolder)
         {
             ShellDll.PropertyKey pkey = propKey;
             return GetProperty(sf2, file, ref pkey);
         }
     return null;
 }
        public static object GetProperty(ShellFolder2 sf2, FileInfoEx file, ref PropertyKey propKey)
        {
            PIDL pidlLookup = file.PIDLRel;
            if (pidlLookup != null)
            {
                try
                {
                    object retVal;
                    int hr = sf2.GetDetailsEx(pidlLookup.Ptr, ref propKey, out retVal);
                    if (hr != ShellAPI.S_OK)
                        Marshal.ThrowExceptionForHR(hr);

                    return retVal;
                }
                finally
                {
                    pidlLookup.Free();
                }
            }
            return null;
        }
 public static object GetProperty(string filename, PropertyKey propKey)
 {
     if (File.Exists(filename))
         return GetProperty(new FileInfoEx(filename), propKey);
     return null;
 }