private bool IsValidPlugin(object plugin)
        {
            IBackgroundInventoryPlugin  ibackgroundInventoryPlugin = plugin as IBackgroundInventoryPlugin;
            IBackgroundInventoryPlugin2 inventoryPlugin2           = plugin as IBackgroundInventoryPlugin2;

            return(ibackgroundInventoryPlugin != null || inventoryPlugin2 != null);
        }
        // Token: 0x060008E1 RID: 2273 RVA: 0x0003FF38 File Offset: 0x0003E138
        private bool IsValidPlugin(object plugin)
        {
            bool flag = plugin is IBackgroundInventoryPlugin;
            IBackgroundInventoryPlugin2 backgroundInventoryPlugin = plugin as IBackgroundInventoryPlugin2;

            return(flag || backgroundInventoryPlugin != null);
        }
        // Token: 0x060008E3 RID: 2275 RVA: 0x0003FFA8 File Offset: 0x0003E1A8
        private bool ProcessResults(object plugin, BackgroundInventory.InventoryTask task, InventoryResultBase result, Node node)
        {
            IBackgroundInventoryPlugin backgroundInventoryPlugin = plugin as IBackgroundInventoryPlugin;

            if (backgroundInventoryPlugin != null)
            {
                return(backgroundInventoryPlugin.ProcessResults(result, node));
            }
            IBackgroundInventoryPlugin2 backgroundInventoryPlugin2 = plugin as IBackgroundInventoryPlugin2;

            return(backgroundInventoryPlugin2 != null && backgroundInventoryPlugin2.ProcessResults(result, new BackgroundInventoryObject(node, task.ObjectID, task.ObjectType)));
        }
        // Token: 0x060008E2 RID: 2274 RVA: 0x0003FF5C File Offset: 0x0003E15C
        private InventoryResultBase DoInventory(object plugin, BackgroundInventory.InventoryTask task, GlobalSettingsBase globals, Credential credentials, Node node)
        {
            IBackgroundInventoryPlugin backgroundInventoryPlugin = plugin as IBackgroundInventoryPlugin;

            if (backgroundInventoryPlugin != null)
            {
                return(backgroundInventoryPlugin.DoInventory(globals, credentials, node));
            }
            IBackgroundInventoryPlugin2 backgroundInventoryPlugin2 = plugin as IBackgroundInventoryPlugin2;

            if (backgroundInventoryPlugin2 != null)
            {
                return(backgroundInventoryPlugin2.DoInventory(globals, credentials, new BackgroundInventoryObject(node, task.ObjectID, task.ObjectType)));
            }
            return(null);
        }
Exemplo n.º 5
0
        public InventoryManager(int engineID)
        {
            this.engineID = engineID;
            Dictionary <string, object> plugins1 = new Dictionary <string, object>((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase);
            IEnumerable <IBackgroundInventoryPlugin> plugins2 = (IEnumerable <IBackgroundInventoryPlugin>) new PluginsFactory <IBackgroundInventoryPlugin>().Plugins;

            if (plugins2 != null)
            {
                using (IEnumerator <IBackgroundInventoryPlugin> enumerator = plugins2.GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        IBackgroundInventoryPlugin current = enumerator.Current;
                        if (plugins1.ContainsKey(current.get_FlagName()))
                        {
                            InventoryManager.log.ErrorFormat("Plugin with FlagName {0} already loaded", (object)current.get_FlagName());
                        }
                        plugins1.Add(current.get_FlagName(), (object)current);
                    }
                }
            }
            IEnumerable <IBackgroundInventoryPlugin2> plugins3 = (IEnumerable <IBackgroundInventoryPlugin2>) new PluginsFactory <IBackgroundInventoryPlugin2>().Plugins;

            if (plugins3 != null)
            {
                using (IEnumerator <IBackgroundInventoryPlugin2> enumerator = plugins3.GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        IBackgroundInventoryPlugin2 current = enumerator.Current;
                        if (plugins1.ContainsKey(current.get_FlagName()))
                        {
                            InventoryManager.log.ErrorFormat("Plugin with FlagName {0} already loaded", (object)current.get_FlagName());
                        }
                        plugins1.Add(current.get_FlagName(), (object)current);
                    }
                }
            }
            if (plugins2 == null && plugins3 == null)
            {
                InventoryManager.log.ErrorFormat("No Inventory plugins found", Array.Empty <object>());
            }
            this.backgroundInventory = new SolarWinds.Orion.Core.BusinessLayer.BackgroundInventory.BackgroundInventory(BusinessLayerSettings.Instance.BackgroundInventoryParallelTasksCount, plugins1);
        }