/// <summary> /// Inserts the downloaded local files into the html code /// so that the links in srcs will refer to the local files. /// </summary> private void InsertLinks() { foreach (KeyValuePair <string, string> pair in resourcesNames) { Console.WriteLine("DEBUG: Replacing {0} -> {1}", pair.Key, pair.Value); this.HtmlCode = HtmlCode.Replace(pair.Key, GetRelativeUrl(pair.Value)); } }
/// <summary> /// Removes srcset from the html code because it's making the images /// disappear /// </summary> private void RemoveSrcsetAttribute() { var srcsetRegex = new Regex(@"srcset=[""'].+[""']", RegexOptions.IgnoreCase); foreach (Match match in srcsetRegex.Matches(this.HtmlCode)) { this.HtmlCode = HtmlCode.Replace(match.Value, ""); } }