Exemple #1
0
        /// <summary>
        ///     Retrieves a specified number of items in the enumeration sequence.
        /// </summary>
        /// <param name="itemsToFetch">Number of items to retrieve.</param>
        /// <returns>Array of enumerated DMOs.</returns>
        public DmoEnumItem[] Next(int itemsToFetch)
        {
            Guid[]   clsids;
            string[] names;
            int      itemsFetched;

            int result = NextNative(itemsToFetch, out clsids, out names, out itemsFetched);

            if (result != (int)HResult.S_FALSE && result != (int)HResult.S_OK)
            {
                DmoException.Try(result, InterfaceName, "Next");
            }

            var items = new DmoEnumItem[itemsFetched];

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new DmoEnumItem
                {
                    CLSID = clsids[i],
                    Name  = names[i]
                };
            }

            return(items);
        }
Exemple #2
0
 /// <summary>
 /// Enumerates DMOs listed in the registry. 
 /// </summary>
 /// <param name="category">GUID that specifies which category of DMO to search. Use Guid.Empty to search every category. See <see cref="DmoEnumeratorCategories"/> for a list of category guids.</param>
 /// <param name="flags">Flags that specify search criteria.</param>
 public static IEnumerable<DmoEnumItem> EnumerateDMOs(Guid category, DmoEnumFlags flags)
 {
     using(var enumerator = EnumerateDMOs(category, flags, null, null))
     {
         DmoEnumItem[] item = new DmoEnumItem[1];
         while((item = enumerator.Next(1)).Length > 0)
         {
             yield return item[0];
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Enumerates DMOs listed in the registry.
 /// </summary>
 /// <param name="category">GUID that specifies which category of DMO to search. Use Guid.Empty to search every category. See <see cref="DmoEnumeratorCategories"/> for a list of category guids.</param>
 /// <param name="flags">Flags that specify search criteria.</param>
 public static IEnumerable <DmoEnumItem> EnumerateDMOs(Guid category, DmoEnumFlags flags)
 {
     using (var enumerator = EnumerateDMOs(category, flags, null, null))
     {
         DmoEnumItem[] item = new DmoEnumItem[1];
         while ((item = enumerator.Next(1)).Length > 0)
         {
             yield return(item[0]);
         }
     }
 }
Exemple #4
0
        /// <summary>
        ///     Retrieves a specified number of items in the enumeration sequence.
        /// </summary>
        /// <param name="itemsToFetch">Number of items to retrieve.</param>
        /// <returns>Array of enumerated DMOs.</returns>
        public DmoEnumItem[] Next(int itemsToFetch)
        {
            Guid[] clsids;
            string[] names;
            int itemsFetched;

            int result = NextNative(itemsToFetch, out clsids, out names, out itemsFetched);
            if (result != (int) HResult.S_FALSE && result != (int) HResult.S_OK)
                DmoException.Try(result, InterfaceName, "Next");

            var items = new DmoEnumItem[itemsFetched];
            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new DmoEnumItem
                {
                    CLSID = clsids[i],
                    Name = names[i]
                };
            }

            return items;
        }