LoaderHelper.cs 414 B

1234567891011121314151617181920
  1. using System;
  2. using System.IO;
  3. using System.Reflection;
  4. namespace Common.Helper
  5. {
  6. public static class LoaderHelper
  7. {
  8. public static Assembly Load(string path)
  9. {
  10. if (!File.Exists(path))
  11. {
  12. throw new Exception(string.Format("not found path, path: {0}", path));
  13. }
  14. byte[] buffer = File.ReadAllBytes(path);
  15. var assembly = Assembly.Load(buffer);
  16. return assembly;
  17. }
  18. }
  19. }