public static void LoadModContent() { for (int i = 0; i < LoadedModManager.runningMods.Count; i++) { ModContentPack modContentPack = LoadedModManager.runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); try { modContentPack.ReloadContent(); } catch (Exception ex) { Log.Error(string.Concat(new object[] { "Could not reload mod content for mod ", modContentPack.Identifier, ": ", ex }), false); } finally { DeepProfiler.End(); } } }
public static void LoadAllActiveMods() { XmlInheritance.Clear(); int num = 0; foreach (ModMetaData item2 in ModsConfig.ActiveModsInLoadOrder.ToList()) { DeepProfiler.Start("Initializing " + item2); if (!item2.RootDir.Exists) { ModsConfig.SetActive(item2.Identifier, false); Log.Warning("Failed to find active mod " + item2.Name + "(" + item2.Identifier + ") at " + item2.RootDir); DeepProfiler.End(); } else { ModContentPack item = new ModContentPack(item2.RootDir, num, item2.Name); num++; LoadedModManager.runningMods.Add(item); DeepProfiler.End(); } } for (int i = 0; i < LoadedModManager.runningMods.Count; i++) { ModContentPack modContentPack = LoadedModManager.runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); modContentPack.ReloadContent(); DeepProfiler.End(); } foreach (Type item3 in typeof(Mod).InstantiableDescendantsAndSelf()) { if (!LoadedModManager.runningModClasses.ContainsKey(item3)) { ModContentPack modContentPack2 = (from modpack in LoadedModManager.runningMods where modpack.assemblies.loadedAssemblies.Contains(item3.Assembly) select modpack).FirstOrDefault(); LoadedModManager.runningModClasses[item3] = (Mod)Activator.CreateInstance(item3, modContentPack2); } } for (int j = 0; j < LoadedModManager.runningMods.Count; j++) { ModContentPack modContentPack3 = LoadedModManager.runningMods[j]; DeepProfiler.Start("Loading " + modContentPack3); modContentPack3.LoadDefs(LoadedModManager.runningMods.SelectMany((ModContentPack rm) => rm.Patches)); DeepProfiler.End(); } foreach (ModContentPack runningMod in LoadedModManager.runningMods) { foreach (PatchOperation patch in runningMod.Patches) { patch.Complete(runningMod.Name); } runningMod.ClearPatchesCache(); } XmlInheritance.Clear(); }
public static void LoadModContent() { for (int i = 0; i < LoadedModManager.runningMods.Count; i++) { ModContentPack modContentPack = LoadedModManager.runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); modContentPack.ReloadContent(); DeepProfiler.End(); } }
public static void LoadModContent() { for (int i = 0; i < runningMods.Count; i++) { ModContentPack modContentPack = runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); try { modContentPack.ReloadContent(); } catch (Exception ex) { Log.Error("Could not reload mod content for mod " + modContentPack.Identifier + ": " + ex); } finally { DeepProfiler.End(); } } }
public static void LoadModContent() { LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.Start("LoadModContent"); }); for (int i = 0; i < runningMods.Count; i++) { ModContentPack modContentPack = runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); try { modContentPack.ReloadContent(); } catch (Exception ex) { Log.Error("Could not reload mod content for mod " + modContentPack.PackageIdPlayerFacing + ": " + ex); } finally { DeepProfiler.End(); } } LongEventHandler.ExecuteWhenFinished(delegate { DeepProfiler.End(); for (int j = 0; j < runningMods.Count; j++) { ModContentPack modContentPack2 = runningMods[j]; if (!modContentPack2.AnyContentLoaded()) { Log.Error("Mod " + modContentPack2.Name + " did not load any content. Following load folders were used:\n" + modContentPack2.foldersToLoadDescendingOrder.ToLineList(" - ")); } } }); }
public static void LoadAllActiveMods() { XmlInheritance.Clear(); int num = 0; foreach (ModMetaData current in ModsConfig.ActiveModsInLoadOrder.ToList <ModMetaData>()) { DeepProfiler.Start("Initializing " + current); if (!current.RootDir.Exists) { ModsConfig.SetActive(current.Identifier, false); Log.Warning(string.Concat(new object[] { "Failed to find active mod ", current.Name, "(", current.Identifier, ") at ", current.RootDir })); DeepProfiler.End(); } else { ModContentPack item = new ModContentPack(current.RootDir, num, current.Name); num++; LoadedModManager.runningMods.Add(item); DeepProfiler.End(); } } for (int i = 0; i < LoadedModManager.runningMods.Count; i++) { ModContentPack modContentPack = LoadedModManager.runningMods[i]; DeepProfiler.Start("Loading " + modContentPack + " content"); modContentPack.ReloadContent(); DeepProfiler.End(); } foreach (Type type in typeof(Mod).InstantiableDescendantsAndSelf()) { if (!LoadedModManager.runningModClasses.ContainsKey(type)) { ModContentPack modContentPack2 = (from modpack in LoadedModManager.runningMods where modpack.assemblies.loadedAssemblies.Contains(type.Assembly) select modpack).FirstOrDefault <ModContentPack>(); LoadedModManager.runningModClasses[type] = (Mod)Activator.CreateInstance(type, new object[] { modContentPack2 }); } } for (int j = 0; j < LoadedModManager.runningMods.Count; j++) { ModContentPack modContentPack3 = LoadedModManager.runningMods[j]; DeepProfiler.Start("Loading " + modContentPack3); modContentPack3.LoadDefs(LoadedModManager.runningMods.SelectMany((ModContentPack rm) => rm.Patches)); DeepProfiler.End(); } foreach (ModContentPack current2 in LoadedModManager.runningMods) { foreach (PatchOperation current3 in current2.Patches) { current3.Complete(current2.Name); } current2.ClearPatchesCache(); } XmlInheritance.Clear(); }