查看檔案條目
在此程式碼示例中查看存檔條目意味著檢查或查看ZIP存檔中檔案的內容,而無需將其解壓縮。 IronZIP 允許用戶瀏覽檔案庫的內容並預覽文件名稱,而無需完全解壓縮它們。
要查看歸檔條目,首先,將歸檔文件路徑傳給建構函數以打開歸檔。 從那裡,使用GetArchiveEntryNames方法。 此方法將返回當前打開的存檔中的條目列表。
using IronZip;
using System;
using System.Collections.Generic;
// Open existing ZIP
using (var archive = new IronZipArchive("existing.zip"))
{
// Get Entries list
List<Entry> entries = archive.Entries();
foreach (Entry entry in entries)
{
Console.WriteLine(entry.Name);
}
}Imports IronZip
Imports System
Imports System.Collections.Generic
' Open existing ZIP
Using archive = New IronZipArchive("existing.zip")
' Get Entries list
Dim entries As List(Of Entry) = archive.Entries()
For Each entry As Entry In entries
Console.WriteLine(entry.Name)
Next entry
End UsingInstall-Package IronZip
在此程式碼示例中查看存檔條目意味著檢查或查看ZIP存檔中檔案的內容,而無需將其解壓縮。 IronZIP 允許用戶瀏覽檔案庫的內容並預覽文件名稱,而無需完全解壓縮它們。
要查看歸檔條目,首先,將歸檔文件路徑傳給建構函數以打開歸檔。 從那裡,使用GetArchiveEntryNames方法。 此方法將返回當前打開的存檔中的條目列表。