Class SevenZipArchiveEntry
ชื่อพื้นที่: Aspose.Zip.SevenZip การประกอบ: Aspose.Zip.dll (25.5.0)
แสดงไฟล์เดียวภายในไฟล์ 7z
public abstract class SevenZipArchiveEntry : IArchiveFileEntry
Inheritance
Derived
SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain
Implements
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Remarks
วางตัวอย่าง Aspose.Zip.SevenZip.SevenZipArchiveEntry ไปยัง Aspose.Zip.SevenZip.SevenZipArchiveEntry Encrypted เพื่อตรวจสอบว่าการเข้าสู่ระบบจะเข้ารหัสหรือไม่
Properties
CompressedSize
ได้รับขนาดของไฟล์ที่บีบอัด
public ulong CompressedSize { get; }
คุณสมบัติมูลค่า
CompressionSettings
ได้รับการตั้งค่าสําหรับการบีบอัดหรือการบีบอัด
public SevenZipCompressionSettings CompressionSettings { get; }
คุณสมบัติมูลค่า
FileAttributes
รับคุณสมบัติไฟล์จากระบบโฮสต์
protected FileAttributes FileAttributes { get; }
คุณสมบัติมูลค่า
IsDirectory
ได้รับค่าแสดงให้เห็นว่าการเข้าสู่ระบบเป็นรายชื่อ
public bool IsDirectory { get; }
คุณสมบัติมูลค่า
ModificationTime
ได้รับการเปลี่ยนแปลงล่าสุดวันที่และเวลา
public DateTime ModificationTime { get; }
คุณสมบัติมูลค่า
Name
รับชื่อของรายการภายในเอกสาร
public string Name { get; protected set; }
คุณสมบัติมูลค่า
Source
ได้รับการไหลของแหล่งข้อมูลสําหรับการเข้าสู่ระบบ
protected Stream Source { get; }
คุณสมบัติมูลค่า
UncompressedSize
ได้รับขนาดของไฟล์เดิม
public ulong UncompressedSize { get; }
คุณสมบัติมูลค่า
Methods
Extract(รั้ว, รั้ว)
นําเข้าสู่ระบบไฟล์โดยเส้นทางที่ให้
public FileInfo Extract(string path, string password = null)
Parameters
path
string
เส้นทางไปยังไฟล์เป้าหมาย หากไฟล์มีอยู่แล้วมันจะถูกเขียนเกินไป
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Returns
ข้อมูลไฟล์ของไฟล์ประกอบ
Examples
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract("data.bin");
}
Exceptions
path’ is null.
ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง
path" เป็นที่ว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง
การเข้าถึงไฟล์ path" ถูกปฏิเสธ
ระบุ path’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ไฟล์ใน path" มีคอลัมน์ (:) ในส่วนกลางของเส้น
ไฟล์นี้ถูกทําลาย
Extract(กระแส, string)
นําเข้าสู่การไหลที่ให้
public void Extract(Stream destination, string password = null)
Parameters
destination
Stream
จุดหมายปลายทาง Stream. ต้องการเขียนได้
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Examples
extract a entry of zip archive ด้วยรหัสผ่าน
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
ไฟล์ไม่เปิดสําหรับการสกัด - หรือ - รายการนี้เป็นไดเรกทอรี
ข้อมูลที่ไม่ถูกต้องภายในรายการ
FinalizeCompressedData(แหล่งจ่ายไฟ, byte[])
เขียนไปยังแหล่งกําเนิดหัวหน้าใด ๆ ที่ติดตามข้อมูลที่บีบอัด
protected abstract int FinalizeCompressedData(Stream outputStream, byte[] encoderProperties)
Parameters
outputStream
Stream
กระแสออกสําหรับการเข้าสู่ระบบ
encoderProperties
byte
[ ]
คุณสมบัติของคอมเพรสเซอร์
Returns
จํานวนไบต์ “เทคนิค” ที่เพิ่มหลังจากเข้าบล็อกข้อมูลที่สําคัญ
GetDestinationStream(Stream)
กระแสเป้าหมายสําหรับการเข้าสู่ระบบสามารถตกแต่งได้
protected abstract Stream GetDestinationStream(Stream outputStream)
Parameters
outputStream
Stream
กระแสออกสําหรับการเข้าสู่ระบบ
Returns
กระแสเป้าหมายสําหรับการบีบอัดเข้า
Open(รั้ว)
เปิดป้อนสําหรับการสกัดและให้การไหลที่มีเนื้อหาป้อน
public Stream Open(string password = null)
Parameters
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Returns
กระแสที่แสดงให้เห็นถึงเนื้อหาของป้อน
Examples
การใช้งาน :Stream decompressed = entry.Open();
.NET 4.0 และสูงกว่า - ใช้วิธีการ Stream.CopyTo:decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 และก่อนหน้านี้ - คัดลอกไบต์ด้วยตนเอง:
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
ประเภทเหตุการณ์
EventHandler < ProgressEventArgs >
Examples
archive.Entries[0].CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
ผู้ส่งเหตุการณ์เป็นตัวอย่าง Aspose.Zip.SevenZip.SevenZipArchiveEntry
ไม่เรียกร้องในโหมด multithread สําหรับรายการ LZMA2