public static void DoAddToModListFloatMenu(ModButton_Installed mod) { var cur = ListsFor(mod); var options = ModLists .Where(l => !cur.Contains(l)) .Select(l => new FloatMenuOption(I18n.AddToModListX(l.Name), () => l.Add(mod.Selected))) .ToList(); Utilities.FloatMenu(options); }
public static List <ModList> ListsFor(ModMetaData mod) { // garbage in, garbage out. if (mod == null) { return(null); } // get from cache List <ModList> lists; if (_modModListsCache.TryGetValue(mod, out lists)) { return(lists); } // add to cache lists = ModLists .Where(l => l._modIds.Contains(mod.Identifier)) .ToList(); _modModListsCache.Add(mod, lists); return(lists); }
public static List <ModList> ListsFor(ModMetaData mod) { // garbage in, garbage out. if (mod == null) { return(_emptyModList); } // get from cache List <ModList> lists; if (_modListsCache.TryGetValue(mod, out lists)) { return(lists); } // add to cache lists = ModLists .Where(l => l.Mods.Any(m => m.Id == mod.PackageId)) .ToList(); _modListsCache.Add(mod, lists); return(lists); }