} // proc AddArchive private void UpdateMetaData(CmdletNotify notify, FileIndexItem src, FileInfo dst) { notify.SafeIO(() => { dst.LastAccessTimeUtc = src.LastAccessTimeUtc; dst.LastWriteTimeUtc = src.LastWriteTimeUtc; dst.CreationTimeUtc = src.CreationTimeUtc; dst.Attributes = src.Attributes; }, $"Setzen der Attribute {src.RelativePath} ist fehlgeschlagen."); } // proc UpdateMetaData
} // proc ZipFileItem private void GZipFileItem(CmdletNotify notify, CmdletProgress bar, Stream src, DirectoryInfo targetPath, FileIndexItem item) { using (var dst = new FileWrite(notify, new FileInfo(Path.Combine(targetPath.FullName, item.ArchiveName)), false, CompressMode.Auto)) { Stuff.CopyRawBytes(bar, item.RelativePath, src.Length, src, dst.Stream); dst.Commit(); } } // proc GZipFileItem
private static void AddArchive(Dictionary <string, List <FileIndexItem> > archives, FileIndexItem item, ref long totalBytes) { List <FileIndexItem> items; if (!archives.TryGetValue(item.ArchiveName, out items)) { archives[item.ArchiveName] = items = new List <FileIndexItem>(); } items.Add(item); totalBytes += item.Length; } // proc AddArchive
} // proc CloseZipStream private void ZipFileItem(CmdletNotify notify, CmdletProgress bar, Stream src, ZipOutputStream zip, FileIndexItem item) { var entry = new ZipEntry(ZipEntry.CleanName(item.RelativePath)); entry.DateTime = item.LastWriteTimeUtc; entry.Size = src.Length; entry.Comment = item.GetComment(); entry.CompressionMethod = ZipFile(item.RelativePath) ? CompressionMethod.Deflated : CompressionMethod.Stored; zip.PutNextEntry(entry); Stuff.CopyRawBytes(bar, item.RelativePath, src.Length, src, zip); zip.CloseEntry(); zip.Flush(); } // proc ZipFileItem