void MoveImagesFolder(string originalFileName, string oldTitle, string newFileName, bool copy = false) { var imageDirectory = GetImageDirectory(Path.GetDirectoryName(originalFileName), oldTitle); var newImageDirectory = GetImageDirectory(Path.GetDirectoryName(newFileName), Title); if (Directory.Exists(imageDirectory)) { if (copy) { CopyDirectory(imageDirectory, newImageDirectory); } else { Directory.Move(imageDirectory, newImageDirectory); } } var oldRelativePath = SiteContextHelper.ToRelativePath(Path.GetDirectoryName(originalFileName), originalFileName, imageDirectory); var newRelativePath = SiteContextHelper.ToRelativePath(Path.GetDirectoryName(newFileName), newFileName, newImageDirectory); MarkdownContent = MarkdownContent .Replace(oldRelativePath, newRelativePath); }
void MoveImagesFolder(string originalFileName, string oldTitle, string newFileName) { var imageDirectory = GetImageDirectory(Path.GetDirectoryName(originalFileName), oldTitle); var newImageDirectory = GetImageDirectory(Path.GetDirectoryName(newFileName), Title); if (FileSystem.Directory.Exists(imageDirectory)) { FileSystem.Directory.Move(imageDirectory, newImageDirectory); } var oldRelativePath = ToRelativePath(Path.GetDirectoryName(originalFileName), originalFileName, imageDirectory); var newRelativePath = ToRelativePath(Path.GetDirectoryName(newFileName), newFileName, newImageDirectory); MarkdownContent = MarkdownContent.Replace(oldRelativePath, newRelativePath); }