using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.IO;

namespace QC.QMine.QMineInterface;

public class MefPluginLoader
{
	private CompositionContainer typeContainer = new CompositionContainer();

	public void Load(string directoryPath)
	{
		if (Directory.Exists(directoryPath))
		{
			DirectoryCatalog catalog = new DirectoryCatalog(directoryPath, "*.dll");
			typeContainer = new CompositionContainer(catalog);
		}
	}

	public IEnumerable<T> GetExportedValues<T>()
	{
		return typeContainer.GetExportedValues<T>();
	}
}
