Example #1
0
        // Token: 0x06000D5E RID: 3422 RVA: 0x0005B33C File Offset: 0x0005953C
        private static bool ValidateAssembly(ModInfo.AssemblyInfo info, out ModAssembly mAssembly)
        {
            List <Assembly> list = new List <Assembly>();

            if (!AssemblyScanner.Scan(info, list))
            {
                mAssembly = null;
                return(false);
            }
            mAssembly = new ModAssembly(info, list);
            if (info.Mod.Assemblies.Any((ModAssembly a) => a.Info.Path == info.Path))
            {
                MLog.Error("The same assmbly is listed in the manifest more than once!");
                mAssembly = null;
                return(false);
            }
            return(true);
        }
Example #2
0
        // Token: 0x06000D5F RID: 3423 RVA: 0x0005B3B8 File Offset: 0x000595B8
        private bool LoadAssembly(ModAssembly mAssembly)
        {
            bool result;

            try
            {
                Assembly assembly = Assembly.LoadFrom(mAssembly.Info.Path);
                mAssembly.Assembly = assembly;
                List <Type> list = (from t in assembly.GetTypes()
                                    where t.IsSubclassOf(typeof(ModEntryPoint)) && !t.IsAbstract
                                    select t).ToList <Type>();
                if (list.Count > 1)
                {
                    throw new Exception("Too many types extending ModEntryPoint!");
                }
                if (list.Count == 1)
                {
                    Type          type          = list[0];
                    ModEntryPoint modEntryPoint = (ModEntryPoint)Activator.CreateInstance(type);
                    mAssembly.HasModEntryPoint = true;
                    mAssembly.ModEntryPoint    = modEntryPoint;
                }
                else
                {
                    mAssembly.HasModEntryPoint = false;
                }
                result = true;
            }
            catch (Exception ex)
            {
                MLog.Error("Error loading assembly: " + mAssembly.Info.Path);
                MLog.Error(ex.ToString());
                result = false;
            }
            return(result);
        }
Example #3
0
 // Token: 0x06000D60 RID: 3424 RVA: 0x0005B4BC File Offset: 0x000596BC
 private bool InitializeAssembly(ModAssembly assembly)
 {
     return(ModdingUtil.PerformCallback(new Action(assembly.ModEntryPoint.OnLoad)));
 }