示例#1
0
        private static void AddToFoundModsIfACMLMod(string dllLocation)
        {
            Utilities.Logger.Print($"Attempting to load dll: {dllLocation}");

            try
            {
                Assembly assembly        = Assembly.LoadFrom(dllLocation);
                Type     entryPointClass = assembly.ManifestModule.GetTypes().First((x) => x.GetCustomAttributes(typeof(ACMFMod), true).Length > 0);
                if (entryPointClass == null)
                {
                    return;
                }

                MethodInfo entryPointMethod = entryPointClass.GetMethods().First((x) => x.GetCustomAttributes(typeof(ACMFModEntryPoint), true).Length > 0);
                if (entryPointMethod == null)
                {
                    return;
                }

                ACMFMod acmlMod = (ACMFMod)entryPointClass.GetCustomAttributes(typeof(ACMFMod), true).FirstOrDefault();
                ModsFound.Add(acmlMod.ID, new Mod(acmlMod, assembly, entryPointMethod));
                Utilities.Logger.Print($"Found Mod: {acmlMod.Name}");
            }
            catch
            {
            }
        }
示例#2
0
 public Mod(ACMFMod modInfo, Assembly assembly, MethodInfo entryPoint)
 {
     ModInfo             = modInfo;
     Assembly            = assembly;
     EntryPoint          = entryPoint;
     ModVersion          = ModVersion.Parse(modInfo.ModVersion);
     RequiredACMFVersion = ModVersion.Parse(modInfo.RequiredACMFVersion);
     ModLoadFailure      = ModLoadFailure.UNKNOWN;
 }