/// <summary> /// Locates link winning target record in given Link Cache. /// </summary> /// <param name="link">Link to resolve</param> /// <param name="cache">Link Cache to resolve against</param> /// <returns>Located Major Record</returns> /// <exception cref="NullReferenceException">If link was not successful</exception> /// <typeparam name="TMajor">Major Record type to resolve to</typeparam> public static IModContext <TMajor>?ResolveSimpleContext <TMajor>( this IFormLinkGetter <TMajor> link, ILinkCache cache) where TMajor : class, IMajorRecordGetter { if (link.TryResolveSimpleContext <TMajor>(cache, out var majorRecord)) { return(majorRecord); } return(null); }
public override bool TryResolveContext <TMajor, TMajorGetter>(IFormLinkGetter <TMajorGetter> formLink, ILinkCache <ISkyrimMod, ISkyrimModGetter> cache, [MaybeNullWhen(false)] out IModContext context) { if (formLink.TryResolveSimpleContext <TMajorGetter>(cache, out var resolved)) { context = resolved; return(true); } context = default; return(false); }