private bool UpdateImageFromDataSet(DataSet data, XmlElement node, string key)
{
if (!HtmlDom.IsImgOrSomethingWithBackgroundImage(node))
return false;
var newImageUrl = UrlPathString.CreateFromUrlEncodedString(data.TextVariables[key].TextAlternatives.GetFirstAlternative());
var oldImageUrl = HtmlDom.GetImageElementUrl(node);
var imgOrDivWithBackgroundImage = new ElementProxy(node);
HtmlDom.SetImageElementUrl(imgOrDivWithBackgroundImage,newImageUrl);
if (!newImageUrl.Equals(oldImageUrl))
{
Guard.AgainstNull(_updateImgNode, "_updateImgNode");
try
{
_updateImgNode(node);
}
catch (TagLib.CorruptFileException e)
{
NonFatalProblem.Report(ModalIf.Beta, PassiveIf.All, "Problem reading image metadata", newImageUrl.NotEncoded, e);
return false;
}
}
return true;
}