IcSharpCode.sharpziplib.zip erstellen Sie ZIP mit Verzeichniseintrag. "Eintrag kann keine Daten haben"C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 IcSharpCode.sharpziplib.zip erstellen Sie ZIP mit Verzeichniseintrag. "Eintrag kann keine Daten haben"

Post by Anonymous »

Ich habe ein Problem damit, ein Archiv zu erstellen und einen Verzeichniseintrag hinzuzufügen. Mein Code sieht wie folgt aus: < /p>
using (var zip = ZipFile.Create(zipPath))
{
if (!string.IsNullOrEmpty(password))
{
zip.ZipCryptoEncoding = Encoding.UTF8;
zip.Password = password;
}
zip.UseZip64 = UseZip64.Dynamic;

var EntryFactory = new ZipEntryFactory();
ZipEntry dirEntry = EntryFactory.MakeDirectoryEntry(dirPath);
dirEntry.DateTime = DateTime.Now;
dirEntry.IsUnicodeText = true;

if (!string.IsNullOrEmpty(password))
{
dirEntry.AESKeySize = 256;
}
if (!compression)
{
dirEntry.CompressionMethod = CompressionMethod.Stored;
}
if (compression)
{
dirEntry.CompressionMethod = CompressionMethod.Deflated;
}
zip.BeginUpdate();
zip.Add(dirEntry);
zip.CommitUpdate();

}
< /code>
Es wird eine Ausnahme "Eintrag können keine Daten haben." Gibt es eine Möglichkeit, eine ZIP -Datei Verzeichniseintrag hinzuzufügen?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post