Пример #1
0
		internal static string GetItemType(IShellItem2 shellItem) {
			if (shellItem != null) {
				string itemType = null;
				HResult hr = shellItem.GetString(ref ItemTypePropertyKey, out itemType);
				if (hr == HResult.Ok) { return itemType; }
			}

			return null;
		}
Пример #2
0
        internal static string GetItemType(IShellItem2 shellItem)
        {
            if (shellItem != null)
            {
                string itemType = null;

                HRESULT hr = shellItem.GetString(ref ItemTypePropertyKey, out itemType);

                if (hr == HRESULT.S_OK)
                    return itemType;
            }

            return null;
        }
Пример #3
0
 internal ShellLink(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
 internal NonFileSystemKnownFolder(IShellItem2 shellItem) : base(shellItem) { }
 public NonFileSystemKnownFolder(IShellItem2 shellItem)
     : base(shellItem)
 {
 }
 internal ShellSavedSearchCollection(IShellItem2 shellItem)
     : base(shellItem)
 {
     CoreHelpers.ThrowIfNotVista();
 }
Пример #7
0
 public ShellSearchConnector(IShellItem2 shellItem)
     : this()
 {
     nativeShellItem = shellItem;
 }
Пример #8
0
 internal ShellFile(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
Пример #9
0
 internal ShellFileSystemFolder(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
Пример #10
0
        /// <summary>
        /// Release the native and managed objects
        /// </summary>
        /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                internalParsingName = null;
            }

            if (nativeShellItem != null)
            {
                Marshal.ReleaseComObject(nativeShellItem);
                nativeShellItem = null;
            }
        }
Пример #11
0
 public ShellLink(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
 public ShellNonFileSystemFolder(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
Пример #13
0
 public ShellFile(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
Пример #14
0
 public ShellSearchCollection(IShellItem2 shellItem)
     : base(shellItem)
 {
 }
        // This is a work around for the STA thread bug.  This will execute the call on a non-sta thread, then return the result
        private static bool IsVirtualKnownFolder(IShellItem2 nativeShellItem2)
        {
            IntPtr pidl = IntPtr.Zero;
            try
            {
                IKnownFolderNative nativeFolder = null;
                KnownFoldersSafeNativeMethods.NativeFolderDefinition definition = new KnownFoldersSafeNativeMethods.NativeFolderDefinition();

                // We found a bug where the enumeration of shell folders was
                // not reliable when called from a STA thread - it would return
                // different results the first time vs the other times.
                //
                // This is a work around.  We call FindFolderFromIDList on a
                // worker MTA thread instead of the main STA thread.
                //
                // Ultimately, it would be a very good idea to replace the 'getting shell object' logic
                // to get a list of pidl's in 1 step, then look up their information in a 2nd, rather than
                // looking them up as we get them.  This would replace the need for the work around.
                object padlock = new object();
                lock (padlock)
                {
                    IntPtr unknown = Marshal.GetIUnknownForObject(nativeShellItem2);

                    ThreadPool.QueueUserWorkItem(obj =>
                    {
                        lock (padlock)
                        {
                            pidl = ShellHelper.PidlFromUnknown(unknown);

                            new KnownFolderManagerClass().FindFolderFromIDList(pidl, out nativeFolder);

                            if (nativeFolder != null)
                            {
                                nativeFolder.GetFolderDefinition(out definition);
                            }

                            Monitor.Pulse(padlock);
                        }
                    });

                    Monitor.Wait(padlock);
                }

                return nativeFolder != null && definition.category == FolderCategory.Virtual;
            }
            finally
            {
                ShellNativeMethods.ILFree(pidl);
            }
        }
 internal ShellNonFileSystemItem(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }
        internal ShellSearchConnector(IShellItem2 shellItem)
        {
            CoreHelpers.ThrowIfNotWin7();

            nativeShellItem = shellItem;
        }
 internal ShellSearchConnector(IShellItem2 shellItem)
     : this()
 {            
     nativeShellItem = shellItem;
 }
 internal ShellSavedSearchCollection(IShellItem2 shellItem)
     : base(shellItem)
 {
 }
Пример #20
0
 public ShellNonFileSystemItem(IShellItem2 shellItem)
 {
     nativeShellItem = shellItem;
 }