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));
using (var image = PalasoImage.FromFile(path))
{
image.Metadata = metadata;
image.SaveUpdatedMetadataIfItMakesSense();
}
++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);
}
}