Dim ZipArch As New Xceed.Zip.ZipArchive(New DiskFile(ZipFileName)) ZipArch.DefaultEncryptionPassword = ZipPasswd ZipArch.DefaultDecryptionPassword = ZipPasswd Dim NewFile As New DiskFile(Filename) Dim DestFolder As AbstractFolder = ZipArch.GetFolder(“\”) NewFile.CopyTo(FSevents, Nothing, DestFolder, ReplaceIfExists) If FileComment <> “” Then Dim ZipContentFile As Xceed.Zip.ZippedFile ZipContentFile = ZipArch.GetFile(Filename) ZipArch.BeginUpdate() ZipContentFile.Comment = FileComment ZipArch.EndUpdate()
ZipContentFile.Refresh() End If
Imported from legacy forums. Posted by Marcelo (had 241 views)
This should work. I just tested it here, and it worked fine. <i> AbstractFile zip = new DiskFile( @”D:\\temp.zip” ); ZipArchive archive = new ZipArchive( zip );
ZippedFile file = new ZippedFile( zip, “tempfile.txt”);
file.Comment = “test comment”; Console.WriteLine( file.Comment.ToString() ); </i> If I run this code twice, the second time commenting out the file.Comment line, “test comment” is displayed, which means the comment was saved in the archive.
Imported from legacy forums. Posted by André (had 168 views)