public static void CopyWithManifest(string sourcePath, string destinationPath, IDeploymentManifestReader previousManifest, bool skipOldFiles = true) { sourcePath = Path.GetFullPath(sourcePath); destinationPath = Path.GetFullPath(destinationPath); using (var progressWriter = new ProgressWriter()) { progressWriter.Start(); if (previousManifest != null) { var previousFiles = new HashSet<string>(previousManifest.GetPaths(), StringComparer.OrdinalIgnoreCase); SmartCopy(sourcePath, destinationPath, previousFiles.Contains, new DirectoryInfoWrapper(new DirectoryInfo(sourcePath)), new DirectoryInfoWrapper(new DirectoryInfo(destinationPath)), path => new DirectoryInfoWrapper(new DirectoryInfo(path))); } else { // On first deployment, delete the contents of the destination path before copying FileSystemHelpers.DeleteDirectoryContentsSafe(destinationPath); // If there's no manifest then there's nothing to copy FileSystemHelpers.Copy(sourcePath, destinationPath); } } }
public static void CopyWithManifest(string sourcePath, string destinationPath, IDeploymentManifestReader previousManifest) { sourcePath = Path.GetFullPath(sourcePath); destinationPath = Path.GetFullPath(destinationPath); using (var progressWriter = new ProgressWriter()) { if (previousManifest != null) { var previousFiles = new HashSet <string>(previousManifest.GetPaths(), StringComparer.OrdinalIgnoreCase); SmartCopy(sourcePath, destinationPath, previousFiles.Contains, new DirectoryInfoWrapper(new DirectoryInfo(sourcePath)), new DirectoryInfoWrapper(new DirectoryInfo(destinationPath)), path => new DirectoryInfoWrapper(new DirectoryInfo(path))); } else { // On first deployment, delete the contents of the destination path before copying FileSystemHelpers.DeleteDirectoryContentsSafe(destinationPath); // If there's no manifest then there's nothing to copy FileSystemHelpers.Copy(sourcePath, destinationPath); } } }