private static IEnumerable <TechnologyDiscoveryGroup> GetDiscoveryGroupsInternal(
     TechnologyManager mgr)
 {
     // ISSUE: object of a compiler-generated type is created
     return((IEnumerable <TechnologyDiscoveryGroup>) new DiscoveryFilterResultByTechnology.\u003CGetDiscoveryGroupsInternal\u003Ed__1(-2)
     {
         \u003C\u003E3__mgr = mgr
     });
 }
        private static DiscoveryResultBase FilterByPriority(
            DiscoveryResultBase result,
            TechnologyManager mgr,
            bool onlyMandatory)
        {
            if (result == null)
            {
                throw new ArgumentNullException(nameof(result));
            }
            if (mgr == null)
            {
                throw new ArgumentNullException(nameof(mgr));
            }
            ILookup <string, ITechnologyPolling> lookup = mgr.TechnologyPollingFactory.Items().ToLookup <ITechnologyPolling, string>((Func <ITechnologyPolling, string>)(tp => tp.get_TechnologyPollingID()), (IEqualityComparer <string>)StringComparer.Ordinal);
            List <IDiscoveredObject>             idiscoveredObjectList = new List <IDiscoveredObject>();

            using (IEnumerator <DiscoveryPluginResultBase> enumerator = result.get_PluginResults().GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    IEnumerable <IDiscoveredObject> discoveredObjects = enumerator.Current.GetDiscoveredObjects();
                    idiscoveredObjectList.AddRange(discoveredObjects);
                }
            }
            List <IDiscoveredObjectWithTechnology> list1 = ((IEnumerable)idiscoveredObjectList).OfType <IDiscoveredObjectWithTechnology>().ToList <IDiscoveredObjectWithTechnology>();

            using (IEnumerator <TechnologyDiscoveryGroup> enumerator1 = DiscoveryFilterResultByTechnology.GetDiscoveryGroupsInternal(mgr).GetEnumerator())
            {
                while (((IEnumerator)enumerator1).MoveNext())
                {
                    TechnologyDiscoveryGroup group = enumerator1.Current;
                    if (!onlyMandatory || group.get_SelectionDisabled())
                    {
                        IEnumerable <IDiscoveredObjectWithTechnology>  list2 = (IEnumerable <IDiscoveredObjectWithTechnology>)((IEnumerable <IDiscoveredObjectWithTechnology>)list1).Where <IDiscoveredObjectWithTechnology>((Func <IDiscoveredObjectWithTechnology, bool>)(n => group.IsMyGroupedObjectType((IDiscoveredObject)n))).ToList <IDiscoveredObjectWithTechnology>();
                        List <List <IDiscoveredObjectWithTechnology> > objectWithTechnologyListList = new List <List <IDiscoveredObjectWithTechnology> >();
                        using (List <IDiscoveredObject> .Enumerator enumerator2 = idiscoveredObjectList.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                IDiscoveredObject current1 = enumerator2.Current;
                                if (((DiscoveredObjectBase)group).IsChildOf(current1))
                                {
                                    List <IDiscoveredObjectWithTechnology> objectWithTechnologyList = new List <IDiscoveredObjectWithTechnology>();
                                    using (IEnumerator <IDiscoveredObjectWithTechnology> enumerator3 = list2.GetEnumerator())
                                    {
                                        while (((IEnumerator)enumerator3).MoveNext())
                                        {
                                            IDiscoveredObjectWithTechnology current2 = enumerator3.Current;
                                            if (((IDiscoveredObject)current2).IsChildOf(current1))
                                            {
                                                objectWithTechnologyList.Add(current2);
                                            }
                                        }
                                    }
                                    objectWithTechnologyListList.Add(objectWithTechnologyList);
                                }
                            }
                        }
                        using (List <List <IDiscoveredObjectWithTechnology> > .Enumerator enumerator2 = objectWithTechnologyListList.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                List <IDiscoveredObjectWithTechnology> current = enumerator2.Current;
                                if (onlyMandatory)
                                {
                                    if (((IEnumerable <IDiscoveredObjectWithTechnology>)current).Any <IDiscoveredObjectWithTechnology>((Func <IDiscoveredObjectWithTechnology, bool>)(to => ((IDiscoveredObject)to).get_IsSelected())))
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    current.ForEach((Action <IDiscoveredObjectWithTechnology>)(to => ((IDiscoveredObject)to).set_IsSelected(false)));
                                }
                                DiscoveryFilterResultByTechnology.SelectObjectWithHigherPriority((IEnumerable <IDiscoveredObjectWithTechnology>)current, lookup);
                            }
                        }
                    }
                }
            }
            return(result);
        }
 public static IEnumerable <IDiscoveredObjectGroup> GetDiscoveryGroups(
     TechnologyManager mgr)
 {
     return((IEnumerable <IDiscoveredObjectGroup>)DiscoveryFilterResultByTechnology.GetDiscoveryGroupsInternal(mgr));
 }
 public static DiscoveryResultBase FilterMandatoryByPriority(
     DiscoveryResultBase result,
     TechnologyManager mgr)
 {
     return(DiscoveryFilterResultByTechnology.FilterByPriority(result, mgr, true));
 }
