示例#1
0
        private void BootMod(RuntimeMod mod)
        {
            var startupAssembly = mod.Info.RuntimeAssembly;
            var startupClass    = mod.Info.RuntimeClass;

            if (startupAssembly.IsNullOrWhiteSpace() || startupClass.IsNullOrWhiteSpace())
            {
                _log.LogInfo($"Loaded {mod.Info.Name}");
                return;
            }

            var assembly = GetStartupAssembly(startupAssembly);

            if (assembly == null)
            {
                _log.LogInfo($"Couldn't find runtime startup assembly for {mod.Info.Name}: {startupAssembly}");
                return;
            }

            var type = GetStartupClass(assembly, startupClass);

            if (type == null)
            {
                _log.LogInfo($"Couldn't find runtime startup class for {mod.Info.Name} in assembly {startupAssembly}: {startupClass}");
                return;
            }

            InstantiateStartupClass(type, mod);
            _log.LogInfo($"Loaded {mod.Info.Name} {mod.Info.Version} by {mod.Info.Author}");
        }
示例#2
0
        private void LoadMod(string modInfoPath)
        {
            var mod = new RuntimeMod(modInfoPath);

            if (!mod.IsValid)
            {
                return;
            }

            BootMod(mod);
        }
示例#3
0
 private void InstantiateStartupClass(Type type, RuntimeMod mod)
 {
     Activator.CreateInstance(type, mod);
     _instances.Add(mod);
 }