Esempio n. 1
0
        public void ImportDiscoveryResultForProfile(
            int profileID,
            bool deleteProfileAfterImport,
            DiscoveryImportManager.CallbackDiscoveryImportFinished callback = null,
            bool checkLicenseLimits = false,
            Guid?importID           = null)
        {
            IList <IDiscoveryPlugin> discoveryPlugins = DiscoveryHelper.GetOrderedDiscoveryPlugins();
            SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins = DiscoveryPluginHelper.GetOrderedPlugins(discoveryPlugins, (IList <DiscoveryPluginInfo>)DiscoveryHelper.GetDiscoveryPluginInfos());
            DiscoveryResultBase result1 = this.FilterIgnoredItems(DiscoveryResultManager.GetDiscoveryResult(profileID, discoveryPlugins));
            Guid importId = Guid.NewGuid();

            if (importID.HasValue)
            {
                importId = importID.Value;
            }
            DiscoveryImportManager.CallbackDiscoveryImportFinished callbackAfterImport = callback;
            if (deleteProfileAfterImport)
            {
                callbackAfterImport = (DiscoveryImportManager.CallbackDiscoveryImportFinished)((result, id, status) =>
                {
                    this.DeleteOrionDiscoveryProfile(result.get_ProfileID());
                    if (callback == null)
                    {
                        return;
                    }
                    callback(result, id, status);
                });
            }
            DiscoveryImportManager.StartImport(importId, result1, orderedPlugins, checkLicenseLimits, callbackAfterImport);
        }
        // Token: 0x06000622 RID: 1570 RVA: 0x00024EF0 File Offset: 0x000230F0
        public void ImportDiscoveryResultForProfile(int profileID, bool deleteProfileAfterImport, DiscoveryImportManager.CallbackDiscoveryImportFinished callback = null, bool checkLicenseLimits = false, Guid?importID = null)
        {
            IList <IDiscoveryPlugin> orderedDiscoveryPlugins = DiscoveryHelper.GetOrderedDiscoveryPlugins();
            SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins = DiscoveryPluginHelper.GetOrderedPlugins(orderedDiscoveryPlugins, DiscoveryHelper.GetDiscoveryPluginInfos());
            DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(profileID, orderedDiscoveryPlugins);
            DiscoveryResultBase result2         = this.FilterIgnoredItems(discoveryResult);
            Guid importId = Guid.NewGuid();

            if (importID != null)
            {
                importId = importID.Value;
            }
            DiscoveryImportManager.CallbackDiscoveryImportFinished callbackAfterImport = callback;
            if (deleteProfileAfterImport)
            {
                callbackAfterImport = delegate(DiscoveryResultBase result, Guid id, StartImportStatus status)
                {
                    this.DeleteOrionDiscoveryProfile(result.ProfileID);
                    if (callback != null)
                    {
                        callback(result, id, status);
                    }
                };
            }
            DiscoveryImportManager.StartImport(importId, result2, orderedPlugins, checkLicenseLimits, callbackAfterImport);
        }
 // Token: 0x060002BE RID: 702 RVA: 0x000111C4 File Offset: 0x0000F3C4
 internal static void UpdateRoutine(int profileID)
 {
     if (profileID <= 0)
     {
         throw new ArgumentException("Invalid ProfileID", "profileID");
     }
     using (LocaleThreadState.EnsurePrimaryLocale())
     {
         try
         {
             IEnumerable <IScheduledDiscoveryPlugin> enumerable = DiscoveryHelper.GetOrderedDiscoveryPlugins().OfType <IScheduledDiscoveryPlugin>();
             if (enumerable.Count <IScheduledDiscoveryPlugin>() > 0)
             {
                 DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(profileID, enumerable.Cast <IDiscoveryPlugin>().ToList <IDiscoveryPlugin>());
                 using (IEnumerator <IScheduledDiscoveryPlugin> enumerator = enumerable.GetEnumerator())
                 {
                     Action <string, double> < > 9__0;
                     while (enumerator.MoveNext())
                     {
                         IScheduledDiscoveryPlugin scheduledDiscoveryPlugin = enumerator.Current;
                         DiscoveryResultBase       discoveryResultBase      = discoveryResult;
                         Action <string, double>   action;
                         if ((action = < > 9__0) == null)
                         {
                             action = (< > 9__0 = delegate(string message, double phaseProgress)
                             {
                                 if (DiscoveryNetObjectStatusManager.log.IsInfoEnabled)
                                 {
                                     DiscoveryNetObjectStatusManager.log.InfoFormat("Updating Discovered Net Object Statuses for profile {0}: {1} - {2}", profileID, phaseProgress, message);
                                 }
                             });
                         }
                         scheduledDiscoveryPlugin.UpdateImportStatuses(discoveryResultBase, action);
                     }
                     goto IL_CC;
                 }
             }
             if (DiscoveryNetObjectStatusManager.log.IsInfoEnabled)
             {
                 DiscoveryNetObjectStatusManager.log.InfoFormat("Skipping Discovered Net Object Status update for profile {0}", profileID);
             }
             IL_CC :;
         }
         catch (Exception ex)
         {
             DiscoveryNetObjectStatusManager.log.Error(string.Format("Update Discovered Net Object Statuses for profile {0} failed", profileID), ex);
         }
     }
 }
