Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dlls = pluginFiles.Where(p => p.Value.FileInfo.Extension.ToLower() == ".dll").ToList();
- int num = 0;
- foreach(var dll in dlls){
- var assembly = Assembly.LoadFile (dll.Value.FileInfo.FullName);
- var pluginTypes = assembly.GetTypes().Where (p => p.IsSubclassOf (typeof (Plugin)));
- foreach(var pluginType in pluginTypes){
- var ctor = pluginType.GetConstructors ().FirstOrDefault ();
- if (ctor == null) continue;
- var plugin = (Plugin)ctor.Invoke (new object [] { });
- if (plugin == null) continue;
- num++;
- _mgr.RegisterNew (plugin);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement