public void UploadFilesBeforePublish() { // create a file uploader using (BlogFileUploader fileUploader = BlogFileUploader.CreateFileUploader(_blog, _publishingContext.EditingContext.ServerSupportingFileDirectory)) { // connect to the file uploader fileUploader.Connect(); // upload the files and fixup references within the contents of the blog post string htmlContents = _publishingContext.EditingContext.BlogPost.Contents; _referenceFixer = new BlogPostReferenceFixer(htmlContents, _publishingContext); _referenceFixer.Parse(); string fixedHtml = HtmlReferenceFixer.FixLocalFileReferences(htmlContents, _referenceFixer.GetFileUploadReferenceFixer(fileUploader)); _publishingContext.EditingContext.BlogPost.Contents = fixedHtml; } }
public LocalFileTransformer(BlogPostReferenceFixer referenceFixer, BlogFileUploader uploader) { _referenceFixer = referenceFixer; _fileService = _referenceFixer._uploadContext.EditingContext.SupportingFileService; _uploader = uploader; }