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".
على سبيل المثال ، على المنصات المستندة إلى Windows ، يجب أن تكون المسارات أقل من 248 حرفًا ، ويجب أن يكون اسم الملف أقل من 260 حرفًا.
ملف في path’ يحتوي على عمود (:) في وسط السلسلة.
وقد تم تدمير الأرشيف
Extract(Stream)
إخراج الدخول إلى التدفق المقدم.
public void Extract(Stream destination)
Parameters
destination
Stream
كلمات مفتاحية يجب أن تكون مكتوبة
Examples
استخراج إدخال من أرشيف xar.
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.