コード例 #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);
        }
コード例 #2
0
        // 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);
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        // 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);
        }