Пример #1
0
        public Component LoadComponent(Guid guid)
        {
            // verify if component
            Component comp = ComponentLoader.GetFromCache(guid);

            if (null != comp)
            {
                return(comp);
            }
            if (!(_searchMethod is IComponentSearchMethod))
            {
                throw new PluginException("Component loader was not initialized with a valid plugin search method.");
            }
            return(LoadComponent(_searchMethod.GetFilePathFromGuid(guid)));
        }
Пример #2
0
        public IPlugin GetPluginByGuid(Guid guid)
        {
            IPlugin searchedPlugin = null;
            // check if component not available in cache
            Component comp = ComponentLoader.GetFromCache(guid);

            if (null != comp) // available from cache
            {
                searchedPlugin = comp.Plugin;
            }
            else // actually load
            {
                if (!(_searchMethod is IComponentSearchMethod))
                {
                    throw new PluginException("Component loader was not initialized with a valid plugin search method.");
                }
                searchedPlugin = LoadComponent(_searchMethod.GetFilePathFromGuid(guid)).Plugin;
            }
            if (null != searchedPlugin && null != OnPluginAccessed)
            {
                OnPluginAccessed(searchedPlugin.Guid);
            }
            return(searchedPlugin);
        }