private bool UpdateIndexTags(SoftwareIdentity indexJsonTag, SoftwareIdentity indexXmlTag, List <AddedTagResult> addedTags, List <UpdatedTagResult> updatedTags, List <DeleteTagResult> deleteTags) { var any = false; foreach (var added in addedTags) { indexJsonTag.AddLink(added.NewSourceUris.JsonUri, "package"); indexXmlTag.AddLink(added.NewSourceUris.XmlUri, "package"); any = true; } foreach (var update in updatedTags) { indexJsonTag.RemoveLink(update.OldSourceUris.JsonUri); indexXmlTag.RemoveLink(update.OldSourceUris.XmlUri); indexJsonTag.AddLink(update.NewSourceUris.JsonUri, "package"); indexXmlTag.AddLink(update.NewSourceUris.XmlUri, "package"); any = true; } foreach (var uri in deleteTags) { indexJsonTag.RemoveLink(uri.DeleteSourceUris.JsonUri); indexXmlTag.RemoveLink(uri.DeleteSourceUris.XmlUri); any = true; } return(any); }
private static IEnumerable <RedirectEntity> UpdateInstallationMediaLinksInSoftwareIdentityAndReturnWithRedirects(string tagPartitionKey, string tagRowKey, SoftwareIdentity swidtag) { foreach (var installationLink in swidtag.Links.Where(l => l.Relationship == FearTheCowboy.Iso19770.Schema.Relationship.InstallationMedia)) { var redirect = new RedirectEntity(tagPartitionKey, tagRowKey, installationLink.HRef.AbsoluteUri, installationLink.MediaType, installationLink.Media, null); swidtag.RemoveLink(installationLink.HRef); var redirectUri = new Uri(redirect.RedirectUri); swidtag.AddLink(redirectUri, FearTheCowboy.Iso19770.Schema.Relationship.InstallationMedia); yield return(redirect); } }