private void AddLink(ref Dictionary <AssetId, AssetLink> dictionary, AssetLink contentLink) { if (dictionary == null) { dictionary = new Dictionary <AssetId, AssetLink>(); } var id = contentLink.Element.Id; if (dictionary.TryGetValue(id, out var existingLink)) { contentLink.Type |= existingLink.Type; } dictionary[id] = contentLink; }
/// <summary> /// Adds a link going to the provided element. /// </summary> /// <param name="contentLink">The link out</param> /// <exception cref="ArgumentException">A link to this element already exists</exception> public void AddLinkOut(AssetLink contentLink) { AddLink(ref children, contentLink); }
/// <summary> /// Adds a link coming from the provided element. /// </summary> /// <param name="contentLink">The link in</param> /// <exception cref="ArgumentException">A link from this element already exists</exception> public void AddLinkIn(AssetLink contentLink) { AddLink(ref parents, contentLink); }