โปรแกรมแยกไฟล์สำหรับ .NET

การนําเข้าสู่ Universal Extractor สําหรับ .NET

The Universal Extractor for .NET เป็นปลั๊กอินที่ช่วยให้ผู้พัฒนาสามารถสกัดไฟล์และไฟล์ที่บีบอัดในรูปแบบต่างๆรวมถึง ZIP, RAR, 7Z, TAR, GZIP และอื่น ๆ คู่มือนี้ให้รายละเอียดเกี่ยวกับคุณสมบัติที่มีอยู่และอธิบายวิธีการดําเนินการงานทั่วไปโดยใช้ตัวอย่างรหัสใน .Net

รูปแบบไฟล์ที่ได้รับการสนับสนุน

Universal Extractor สําหรับ .NET สนับสนุนรูปแบบไฟล์ที่หลากหลายรวมถึง:

  • ZIP ( .zip )
  • รุนแรง (RAR)
  • 7Z (.7z)
  • TAR (.tar )
  • GZIP (.gz )
  • BZIP2 (.bz2)

สารสกัด

เพื่อ استخراجไฟล์โดยใช้ Universal Extractor for .NET คุณสามารถใช้ตัวอย่างรหัสต่อไปนี้:

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");
}

รหัสนี้จะสกัดเนื้อหาของ example.zip ไฟล์ไปยังไดเรกทอรีที่มีชื่อ extracted.

สารสกัดด้วยการป้องกันรหัสผ่าน

หากเอกสารได้รับการป้องกันด้วยรหัสผ่านคุณสามารถ استخراجได้โดยใช้ตัวอย่างโค้ดต่อไปนี้:

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");
}

รหัสนี้จะสกัดเนื้อหาของ example.zip ไฟล์ที่ได้รับการปกป้องด้วยรหัสผ่านไปยังไดเรกทอรีที่เรียกว่า extracted.

รายการเนื้อหา Archive

เพื่อจัดรายการเนื้อหาของเอกสารโดยไม่ต้องสกัดคุณสามารถใช้ตัวอย่างรหัสต่อไปนี้:

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);
    }
}

รหัสนี้ระบุเนื้อหาของ example.zip การจัดเก็บข้อมูลโดยไม่ต้องสกัด

 แบบไทย