Esempio n. 4
0
 internal static void UpdateRoutine(int profileID)
 {
     if (profileID <= 0)
     {
         throw new ArgumentException("Invalid ProfileID", nameof(profileID));
     }
     using (LocaleThreadState.EnsurePrimaryLocale())
     {
         try
         {
             IEnumerable <IScheduledDiscoveryPlugin> source = ((IEnumerable)DiscoveryHelper.GetOrderedDiscoveryPlugins()).OfType <IScheduledDiscoveryPlugin>();
             if (source.Count <IScheduledDiscoveryPlugin>() > 0)
             {
                 DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(profileID, (IList <IDiscoveryPlugin>)((IEnumerable)source).Cast <IDiscoveryPlugin>().ToList <IDiscoveryPlugin>());
                 using (IEnumerator <IScheduledDiscoveryPlugin> enumerator = source.GetEnumerator())
                 {
                     while (((IEnumerator)enumerator).MoveNext())
                     {
                         enumerator.Current.UpdateImportStatuses(discoveryResult, (Action <string, double>)((message, phaseProgress) =>
                         {
                             if (!DiscoveryNetObjectStatusManager.log.get_IsInfoEnabled())
                             {
                                 return;
                             }
                             DiscoveryNetObjectStatusManager.log.InfoFormat("Updating Discovered Net Object Statuses for profile {0}: {1} - {2}", (object)profileID, (object)phaseProgress, (object)message);
                         }));
                     }
                 }
             }
             else
             {
                 if (!DiscoveryNetObjectStatusManager.log.get_IsInfoEnabled())
                 {
                     return;
                 }
                 DiscoveryNetObjectStatusManager.log.InfoFormat("Skipping Discovered Net Object Status update for profile {0}", (object)profileID);
             }
         }
         catch (Exception ex)
         {
             DiscoveryNetObjectStatusManager.log.Error((object)string.Format("Update Discovered Net Object Statuses for profile {0} failed", (object)profileID), ex);
         }
     }
 }
 // Token: 0x0600061E RID: 1566 RVA: 0x00024C38 File Offset: 0x00022E38
 private DiscoveryResultBase FilterItems(DiscoveryResultBase discoveryResult, Func <IDiscoveryPlugin, DiscoveryResultBase, DiscoveryPluginResultBase> filterFunction)
 {
     foreach (IDiscoveryPlugin discoveryPlugin in DiscoveryHelper.GetOrderedDiscoveryPlugins())
     {
         DiscoveryPluginResultBase discoveryPluginResultBase = filterFunction(discoveryPlugin, discoveryResult);
         if (discoveryPluginResultBase != null)
         {
             discoveryPluginResultBase.PluginTypeName = discoveryPlugin.GetType().FullName;
             Type returnedType = discoveryPluginResultBase.GetType();
             List <DiscoveryPluginResultBase> list = (from item in discoveryResult.PluginResults
                                                      where item.GetType() != returnedType
                                                      select item).ToList <DiscoveryPluginResultBase>();
             discoveryResult.PluginResults.Clear();
             discoveryResult.PluginResults.Add(discoveryPluginResultBase);
             foreach (DiscoveryPluginResultBase discoveryPluginResultBase2 in list)
             {
                 discoveryResult.PluginResults.Add(discoveryPluginResultBase2);
             }
         }
     }
     return(discoveryResult);
 }
