diff --git a/source/Control.cs b/source/Control.cs index fe864c6..538fb6c 100644 --- a/source/Control.cs +++ b/source/Control.cs @@ -2,6 +2,7 @@ using HBS.Logging; using HBS.Util; using System; +using System.Linq; using System.Reflection; namespace NewSaveFolder @@ -16,8 +17,8 @@ public static void Start(string modDirectory, string json) { try { - var isModTek = Type.GetType("ModTek.ModTek") != null; - if (!isModTek) + var hasModTek = GetAssemblyByName("ModTek") != null; + if (!hasModTek) { throw new InvalidOperationException("This mod is for ModTek only and does not run under ModLoader"); } @@ -41,5 +42,10 @@ public static void Start(string modDirectory, string json) Control.Logger.LogError(e); } } + + private static Assembly GetAssemblyByName(string name) + { + return AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == name); + } } }