/// <summary> /// Creates a new linking package relative to a load order.<br/> /// Will resolve links to the highest overriding mod containing the record being sought. <br/> /// Modification of the target LoadOrder, or Mods on the LoadOrder is not safe. Internal caches can become /// incorrect if modifications occur on content already cached. /// </summary> /// <param name="loadOrder">LoadOrder to construct the package relative to</param> /// <param name="prefs">Caching preferences</param> /// <returns>LinkPackage attached to given LoadOrder</returns> public static ImmutableLoadOrderLinkCache ToUntypedImmutableLinkCache <TMod>( this ILoadOrderGetter <TMod> loadOrder, LinkCachePreferences?prefs = null) where TMod : class, IModGetter { return(new ImmutableLoadOrderLinkCache(loadOrder.ListedOrder, GameCategoryHelper.TryFromModType <TMod>(), prefs ?? LinkCachePreferences.Default)); }
/// <summary> /// Creates a new linking package relative to a load order.<br/> /// Will resolve links to the highest overriding mod containing the record being sought. <br/> /// Modification of the target LoadOrder, or Mods on the LoadOrder is not safe. Internal caches can become /// incorrect if modifications occur on content already cached. /// </summary> /// <param name="loadOrder">LoadOrder to construct the package relative to</param> /// <param name="prefs">Caching preferences</param> /// <returns>LinkPackage attached to given LoadOrder</returns> public static ImmutableLoadOrderLinkCache ToUntypedImmutableLinkCache <TMod>( this IEnumerable <IModListingGetter <TMod> > loadOrder, LinkCachePreferences?prefs = null) where TMod : class, IModGetter { return(new ImmutableLoadOrderLinkCache( loadOrder .Select(listing => listing.Mod) .NotNull(), GameCategoryHelper.TryFromModType <TMod>(), prefs ?? LinkCachePreferences.Default)); }