private static void RecursiveArchivate(string path, Ionic.Zip.ZipFile zip, string relPath, ref DateTime dt) { foreach (var file in Directory.GetFiles(path)) { //if (!CheckFile(file)) continue; var fdt = File.GetLastWriteTime(file); if (fdt > dt) dt = File.GetLastWriteTime(file); zip.AddFile(file, relPath); } foreach (string directory in Directory.GetDirectories(path)) { var dirName = new DirectoryInfo(directory).Name; RecursiveArchivate(directory, zip, string.Format(@"{0}\{1}", relPath, dirName), ref dt); } }
public override void PackResources(Ionic.Zip.ZipFile zip, String archiveTargetPath, IPath sourcePath) { RelativePath path = new RelativePath(this.Source, sourcePath); zip.AddFile(path.AbsolutePath, archiveTargetPath); }
private void AddToZip(string dir, int rootLength, Ionic.Zip.ZipFile zip) { string[] files = System.IO.Directory.GetFiles(dir); int len = files.Length; while (len-- > 0) { string file = files[len], path = file; path = path.Substring(0, path.LastIndexOf(Path.DirectorySeparatorChar)); zip.AddFile(file, path.Length > rootLength ? path.Substring(rootLength) : string.Empty); } string[] dirs = System.IO.Directory.GetDirectories(dir); len = dirs.Length; while (len-- > 0) { this.AddToZip(dirs[len], rootLength, zip); } }