/// <summary> /// Copyies 'sourceFilePath from the textStream system to the archive as 'targetArchivePath' /// It will overwrite any existing textStream. /// </summary> public void CopyFromFile(string sourceFilePath, string targetArchivePath) { using (Stream inFile = new FileStream(sourceFilePath, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.ReadWrite)) using (Stream outFile = Create(targetArchivePath)) ZipArchiveFile.CopyStream(inFile, outFile); this[targetArchivePath].LastWriteTime = File.GetLastWriteTime(sourceFilePath); }
/// <summary> /// Copyies 'sourceFilePath from the textStream system to the archive as 'targetArchivePath' /// It will overwrite any existing textStream. /// </summary> /// <param name="stream"></param> /// <param name="lastWriteTime"></param> /// <param name="targetArchivePath"></param> public void CopyFromStream(System.IO.Stream stream, DateTime lastWriteTime, string targetArchivePath) { using (Stream outFile = Create(targetArchivePath)) ZipArchiveFile.CopyStream(stream, outFile); this[targetArchivePath].LastWriteTime = lastWriteTime; }