Class SevenZipArchiveEntry
Tên không gian: Aspose.Zip.SevenZip Tổng hợp: Aspose.Zip.dll (25.5.0)
Hiển thị một tập tin duy nhất trong 7z lưu trữ.
public abstract class SevenZipArchiveEntry : IArchiveFileEntry
Inheritance
Derived
SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain
Implements
Thành viên thừa kế
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Remarks
Nhập một Aspose.Zip.SevenZip.SevenZipArchiveEntry ví dụ đến Aspose.Zip.SevenZip.SevenZipArchiveEntryCrypted để xác định xem nhập được mã hóa hay không.
Properties
CompressedSize
Nhận kích thước của một tệp bị nén.
public ulong CompressedSize { get; }
Giá trị bất động sản
CompressionSettings
Có các cài đặt để làm trúng hoặc làm trúng.
public SevenZipCompressionSettings CompressionSettings { get; }
Giá trị bất động sản
FileAttributes
Nhận các thuộc tính tệp từ hệ thống lưu trữ.
protected FileAttributes FileAttributes { get; }
Giá trị bất động sản
IsDirectory
Nó nhận được một giá trị cho thấy liệu nhập có đại diện cho một thư mục hay không.
public bool IsDirectory { get; }
Giá trị bất động sản
ModificationTime
Nhận được ngày và thời gian sửa đổi cuối cùng.
public DateTime ModificationTime { get; }
Giá trị bất động sản
Name
Nhận tên vào trong tài liệu.
public string Name { get; protected set; }
Giá trị bất động sản
Source
Nhận dòng nguồn dữ liệu cho việc nhập.
protected Stream Source { get; }
Giá trị bất động sản
UncompressedSize
Nhận kích thước của một tập tin ban đầu.
public ulong UncompressedSize { get; }
Giá trị bất động sản
Methods
Extract(Thẻ, string)
Xét nhập vào hệ thống tệp theo con đường được cung cấp.
public FileInfo Extract(string path, string password = null)
Parameters
path
string
Đường đến tập tin đích. nếu tập tin đã tồn tại, nó sẽ được viết quá.
password
string
Tùy chọn mật khẩu cho decryption
Returns
Thông tin file của một file composed.
Examples
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract("data.bin");
}
Exceptions
path’ is null.
Người gọi không có giấy phép cần thiết để truy cập.
Đường path’ là trống, chỉ chứa các không gian trắng, hoặc chứa các ký tự vô hiệu.
Truy cập vào tệp path" bị từ chối.
Lối đi path", tên tệp, hoặc cả hai vượt quá chiều dài tối đa được xác định bởi hệ thống. Ví dụ, trên nền tảng dựa trên Windows, các con đường phải nhỏ hơn 248 ký tự, và tên tệp phải nhỏ hơn 260 ký tự.
Tệp ở path’ chứa một cột (:) ở giữa dòng.
Tài liệu đã bị phá hủy.
Extract(dòng, string)
Thu thập nhập vào dòng cung cấp.
public void Extract(Stream destination, string password = null)
Parameters
destination
Stream
Destination stream. phải được viết.
password
string
Tùy chọn mật khẩu cho decryption
Examples
Thu thập một bản ghi zip với mật khẩu.
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
Lưu trữ không được mở để lấy. - hoặc - Bài đăng này là một thư mục.
Dữ liệu sai trong đầu vào.
FinalizeCompressedData(Áp dụng, byte[])
Viết cho output stream bất kỳ tiêu đề nào theo dữ liệu nén.
protected abstract int FinalizeCompressedData(Stream outputStream, byte[] encoderProperties)
Parameters
outputStream
Stream
Xuất dòng cho việc nhập.
encoderProperties
byte
[ ]
Tính chất của compressor.
Returns
Số lượng byte “công nghệ” được thêm vào sau khi nhập khối dữ liệu đáng kể.
GetDestinationStream(Stream)
Destination stream for the entry, có thể được trang trí.
protected abstract Stream GetDestinationStream(Stream outputStream)
Parameters
outputStream
Stream
Xuất dòng cho việc nhập.
Returns
Ưu điểm dòng cho entry compression.
Open(String)
Mở vào để khai thác và cung cấp một dòng với nội dung nhập.
public Stream Open(string password = null)
Parameters
password
string
Tùy chọn mật khẩu cho decryption
Returns
dòng mà đại diện cho nội dung của bài đăng.
Examples
Sử dụng :Stream decompressed = entry.Open();
.NET 4.0 và cao hơn - sử dụng phương pháp Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 và trước - sao chép byte bằng tay:
byte[] buffer = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
fileStream.Write(buffer, 0, bytesRead);
```</p>
#### Remarks
Read from the stream to get the original content of a file. See examples section.
#### Exceptions
[InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)
The archive is not opened for extraction. - or - This entry is a directory.
[InvalidDataException](https://learn.microsoft.com/dotnet/api/system.io.invaliddataexception)
Wrong data within the entry.
### <a id="Aspose_Zip_SevenZip_SevenZipArchiveEntry_CompressionProgressed"></a> CompressionProgressed
Raises when a portion of raw stream compressed.
```csharp
public event EventHandler<progresseventargs> CompressionProgressed
Sự kiện Type
EventHandler < ProgressEventArgs >
Examples
archive.Entries[0].CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
Người gửi sự kiện là một trường hợp Aspose.Zip.SevenZip.SevenZipArchiveEntry.
Không đề cập trong chế độ đa phương cho các bài đăng LZMA2.