Ejemplo n.º 1
0
        public static List <ElementLicenseInfo> GetLicensedStatus(
            DiscoveryResultBase discoveryResult)
        {
            if (discoveryResult == null)
            {
                throw new ArgumentNullException(nameof(discoveryResult));
            }
            List <ElementLicenseInfo> elementLicenseInfoList1 = new List <ElementLicenseInfo>();
            IFeatureManager           ifeatureManager         = (IFeatureManager) new FeatureManager();
            Dictionary <string, int>  dictionary           = new Dictionary <string, int>();
            Dictionary <string, int>  elementsManagedCount = LicenseSaturationLogic.GetElementsManagedCount();

            foreach (string key in elementsManagedCount.Keys)
            {
                dictionary[key] = ifeatureManager.GetMaxElementCount(key);
            }
            using (IEnumerator <DiscoveryPluginResultBase> enumerator = discoveryResult.get_PluginResults().GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    List <ElementLicenseInfo> elementLicenseInfoList2;
                    if (!enumerator.Current.CheckLicensingStatusForImport(elementsManagedCount, dictionary, ref elementLicenseInfoList2))
                    {
                        elementLicenseInfoList1.AddRange((IEnumerable <ElementLicenseInfo>)elementLicenseInfoList2);
                    }
                }
            }
            return(elementLicenseInfoList1);
        }