public void PopulateFeature(IEnumerable <ApplicationPart> parts, MetadataReferenceFeature feature) { HashSet <String> libraryPaths = new HashSet <string>(StringComparer.OrdinalIgnoreCase); foreach (AssemblyPart assemblyPart in parts.OfType <AssemblyPart>()) { DependencyContext dependencyContext = DependencyContext.Load(assemblyPart.Assembly); if (dependencyContext != null) { foreach (CompilationLibrary library in dependencyContext.CompileLibraries) { if (string.Equals("reference", library.Type, StringComparison.OrdinalIgnoreCase)) { foreach (string libraryAssembly in library.Assemblies) { libraryPaths.Add(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, libraryAssembly)); } } else { try { foreach (string path in library.ResolveReferencePaths()) { libraryPaths.Add(path); } } catch (InvalidOperationException err) { string libName = library.Name + ".dll"; if (String.IsNullOrEmpty(libraryPaths.Where(lp => lp.EndsWith(libName, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault())) { if (PluginManagerService.GetPluginManager().PluginLoaded(libName, out int _, out string module)) { libraryPaths.Add(module); } else { PluginManagerService.GetLogger().AddToLog(LogLevel.Critical, err, libName); throw; } } } } } }
public List <Type> GetPluginTypesWithAttribute <T>() { return(PluginManagerService.GetPluginManager().GetPluginTypesWithAttribute <T>()); }
public List <T> GetPluginClasses <T>() { return(PluginManagerService.GetPluginManager().GetPluginClasses <T>()); }