public static void CopyImageMetadataToWholeBook(string folderPath, HtmlDom dom, Metadata metadata, IProgress progress)
{
progress.WriteStatus("Starting...");
//First update the images themselves
int completed = 0;
var imgElements = GetImagePaths(folderPath);
foreach (string path in imgElements)
{
progress.ProgressIndicator.PercentCompleted = (int)(100.0 * (float)completed / imgElements.Count());
progress.WriteStatus("Copying to " + Path.GetFileName(path));
try
{
metadata.WriteIntellectualPropertyOnly(path);
}
catch (TagLib.CorruptFileException e)
{
NonFatalProblem.Report(ModalIf.Beta, PassiveIf.All,"Image metadata problem", "Bloom had a problem accessing the metadata portion of this image " + path+ " ref(BL-3214)", e);
}
++completed;
}
//Now update the html attributes which echo some of it, and is used by javascript to overlay displays related to
//whether the info is there or missing or whatever.
foreach (XmlElement img in dom.SafeSelectNodes("//img"))
{
UpdateImgMetdataAttributesToMatchImage(folderPath, img, progress, metadata);
}
}