Extract Open 7z

Giới thiệu

Các tệp 7z được biết đến với tỷ lệ nén đặc biệt của chúng, làm cho chúng trở thành sự lựa chọn ưu tiên cho việc lưu trữ và chuyển dữ liệu. Trong hướng dẫn này, bạn sẽ tìm hiểu làm thế nào để mở hoặc từ các tệp 7z (7zip) một cách lập trình sử dụng C# trong ứng dụng của bạn.

Bảng nội dung

7z File (7zip) Extractor – C# API Cài đặt

To work with 7z files in your applications, you can utilize the Aspose.ZIP cho .NET API. This robust library supports a variety of compressed formats, including ZIP, RAR, and 7z.

Để bắt đầu, hãy cài đặt API qua NuGet với lệnh sau:

PM> Install-Package Aspose.Zip

Mở hoặc Tắt 7z File (7zip) Chương trình bằng cách sử dụng C#

Để mở hoặc xem các tập tin 7z một cách lập trình, hãy làm theo các bước sau đây:

  • Load the input 7z (7zip) archive using the SevenZipArchive class.
  • Use the ExtractToDirectory method to extract all files from the 7zip archive to a specified directory.

Dưới đây là một mẫu mã snippet:

using Aspose.Zip.SevenZip;
using System.IO;

class Program
{
    static void Main()
    {
        using (SevenZipArchive archive = new SevenZipArchive("input.7z"))
        {
            archive.ExtractToDirectory("output_folder");
        }
    }
}

Tiết xuất hoặc Unzip Password-Protected 7zip File bằng cách sử dụng C#

Để lấy một tệp 7zip được bảo vệ bằng mật khẩu, hãy làm theo các bước sau đây:

  • Tải xuống các tài liệu 7z mã hóa.
  • Use the ExtractToDirectory method, providing the password.

Dưới đây là việc thực hiện:

using Aspose.Zip.SevenZip;
using System.IO;

class Program
{
    static void Main()
    {
        using (SevenZipArchive archive = new SevenZipArchive("protected.7z"))
        {
            archive.ExtractToDirectory("output_folder", "your_password");
        }
    }
}

Nhận giấy phép API miễn phí

You can evaluate the Aspose.ZIP API without any limitations by requesting a Giấy phép tạm thời miễn phí.

Kết luận

In this article, you learned how to open or extract 7z files programmatically using C#. You also explored methods for handling password-protected archives in your .NET applications. For further assistance, visit the Forum hỗ trợ miễn phí or check out our API Tài liệu.

Với Aspose Plugin, bạn có thể quản lý 7z file manipulation một cách dễ dàng, làm cho nó một công cụ thiết yếu để thực hiện programmatic 7z extraction trong các ứng dụng .NET của bạn. Nếu bạn đang tìm kiếm thêm tài nguyên, hãy xem xét việc sử dụng một Online 7Z File Opener hoặc kiểm tra how to extract a 7c file using C# 7zip effectively.

More in this category