AssemblyUtil.cs 915 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace OpenSEMI.ClientBase.Utility
  8. {
  9. public class AssemblyUtil
  10. {
  11. public static Type GetType(string typeName)
  12. {
  13. Type type = Type.GetType(typeName);
  14. return type;
  15. }
  16. public static object CreateInstance(Type type)
  17. {
  18. return Activator.CreateInstance(type);
  19. }
  20. public static Assembly LoadAssembly(string assemblyName)
  21. {
  22. return Assembly.Load(assemblyName);
  23. }
  24. public static object CreateInstance(Assembly assembly, string typeName)
  25. {
  26. return assembly.CreateInstance(typeName);
  27. }
  28. public static string GetExecutePath()
  29. {
  30. return AppDomain.CurrentDomain.BaseDirectory;
  31. }
  32. }
  33. }