DllHelper.cs 721 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Reflection;
  5. namespace Model
  6. {
  7. public static class DllHelper
  8. {
  9. public static Assembly GetHotfixAssembly()
  10. {
  11. byte[] dllBytes = File.ReadAllBytes("./Hotfix.dll");
  12. #if __MonoCS__
  13. byte[] pdbBytes = File.ReadAllBytes("./Hotfix.dll.mdb");
  14. #else
  15. byte[] pdbBytes = File.ReadAllBytes("./Hotfix.pdb");
  16. #endif
  17. Assembly assembly = Assembly.Load(dllBytes, pdbBytes);
  18. return assembly;
  19. }
  20. public static Type[] GetBaseTypes()
  21. {
  22. List<Type> types = new List<Type>();
  23. foreach (Assembly assembly in Game.EntityEventManager.GetAssemblies())
  24. {
  25. types.AddRange(assembly.GetTypes());
  26. }
  27. return types.ToArray();
  28. }
  29. }
  30. }