Esempio n. 6
0
 private DiscoveryResultBase FilterItems(
     DiscoveryResultBase discoveryResult,
     Func <IDiscoveryPlugin, DiscoveryResultBase, DiscoveryPluginResultBase> filterFunction)
 {
     using (IEnumerator <IDiscoveryPlugin> enumerator1 = ((IEnumerable <IDiscoveryPlugin>)DiscoveryHelper.GetOrderedDiscoveryPlugins()).GetEnumerator())
     {
         while (((IEnumerator)enumerator1).MoveNext())
         {
             IDiscoveryPlugin          current1         = enumerator1.Current;
             DiscoveryPluginResultBase pluginResultBase = filterFunction(current1, discoveryResult);
             if (pluginResultBase != null)
             {
                 pluginResultBase.set_PluginTypeName(((object)current1).GetType().FullName);
                 Type returnedType = ((object)pluginResultBase).GetType();
                 List <DiscoveryPluginResultBase> list = ((IEnumerable <DiscoveryPluginResultBase>)discoveryResult.get_PluginResults()).Where <DiscoveryPluginResultBase>((Func <DiscoveryPluginResultBase, bool>)(item => ((object)item).GetType() != returnedType)).ToList <DiscoveryPluginResultBase>();
                 discoveryResult.get_PluginResults().Clear();
                 discoveryResult.get_PluginResults().Add(pluginResultBase);
                 using (List <DiscoveryPluginResultBase> .Enumerator enumerator2 = list.GetEnumerator())
                 {
                     while (enumerator2.MoveNext())
                     {
                         DiscoveryPluginResultBase current2 = enumerator2.Current;
                         discoveryResult.get_PluginResults().Add(current2);
                     }
                 }
             }
         }
     }
     return(discoveryResult);
 }
