Class RarArchiveEntry
ชื่อพื้นที่: Aspose.Zip.Rar การประกอบ: Aspose.Zip.dll (25.5.0)
แสดงไฟล์เดียวภายในเอกสาร
public abstract class RarArchiveEntry : IArchiveFileEntry
Inheritance
Derived
RarArchiveEntryEncrypted , RarArchiveEntryPlain
Implements
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Remarks
เลือกตัวอย่าง Aspose.Zip.Rar.RarArchiveEntry ไปยัง Aspose.Zip.Rar.RarArchiveEntry Encrypted เพื่อระบุว่าการเข้าสู่ระบบถูกเข้ารหัสหรือไม่
Properties
CompressedSize
ได้รับขนาดของไฟล์ที่บีบอัด
public ulong CompressedSize { get; }
คุณสมบัติมูลค่า
CreationTime
ได้รับวันที่และเวลาการสร้าง
public DateTime CreationTime { get; }
คุณสมบัติมูลค่า
IsDirectory
ได้รับค่าแสดงให้เห็นว่าการเข้าสู่ระบบเป็นรายชื่อ
public bool IsDirectory { get; }
คุณสมบัติมูลค่า
LastAccessTime
ได้รับวันที่และเวลาการเข้าถึงครั้งสุดท้าย
public DateTime LastAccessTime { get; }
คุณสมบัติมูลค่า
ModificationTime
ได้รับการเปลี่ยนแปลงล่าสุดวันที่และเวลา
public DateTime ModificationTime { get; }
คุณสมบัติมูลค่า
Name
รับชื่อของรายการภายในเอกสาร
public string Name { get; }
คุณสมบัติมูลค่า
Source
ได้รับการไหลของแหล่งข้อมูลสําหรับการเข้าสู่ระบบ
protected Stream Source { get; set; }
คุณสมบัติมูลค่า
UncompressedSize
รับขนาดของไฟล์เดิม
public ulong UncompressedSize { get; }
คุณสมบัติมูลค่า
Methods
Extract(รั้ว, รั้ว)
นําเข้าสู่ระบบไฟล์โดยเส้นทางที่ให้
public FileInfo Extract(string path, string password = null)
Parameters
path
string
เส้นทางไปยังไฟล์เป้าหมาย หากไฟล์มีอยู่แล้วมันจะถูกเขียนเกินไป
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Returns
ข้อมูลไฟล์ของไฟล์ประกอบ
Examples
extract 2 entries of rar archive.
using (FileStream rarFile = File.Open("archive.rar", FileMode.Open))
{
using (RarArchive archive = new RarArchive(rarFile))
{
archive.Entries[0].Extract("first.bin", "pass");
archive.Entries[1].Extract("second.bin", "pass");
}
}
Exceptions
path’ is null.
ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง
path" เป็นที่ว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง
การเข้าถึงไฟล์ path" ถูกปฏิเสธ
ระบุ path’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ไฟล์ใน path" มีคอลัมน์ (:) ในส่วนกลางของเส้น
ไฟล์ไม่ได้พบ
เส้นทางที่ระบุไม่ถูกต้องเช่นอยู่บนไดรฟ์ที่ไม่มีแผนที่
ไฟล์นี้เปิดแล้ว
Data is corrupt. -or- การตรวจสอบ CRC หรือ MAC ไม่สามารถเข้าสู่ระบบได้
Extract(กระแส, string)
นําเข้าสู่การไหลที่ให้
public void Extract(Stream destination, string password = null)
Parameters
destination
Stream
จุดหมายปลายทาง Stream. ต้องการเขียนได้
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Examples
extract a entry of rar archive ด้วยรหัสผ่าน
using (FileStream rarFile = File.Open("archive.zip", FileMode.Open))
{
using (RarArchive archive = new RarArchive(rarFile))
{
archive.Entries[0].Extract(httpResponseStream, "p@s$");
}
}
Exceptions
การตรวจสอบ CRC หรือ MAC ไม่สามารถเข้าสู่ระบบได้
destination’ does not support writing.
Data is corrupt. -or- การตรวจสอบ CRC หรือ MAC ไม่สามารถเข้าสู่ระบบได้
Open(รั้ว)
เปิดป้อนสําหรับการสกัดและให้การไหลที่มีเนื้อหาป้อนที่ถูกบีบอัด
public Stream Open(string password = null)
Parameters
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption นอกจากนี้ยังสามารถตั้งไว้ภายใน Aspose.Zip.Rar.RarArchiveLoadOptions.DecryptionPassword
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
<p>Read from the stream to get the original content of a file. See examples section.</p>
### <a id="Aspose_Zip_Rar_RarArchiveEntry_ExtractionProgressed"></a> ExtractionProgressed
Raises when a portion of raw stream extracted.
```csharp
public event EventHandler<progresseventargs> ExtractionProgressed
ประเภทเหตุการณ์
EventHandler < ProgressEventArgs >
Examples
archive.Entries[0].ExtractionProgressed += (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((RarArchiveEntry)s).UncompressedSize); };
Remarks
ผู้ส่งเหตุการณ์เป็นตัวอย่าง Aspose.Zip.Rar.RarArchiveEntry