コード例 #1
0
        /// <summary>
        /// It searches for type implementations in the provided list of assemblies.
        /// </summary>
        /// <param name="pluginAssemblies">List of DLL file paths that will be searched for plugins when invoking the method <see cref="FindPlugins"/>.</param>
        public PluginScanner(IEnumerable <string> pluginAssemblies, string cacheFolder, ILogProvider logProvider, PluginScannerOptions pluginScannerOptions)
        {
            _pluginsByExport    = new Lazy <MultiDictionary <string, PluginInfo> >(() => GetPluginsByExport(pluginAssemblies), LazyThreadSafetyMode.ExecutionAndPublication);
            _pluginScannerCache = new PluginScannerCache(cacheFolder, logProvider, new FilesUtility(logProvider));
            _performanceLogger  = logProvider.GetLogger("Performance." + GetType().Name);
            _logger             = logProvider.GetLogger(GetType().Name);

            var ignoreList = pluginScannerOptions.PredefinedIgnoreAssemblyFiles.Concat(pluginScannerOptions.IgnoreAssemblyFiles ?? Array.Empty <string>()).Distinct().ToList();

            _ignoreAssemblyFiles    = new HashSet <string>(ignoreList.Where(name => !name.EndsWith("*")), StringComparer.OrdinalIgnoreCase);
            _ignoreAssemblyPrefixes = ignoreList.Where(name => name.EndsWith("*")).Select(name => name.Trim('*')).ToArray();
        }
コード例 #2
0
        /// <summary>
        /// It searches for type implementations in the provided list of assemblies.
        /// </summary>
        /// <param name="pluginAssemblies">List of DLL file paths that will be searched for plugins when invoking the method <see cref="FindPlugins"/>.</param>
        public PluginScanner(IEnumerable <string> pluginAssemblies, RhetosBuildEnvironment buildEnvironment, ILogProvider logProvider, PluginScannerOptions pluginScannerOptions)
        {
            if (string.IsNullOrEmpty(buildEnvironment.CacheFolder))
            {
                throw new ArgumentException($"Configuration setting '{OptionsAttribute.GetConfigurationPath<RhetosBuildEnvironment>()}:{nameof(RhetosBuildEnvironment.CacheFolder)}' in not provided.");
            }

            _pluginsByExport    = new Lazy <MultiDictionary <string, PluginInfo> >(() => GetPluginsByExport(pluginAssemblies), LazyThreadSafetyMode.ExecutionAndPublication);
            _pluginScannerCache = new PluginScannerCache(buildEnvironment.CacheFolder, logProvider, new FilesUtility(logProvider));
            _performanceLogger  = logProvider.GetLogger("Performance." + GetType().Name);
            _logger             = logProvider.GetLogger(GetType().Name);

            var ignoreList = pluginScannerOptions.PredefinedIgnoreAssemblyFiles.Concat(pluginScannerOptions.IgnoreAssemblyFiles ?? Array.Empty <string>()).Distinct().ToList();

            _ignoreAssemblyFiles    = new HashSet <string>(ignoreList.Where(name => !name.EndsWith("*")), StringComparer.OrdinalIgnoreCase);
            _ignoreAssemblyPrefixes = ignoreList.Where(name => name.EndsWith("*")).Select(name => name.Trim('*')).ToArray();
        }