Пример #1
0
        public Mod_AutoMachineTool(ModContentPack content) : base(content)
        {
            this.Setting = this.GetSettings <ModSetting_AutoMachineTool>();

            var hopmAsm = LoadedModManager.RunningMods.Where(m => m.Name.StartsWith("Harvest Organs Post Mortem -")).SelectMany(m => m.assemblies.loadedAssemblies)
                          .Where(a => a.GetType("Autopsy.Mod") != null)
                          .FirstOption();

            var hugsAsm = LoadedModManager.RunningMods.Where(m => m.Name == "HugsLib").SelectMany(m => m.assemblies.loadedAssemblies)
                          .Where(a => a.GetType("HugsLib.Settings.SettingHandle") != null)
                          .FirstOption();

            this.Hopm = hopmAsm.SelectMany(ho => hugsAsm.SelectMany(hu => HopmMod.CreateHopmMod(ho, hu)));
        }
Пример #2
0
            public static Option <HopmMod> CreateHopmMod(Assembly hopmAsm, Assembly hugsAsm)
            {
                try
                {
                    var hopm = new HopmMod();

                    hopm.modType            = hopmAsm.GetType("Autopsy.Mod");
                    hopm.settingHandlerType = hugsAsm.GetType("HugsLib.Settings.SettingHandle`1");
                    hopm.recipeInfoType     = hopmAsm.GetType("Autopsy.RecipeInfo");

                    var utilType     = hopmAsm.GetType("Autopsy.NewMedicalRecipesUtility");
                    var traverseBody = utilType.GetMethod("TraverseBody", new Type[] { hopm.recipeInfoType, typeof(Corpse), typeof(float) });
                    hopm.traverseBody = traverseBody;

                    hopm.autopsyRecipeDefsType = hopmAsm.GetType("Autopsy.Util.AutopsyRecipeDefs");

                    return(Just(hopm));
                }
                catch (Exception e)
                {
                    Log.Error("HOPMのメタデータ取得エラー. " + e.ToString());
                    return(Nothing <HopmMod>());
                }
            }