Esempio n. 7
0
        public void ImportDiscoveryResultsForConfiguration(
            DiscoveryImportConfiguration importCfg,
            Guid importID)
        {
            DiscoveryLogic.log.DebugFormat("Loading discovery results.", Array.Empty <object>());
            if (DiscoveryProfileEntry.GetProfileByID(importCfg.get_ProfileID()) == null)
            {
                throw new Exception(string.Format("Requested profile {0} not found.", (object)importCfg.get_ProfileID()));
            }
            DiscoveryImportManager.UpdateProgress(importID, "ImportDiscoveryResults Started", "Loading Plugins", false);
            IList <IDiscoveryPlugin> discoveryPlugins = DiscoveryHelper.GetOrderedDiscoveryPlugins();
            SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins = DiscoveryPluginHelper.GetOrderedPlugins(discoveryPlugins, (IList <DiscoveryPluginInfo>)DiscoveryHelper.GetDiscoveryPluginInfos());
            DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(importCfg.get_ProfileID(), discoveryPlugins);
            DiscoveryResultBase result1;

            if (importCfg.get_NodeIDs().Count > 0)
            {
                DiscoveryLogic.log.DebugFormat("Nodes to be imported : {0}", (object)importCfg.get_NodeIDs().Count);
                using (List <DiscoveredNode> .Enumerator enumerator = ((CoreDiscoveryPluginResult)discoveryResult.GetPluginResultOfType <CoreDiscoveryPluginResult>()).get_DiscoveredNodes().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        DiscoveredNode current = enumerator.Current;
                        if (importCfg.get_NodeIDs().Contains(current.get_NodeID()))
                        {
                            ((DiscoveredObjectBase)current).set_IsSelected(true);
                        }
                        else
                        {
                            ((DiscoveredObjectBase)current).set_IsSelected(false);
                        }
                    }
                }
                using (List <DiscoveryPluginResultBase> .Enumerator enumerator = this.Linearize((IEnumerable <DiscoveryPluginResultBase>)discoveryResult.get_PluginResults()).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        DiscoveryPluginResultBase current          = enumerator.Current;
                        DiscoveryPluginResultBase pluginResultBase = !(current is IDiscoveryPluginResultContextFiltering contextFiltering) ? current.GetFilteredPluginResult() : contextFiltering.GetFilteredPluginResultFromContext(discoveryResult);
                        discoveryResult.get_PluginResults().Remove(current);
                        discoveryResult.get_PluginResults().Add(pluginResultBase);
                        DiscoveryLogic.log.DebugFormat("Applying filters for pluggin - {0}.", (object)current.get_PluginTypeName());
                    }
                }
                result1 = this.FilterIgnoredItems(discoveryResult);
            }
            else
            {
                result1 = discoveryResult;
            }
            result1.set_ProfileID(importCfg.get_ProfileID());
            DiscoveryLogic.log.DebugFormat("Importing started.", Array.Empty <object>());
            if (importCfg.get_DeleteProfileAfterImport())
            {
                DiscoveryImportManager.StartImport(importID, result1, orderedPlugins, false, (DiscoveryImportManager.CallbackDiscoveryImportFinished)((result, importId, importStatus) => this.DeleteOrionDiscoveryProfile(result.get_ProfileID())));
            }
            else
            {
                DiscoveryImportManager.StartImport(importID, result1, orderedPlugins);
            }
        }
        // Token: 0x06000624 RID: 1572 RVA: 0x00024FD4 File Offset: 0x000231D4
        public void ImportDiscoveryResultsForConfiguration(DiscoveryImportConfiguration importCfg, Guid importID)
        {
            DiscoveryLogic.log.DebugFormat("Loading discovery results.", Array.Empty <object>());
            if (DiscoveryProfileEntry.GetProfileByID(importCfg.ProfileID) == null)
            {
                throw new Exception(string.Format("Requested profile {0} not found.", importCfg.ProfileID));
            }
            DiscoveryImportManager.UpdateProgress(importID, "ImportDiscoveryResults Started", "Loading Plugins", false);
            IList <IDiscoveryPlugin> orderedDiscoveryPlugins = DiscoveryHelper.GetOrderedDiscoveryPlugins();
            SortedDictionary <int, List <IDiscoveryPlugin> > orderedPlugins = DiscoveryPluginHelper.GetOrderedPlugins(orderedDiscoveryPlugins, DiscoveryHelper.GetDiscoveryPluginInfos());
            DiscoveryResultBase discoveryResult = DiscoveryResultManager.GetDiscoveryResult(importCfg.ProfileID, orderedDiscoveryPlugins);
            DiscoveryResultBase discoveryResultBase;

            if (importCfg.NodeIDs.Count > 0)
            {
                DiscoveryLogic.log.DebugFormat("Nodes to be imported : {0}", importCfg.NodeIDs.Count);
                foreach (DiscoveredNode discoveredNode in discoveryResult.GetPluginResultOfType <CoreDiscoveryPluginResult>().DiscoveredNodes)
                {
                    if (importCfg.NodeIDs.Contains(discoveredNode.NodeID))
                    {
                        discoveredNode.IsSelected = true;
                    }
                    else
                    {
                        discoveredNode.IsSelected = false;
                    }
                }
                foreach (DiscoveryPluginResultBase discoveryPluginResultBase in this.Linearize(discoveryResult.PluginResults))
                {
                    IDiscoveryPluginResultContextFiltering discoveryPluginResultContextFiltering = discoveryPluginResultBase as IDiscoveryPluginResultContextFiltering;
                    DiscoveryPluginResultBase discoveryPluginResultBase2;
                    if (discoveryPluginResultContextFiltering != null)
                    {
                        discoveryPluginResultBase2 = discoveryPluginResultContextFiltering.GetFilteredPluginResultFromContext(discoveryResult);
                    }
                    else
                    {
                        discoveryPluginResultBase2 = discoveryPluginResultBase.GetFilteredPluginResult();
                    }
                    discoveryResult.PluginResults.Remove(discoveryPluginResultBase);
                    discoveryResult.PluginResults.Add(discoveryPluginResultBase2);
                    DiscoveryLogic.log.DebugFormat("Applying filters for pluggin - {0}.", discoveryPluginResultBase.PluginTypeName);
                }
                discoveryResultBase = this.FilterIgnoredItems(discoveryResult);
            }
            else
            {
                discoveryResultBase = discoveryResult;
            }
            discoveryResultBase.ProfileID = importCfg.ProfileID;
            DiscoveryLogic.log.DebugFormat("Importing started.", Array.Empty <object>());
            if (importCfg.DeleteProfileAfterImport)
            {
                DiscoveryImportManager.StartImport(importID, discoveryResultBase, orderedPlugins, false, delegate(DiscoveryResultBase result, Guid importId, StartImportStatus importStatus)
                {
                    this.DeleteOrionDiscoveryProfile(result.ProfileID);
                });
                return;
            }
            DiscoveryImportManager.StartImport(importID, discoveryResultBase, orderedPlugins);
        }