Class XarFileEntry
ชื่อพื้นที่: Aspose.Zip.Xar การประกอบ: Aspose.Zip.dll (25.5.0)
แสดงการเข้าสู่ระบบไฟล์ภายในไฟล์ xar
public sealed class XarFileEntry : XarEntry, IArchiveFileEntry
Inheritance
object ← XarEntry ← XarFileEntry
Implements
อนุญาโตตุลาการ
XarEntry.ToString() , XarEntry.Name , XarEntry.FullPath , XarEntry.IsDirectory , XarEntry.Parent , XarEntry.CreationTime , XarEntry.LastAccessTime , XarEntry.LastWriteTime , XarEntry.ModificationTime , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Properties
Length
รับความยาวของการเข้าสู่ระบบในไบต์
public long Length { get; }
คุณสมบัติมูลค่า
Methods
Extract(รั้ว)
นําเข้าสู่ระบบไฟล์โดยเส้นทางที่ให้
public FileInfo Extract(string path)
Parameters
path
string
เส้นทางไปยังไฟล์เป้าหมาย หากไฟล์มีอยู่แล้วมันจะถูกเขียนเกินไป
Returns
ข้อมูลไฟล์ของไฟล์ประกอบ
Examples
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract("data.bin");
}
Exceptions
path’ is null.
ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง
path" เป็นที่ว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง
การเข้าถึงไฟล์ path" ถูกปฏิเสธ
ระบุ path’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ไฟล์ใน path" มีคอลัมน์ (:) ในส่วนกลางของเส้น
ไฟล์นี้ถูกทําลาย
Extract(Stream)
นําเข้าสู่การไหลที่ให้
public void Extract(Stream destination)
Parameters
destination
Stream
จุดหมายปลายทาง Stream. ต้องการเขียนได้
Examples
extract การเข้าสู่ระบบของ xar archive
using (var archive = new XarArchive("archive.xar"))
{
((XarFileEntry)archive.Entries[0]).Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
ไฟล์นี้ถูกทําลาย
Open()
เปิดป้อนสําหรับการสกัดและให้การไหลที่มีเนื้อหาป้อน
public Stream Open()
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.
### <a id="Aspose_Zip_Xar_XarFileEntry_CompressionProgressed"></a> CompressionProgressed
Raises when a portion of raw stream compressed.
```csharp
public event EventHandler<progresseventargs> CompressionProgressed
ประเภทเหตุการณ์
EventHandler < ProgressEventArgs >
Examples
archive.Entries.First().CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
ผู้ส่งเหตุการณ์เป็นตัวอย่าง Aspose.Zip.Xar.XarFileEntry