SceneGate / Yarhl

Framework for the implementation of format converters like game assets or media files
https://scenegate.github.io/Yarhl/
MIT License
60 stars 10 forks source link

❇️ Re-implementation of plugins API #206

Closed pleonex closed 9 months ago

pleonex commented 9 months ago

This PR introduces a new design of the plugins API. The classes are now in the new library Yarhl.Plugins. This implementation does not use any underlying technology like MEF in the past.

There are two main classes:

Additionally, new extension methods for AssemblyLoadContext help to load assemblies from the current executing directory or a given path. By default it does not load any additional assembly from any folder anymore. This was a potential security risk. Developers can choose to do it via these extension methods, alerting the user first if wanted.

Quality check list

Acceptance criteria

Follow-up work

None

Example

var converters = ConverterLocator.Instance.Converters;
var formats = ConverterLocator.Instance.Format;
var types1 = TypeLocator.Instance.FindImplementationOf(typeof(IFormat));

// For generic types use this overload
var types2 = TypeLocator.Instance.FindImplementationOfGeneric(typeof(IConverter<,>));