public virtual void UpdateModList() { if (!inited) { gameManager.ConsoleWindow.WriteLine("ModLoader was not initialized, can't update mod list."); return; } modList.Clear(); // Create a list of the mods we have in the mod directory. if (modDirectory.HasMods) { foreach (string modName in modDirectory.GetModNames()) { ModInfo mi = new ModInfo(); mi.path = modDirectory.GetModPath(modName); mi.fileName = modName; IModInfo modInfo = modDirectory.GetMod(mi.fileName); mi.modName = modInfo.NameInfo.ModName; mi.identifier = $"{modInfo.ModAuthor.ToLower()}.{modInfo.NameInfo.ModName.ToLower()}"; modList.Add(mi); } } // Add mods from the command line. if (Mod.CommandLine.HasMods) { foreach (Uri modPath in Mod.CommandLine.AllMods) { ModInfo mi = new ModInfo(); mi.commandLine = true; mi.path = modPath; mi.fileName = System.IO.Path.GetFileName(modPath.LocalPath); IModInfo modInfo = ModDirectory.GetMod(new FileInfo(mi.path.LocalPath)); mi.modName = modInfo.NameInfo.ModName; mi.identifier = $"{modInfo.ModAuthor.ToLower()}.{modInfo.NameInfo.ModName.ToLower()}"; modList.Add(mi); } } }
public IModInfo GetModInfo(ModInfo modInfo) { return(ModDirectory.GetMod(new FileInfo(modInfo.path.LocalPath))); }