private static void ConvertImageReferencesToLocal(IBlogPostEditingContext editingContext) { ImageReferenceFixer refFixer = new ImageReferenceFixer(editingContext.ImageDataList, editingContext.BlogId); // Create a text writer that the new html will be written to TextWriter htmlWriter = new StringWriter(CultureInfo.InvariantCulture); // Check an html image fixer that will find references and rewrite them to new paths HtmlReferenceFixer referenceFixer = new HtmlReferenceFixer(editingContext.BlogPost.Contents); // We need to update the editing context when we change an image ContextImageReferenceFixer contextFixer = new ContextImageReferenceFixer(editingContext); // Do the fixing referenceFixer.FixReferences(htmlWriter, new ReferenceFixer(refFixer.FixImageReferences), contextFixer.ReferenceFixedCallback); // Write back the new html editingContext.BlogPost.Contents = htmlWriter.ToString(); }
private static void ConvertImageReferencesToLocal(IBlogPostEditingContext editingContext) { ImageReferenceFixer refFixer = new ImageReferenceFixer(editingContext.ImageDataList, editingContext.BlogId); // Create a text writer that the new html will be written to TextWriter htmlWriter = new StringWriter(CultureInfo.InvariantCulture); // Check an html image fixer that will find references and rewrite them to new paths HtmlReferenceFixer referenceFixer = new HtmlReferenceFixer(editingContext.BlogPost.Contents); // We need to update the editing context when we change an image ContextImageReferenceFixer contextFixer = new ContextImageReferenceFixer(editingContext); // Do the fixing referenceFixer.FixReferences(htmlWriter, new ReferenceFixer(refFixer.FixImageReferences), contextFixer.ReferenceFixedCallback); // Write back the new html editingContext.BlogPost.Contents = htmlWriter.ToString(); }