2023-09-12 12:50:18 +00:00
|
|
|
|
namespace Core
|
|
|
|
|
{
|
|
|
|
|
public class CoreInterface
|
|
|
|
|
{
|
|
|
|
|
private static readonly Dictionary<CoreInterface, EntryPoint> coreAssociations = new Dictionary<CoreInterface, EntryPoint>();
|
|
|
|
|
|
|
|
|
|
public T GetPlugin<T>() where T : IProjectPlugin
|
|
|
|
|
{
|
|
|
|
|
return coreAssociations[this].GetPlugin<T>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void Associate(CoreInterface coreInterface, EntryPoint entryPoint)
|
|
|
|
|
{
|
|
|
|
|
coreAssociations.Add(coreInterface, entryPoint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void Desociate(EntryPoint entryPoint)
|
|
|
|
|
{
|
2023-09-12 13:18:36 +00:00
|
|
|
|
var keys = coreAssociations.Where(p => p.Value == entryPoint).ToArray();
|
|
|
|
|
if (keys.Length == 0) return;
|
|
|
|
|
|
|
|
|
|
foreach (var key in keys)
|
|
|
|
|
{
|
|
|
|
|
coreAssociations.Remove(key.Key);
|
|
|
|
|
}
|
2023-09-12 12:50:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|