Universal Extractor a .NET számára
Bevezetés a .NET Universal Extractorhoz
A Universal Extractor for .NET olyan plugin, amely lehetővé teszi a fejlesztők számára, hogy különböző formátumokban kivonják az archívumokat és a tömörített fájlokat, beleértve a ZIP, RAR, 7Z, TAR, GZIP és így tovább.
Támogatott archívumok
A Universal Extractor for .NET számos archív formátumot támogat, köztük:
- A ZIP (ZIP)
- Részletesebben RAR (RAR)
- 7 Z (7.7 Z )
- Székelyföld ( .tar )
- GZIP ( .gz )
- BZIP2 (.bz2) ábra
Kivonat Archívum
Ahhoz, hogy egy archívumot a .NET Universal Extractor segítségével kivonja, a következő kódmintát használhatja:
using System.IO;
using Aspose.Zip;
// Create a new instance of the Archive class
using (var archive = new Archive("example.zip"))
{
// Extract the archive to a directory
archive.ExtractToDirectory("extracted");
}
This code extracts the contents of the example.zip
archive to a directory named extracted
.
Archiválás jelszóvédelemmel
Ha egy archívum jelszóval van védve, akkor a következő kódmintát használhatja:
using System.IO;
using Aspose.Zip;
// Create a new instance of the Archive class
using (var archive = new Archive("example.zip"), new ArchiveLoadOptions() { DecryptionPassword = "YOUR-PASSWORD" })
{
// Extract the archive to a directory
archive.ExtractToDirectory("extracted");
}
This code extracts the contents of the example.zip
archive, which is protected with a password, to a directory named extracted
.
Archív tartalmak listája
Ahhoz, hogy az archívum tartalmát kivonat nélkül felsorolja, a következő kódmintát használhatja:
using System.IO;
using Aspose.Zip;
// Create a new instance of the Archive class
using (var archive = new Archive("example.zip"))
{
// Get the entries in the archive
var entries = archive.Entries;
// Iterate over the entries and print their names
foreach (var entry in entries)
{
Console.WriteLine(entry.Name);
}
}
This code lists the contents of the example.zip
archive without extracting it.