Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. var dlls = pluginFiles.Where(p => p.Value.FileInfo.Extension.ToLower() == ".dll").ToList();
  2. int num = 0;
  3. foreach(var dll in dlls){
  4. var assembly = Assembly.LoadFile (dll.Value.FileInfo.FullName);
  5. var pluginTypes = assembly.GetTypes().Where (p => p.IsSubclassOf (typeof (Plugin)));
  6. foreach(var pluginType in pluginTypes){
  7. var ctor = pluginType.GetConstructors ().FirstOrDefault ();
  8. if (ctor == null) continue;
  9. var plugin = (Plugin)ctor.Invoke (new object [] { });
  10. if (plugin == null) continue;
  11. num++;
  12. _mgr.RegisterNew (plugin);
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement