Exemple #1
0
 // Token: 0x060002D5 RID: 725 RVA: 0x00011AB4 File Offset: 0x0000FCB4
 internal static void SaveElementsUsageInfo()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug("Collecting elements usage information to store in history");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(null);
         if (modulesSaturationInfo.Count != 0)
         {
             List <ElementLicenseSaturationInfo> elements = new List <ElementLicenseSaturationInfo>();
             modulesSaturationInfo.ForEach(delegate(ModuleLicenseSaturationInfo m)
             {
                 elements.AddRange(m.ElementList.ToArray());
             });
             ElementsUsageDAL.Save(elements);
         }
         else
         {
             LicenseSaturationHelper.Log.DebugFormat("There is no elements usage information to store in history", Array.Empty <object>());
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error("Exception running SaveElementsUsageInfo:", ex);
     }
 }
Exemple #2
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);
        }
        // Token: 0x060002AF RID: 687 RVA: 0x00010BD4 File Offset: 0x0000EDD4
        public static List <ElementLicenseInfo> GetLicensedStatus(DiscoveryResultBase discoveryResult)
        {
            if (discoveryResult == null)
            {
                throw new ArgumentNullException("discoveryResult");
            }
            List <ElementLicenseInfo> list                 = new List <ElementLicenseInfo>();
            IFeatureManager           featureManager       = new FeatureManager();
            Dictionary <string, int>  dictionary           = new Dictionary <string, int>();
            Dictionary <string, int>  elementsManagedCount = LicenseSaturationLogic.GetElementsManagedCount();

            foreach (string text in elementsManagedCount.Keys)
            {
                dictionary[text] = featureManager.GetMaxElementCount(text);
            }
            using (IEnumerator <DiscoveryPluginResultBase> enumerator2 = discoveryResult.PluginResults.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    List <ElementLicenseInfo> collection;
                    if (!enumerator2.Current.CheckLicensingStatusForImport(elementsManagedCount, dictionary, ref collection))
                    {
                        list.AddRange(collection);
                    }
                }
            }
            return(list);
        }