Ejemplo n.º 5
0
        // Token: 0x060002A4 RID: 676 RVA: 0x0001028C File Offset: 0x0000E48C
        private static DiscoveryResultBase FilterByPriority(DiscoveryResultBase result, TechnologyManager mgr, bool onlyMandatory)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (mgr == null)
            {
                throw new ArgumentNullException("mgr");
            }
            ILookup <string, ITechnologyPolling> technologyPollingsById = mgr.TechnologyPollingFactory.Items().ToLookup((ITechnologyPolling tp) => tp.TechnologyPollingID, StringComparer.Ordinal);
            List <IDiscoveredObject>             list = new List <IDiscoveredObject>();

            foreach (DiscoveryPluginResultBase discoveryPluginResultBase in result.PluginResults)
            {
                IEnumerable <IDiscoveredObject> discoveredObjects = discoveryPluginResultBase.GetDiscoveredObjects();
                list.AddRange(discoveredObjects);
            }
            List <IDiscoveredObjectWithTechnology> source = list.OfType <IDiscoveredObjectWithTechnology>().ToList <IDiscoveredObjectWithTechnology>();

            foreach (TechnologyDiscoveryGroup group2 in DiscoveryFilterResultByTechnology.GetDiscoveryGroupsInternal(mgr))
            {
                TechnologyDiscoveryGroup group = group2;
                if (!onlyMandatory || group.SelectionDisabled)
                {
                    IEnumerable <IDiscoveredObjectWithTechnology> enumerable = (from n in source
                                                                                where @group.IsMyGroupedObjectType(n)
                                                                                select n).ToList <IDiscoveredObjectWithTechnology>();
                    List <List <IDiscoveredObjectWithTechnology> > list2 = new List <List <IDiscoveredObjectWithTechnology> >();
                    foreach (IDiscoveredObject discoveredObject in list)
                    {
                        if (group.IsChildOf(discoveredObject))
                        {
                            List <IDiscoveredObjectWithTechnology> list3 = new List <IDiscoveredObjectWithTechnology>();
                            foreach (IDiscoveredObjectWithTechnology discoveredObjectWithTechnology in enumerable)
                            {
                                if (discoveredObjectWithTechnology.IsChildOf(discoveredObject))
                                {
                                    list3.Add(discoveredObjectWithTechnology);
                                }
                            }
                            list2.Add(list3);
                        }
                    }
                    foreach (List <IDiscoveredObjectWithTechnology> list4 in list2)
                    {
                        if (onlyMandatory)
                        {
                            if (list4.Any((IDiscoveredObjectWithTechnology to) => to.IsSelected))
                            {
                                continue;
                            }
                        }
                        else
                        {
                            list4.ForEach(delegate(IDiscoveredObjectWithTechnology to)
                            {
                                to.IsSelected = false;
                            });
                        }
                        DiscoveryFilterResultByTechnology.SelectObjectWithHigherPriority(list4, technologyPollingsById);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        // Token: 0x060002A3 RID: 675 RVA: 0x00010279 File Offset: 0x0000E479
        private static IEnumerable <TechnologyDiscoveryGroup> GetDiscoveryGroupsInternal(TechnologyManager mgr)
        {
            if (mgr == null)
            {
                throw new ArgumentNullException("mgr");
            }
            foreach (ITechnologyDiscovery technologyDiscovery in mgr.TechnologyFactory.Items().OfType <ITechnologyDiscovery>())
            {
                string[] array = (from n in mgr.TechnologyPollingFactory.ItemsByTechnology(technologyDiscovery.TechnologyID)
                                  orderby n.Priority descending
                                  select n.TechnologyPollingID).ToArray <string>();
                TechnologyDiscoveryGroup technologyDiscoveryGroup = new TechnologyDiscoveryGroup(technologyDiscovery.ParentType, technologyDiscovery.DisplayName, technologyDiscovery.Icon, technologyDiscovery.TreeOrder, array);
                IDiscoveredObjectGroupWithSelectionMode discoveredObjectGroupWithSelectionMode = technologyDiscovery as IDiscoveredObjectGroupWithSelectionMode;
                if (discoveredObjectGroupWithSelectionMode != null)
                {
                    technologyDiscoveryGroup.SelectionMode     = discoveredObjectGroupWithSelectionMode.SelectionMode;
                    technologyDiscoveryGroup.SelectionDisabled = discoveredObjectGroupWithSelectionMode.SelectionDisabled;
                }
                yield return(technologyDiscoveryGroup);
            }
            IEnumerator <ITechnologyDiscovery> enumerator = null;

            yield break;
            yield break;
        }