public extern IEnumUnknown CreateComponentEnumerator([In] WICComponentType componentTypes, [In] WICComponentEnumerateOptions options);
public static IComObject <IEnumUnknown> CreateComponentEnumerator(this IWICImagingFactory factory, WICComponentType type = WICComponentType.WICAllComponents, WICComponentEnumerateOptions options = WICComponentEnumerateOptions.WICComponentEnumerateDefault) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } factory.CreateComponentEnumerator(type, options, out var value).ThrowOnError(); return(new ComObject <IEnumUnknown>(value)); }
public static IEnumerable <IComObject <IWICComponentInfo> > EnumerateComponents(this IWICImagingFactory factory, WICComponentType type, WICComponentEnumerateOptions options) { using (var enumerator = factory.CreateComponentEnumerator(type, options)) { do { var o = new object[1]; var fetched = 0; enumerator.Object.Next(1, o, ref fetched); if (fetched != 1) { break; } if (o[0] is IWICComponentInfo info) { yield return(new ComObject <IWICComponentInfo>(info)); } }while (true); } }
public static IComObject <IEnumUnknown> CreateComponentEnumerator(this IComObject <IWICImagingFactory> factory, WICComponentType type = WICComponentType.WICAllComponents, WICComponentEnumerateOptions options = WICComponentEnumerateOptions.WICComponentEnumerateDefault) => CreateComponentEnumerator(factory?.Object, type, options);