Exemple #4
0
 // Token: 0x060002D4 RID: 724 RVA: 0x000118B4 File Offset: 0x0000FAB4
 internal static void CheckLicenseSaturation()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug("Checking license saturation");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(new int?(LicenseSaturationHelper.SaturationLimit));
         if (modulesSaturationInfo.Count == 0)
         {
             LicenseSaturationHelper.Log.DebugFormat("All modules below {0}% of their license", LicenseSaturationHelper.SaturationLimit);
             LicenseSaturationNotificationItemDAL.Hide();
             LicensePreSaturationNotificationItemDAL.Hide();
         }
         else
         {
             List <ModuleLicenseSaturationInfo> list = (from q in modulesSaturationInfo
                                                        where q.ElementList.Any((ElementLicenseSaturationInfo l) => l.Saturation > 99.0)
                                                        select q).ToList <ModuleLicenseSaturationInfo>();
             List <ModuleLicenseSaturationInfo> list2 = (from q in modulesSaturationInfo
                                                         where q.ElementList.Any((ElementLicenseSaturationInfo l) => l.Saturation > (double)LicenseSaturationHelper.SaturationLimit && l.Saturation < 100.0)
                                                         select q).ToList <ModuleLicenseSaturationInfo>();
             List <ElementLicenseSaturationInfo> overUsedElements = new List <ElementLicenseSaturationInfo>();
             list.ForEach(delegate(ModuleLicenseSaturationInfo l)
             {
                 overUsedElements.AddRange(l.ElementList.ToArray());
             });
             if (LicenseSaturationHelper.Log.IsInfoEnabled)
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are at 100% of their license: {0}", string.Join(";", from q in overUsedElements
                                                                                                                        select q.ElementType));
             }
             LicenseSaturationNotificationItemDAL.Show(from q in overUsedElements
                                                       select q.ElementType);
             List <ElementLicenseSaturationInfo> warningElements = new List <ElementLicenseSaturationInfo>();
             list2.ForEach(delegate(ModuleLicenseSaturationInfo l)
             {
                 warningElements.AddRange(l.ElementList.ToArray());
             });
             if (LicenseSaturationHelper.Log.IsInfoEnabled)
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are above {0}% of their license: {1}", LicenseSaturationHelper.SaturationLimit, string.Join(";", from q in warningElements
                                                                                                                                                                    select q.ElementType));
             }
             LicensePreSaturationNotificationItemDAL.Show();
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error("Exception running CheckLicenseSaturation:", ex);
     }
 }
 internal static void SaveElementsUsageInfo()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug((object)"Collecting elements usage information to store in history");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(new int?());
         if (modulesSaturationInfo.Count != 0)
         {
             List <ElementLicenseSaturationInfo> elements = new List <ElementLicenseSaturationInfo>();
             modulesSaturationInfo.ForEach((Action <ModuleLicenseSaturationInfo>)(m => elements.AddRange((IEnumerable <ElementLicenseSaturationInfo>)m.get_ElementList().ToArray())));
             ElementsUsageDAL.Save((IEnumerable <ElementLicenseSaturationInfo>)elements);
         }
         else
         {
             LicenseSaturationHelper.Log.DebugFormat("There is no elements usage information to store in history", Array.Empty <object>());
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error((object)"Exception running SaveElementsUsageInfo:", ex);
     }
 }
 internal static void CheckLicenseSaturation()
 {
     try
     {
         LicenseSaturationHelper.Log.Debug((object)"Checking license saturation");
         List <ModuleLicenseSaturationInfo> modulesSaturationInfo = LicenseSaturationLogic.GetModulesSaturationInfo(new int?(LicenseSaturationHelper.SaturationLimit));
         if (modulesSaturationInfo.Count == 0)
         {
             LicenseSaturationHelper.Log.DebugFormat("All modules below {0}% of their license", (object)LicenseSaturationHelper.SaturationLimit);
             LicenseSaturationNotificationItemDAL.Hide();
             LicensePreSaturationNotificationItemDAL.Hide();
         }
         else
         {
             List <ModuleLicenseSaturationInfo>  list1            = ((IEnumerable <ModuleLicenseSaturationInfo>)modulesSaturationInfo).Where <ModuleLicenseSaturationInfo>((Func <ModuleLicenseSaturationInfo, bool>)(q => ((IEnumerable <ElementLicenseSaturationInfo>)q.get_ElementList()).Any <ElementLicenseSaturationInfo>((Func <ElementLicenseSaturationInfo, bool>)(l => l.get_Saturation() > 99.0)))).ToList <ModuleLicenseSaturationInfo>();
             List <ModuleLicenseSaturationInfo>  list2            = ((IEnumerable <ModuleLicenseSaturationInfo>)modulesSaturationInfo).Where <ModuleLicenseSaturationInfo>((Func <ModuleLicenseSaturationInfo, bool>)(q => ((IEnumerable <ElementLicenseSaturationInfo>)q.get_ElementList()).Any <ElementLicenseSaturationInfo>((Func <ElementLicenseSaturationInfo, bool>)(l => l.get_Saturation() > (double)LicenseSaturationHelper.SaturationLimit && l.get_Saturation() < 100.0)))).ToList <ModuleLicenseSaturationInfo>();
             List <ElementLicenseSaturationInfo> overUsedElements = new List <ElementLicenseSaturationInfo>();
             list1.ForEach((Action <ModuleLicenseSaturationInfo>)(l => overUsedElements.AddRange((IEnumerable <ElementLicenseSaturationInfo>)l.get_ElementList().ToArray())));
             if (LicenseSaturationHelper.Log.get_IsInfoEnabled())
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are at 100% of their license: {0}", (object)string.Join(";", ((IEnumerable <ElementLicenseSaturationInfo>)overUsedElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType()))));
             }
             LicenseSaturationNotificationItemDAL.Show(((IEnumerable <ElementLicenseSaturationInfo>)overUsedElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType())));
             List <ElementLicenseSaturationInfo>  warningElements = new List <ElementLicenseSaturationInfo>();
             Action <ModuleLicenseSaturationInfo> action          = (Action <ModuleLicenseSaturationInfo>)(l => warningElements.AddRange((IEnumerable <ElementLicenseSaturationInfo>)l.get_ElementList().ToArray()));
             list2.ForEach(action);
             if (LicenseSaturationHelper.Log.get_IsInfoEnabled())
             {
                 LicenseSaturationHelper.Log.InfoFormat("These elements are above {0}% of their license: {1}", (object)LicenseSaturationHelper.SaturationLimit, (object)string.Join(";", ((IEnumerable <ElementLicenseSaturationInfo>)warningElements).Select <ElementLicenseSaturationInfo, string>((Func <ElementLicenseSaturationInfo, string>)(q => q.get_ElementType()))));
             }
             LicensePreSaturationNotificationItemDAL.Show();
         }
     }
     catch (Exception ex)
     {
         LicenseSaturationHelper.Log.Error((object)"Exception running CheckLicenseSaturation:", ex);
     }
 }