Fixed IKnownFolderManager.GetFolderIds extension method

pull/30/head
David Hall 2019-01-06 19:03:05 -07:00
parent 62f0bb02ef
commit 9fe4a53014
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Vanara.InteropServices; using Vanara.InteropServices;
@ -949,7 +950,7 @@ namespace Vanara.PInvoke
// https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iknownfoldermanager-getfolderids HRESULT // https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-iknownfoldermanager-getfolderids HRESULT
// GetFolderIds( KNOWNFOLDERID **ppKFId, UINT *pCount ); // GetFolderIds( KNOWNFOLDERID **ppKFId, UINT *pCount );
[PInvokeData("shobjidl_core.h", MSDNShortId = "3ac09fc4-15c4-4346-94ad-2a4617c463d1")] [PInvokeData("shobjidl_core.h", MSDNShortId = "3ac09fc4-15c4-4346-94ad-2a4617c463d1")]
public static IEnumerable<KNOWNFOLDERID> GetFolderIds(this IKnownFolderManager mgr) { mgr.GetFolderIds(out var mem, out var c); return mem.ToEnumerable<KNOWNFOLDERID>((int)c); } public static IEnumerable<KNOWNFOLDERID> GetFolderIds(this IKnownFolderManager mgr) { mgr.GetFolderIds(out var mem, out var c); return mem.ToEnumerable<Guid>((int)c).Select(g => AssociateAttribute.TryEnumLookup<KNOWNFOLDERID>(g, out var kf) ? kf : 0); }
/// <summary>Extension method to simplify using the <see cref="IKnownFolder.GetShellItem"/> method.</summary> /// <summary>Extension method to simplify using the <see cref="IKnownFolder.GetShellItem"/> method.</summary>
/// <typeparam name="T">Type of the interface to get.</typeparam> /// <typeparam name="T">Type of the interface to get.</typeparam>