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مشفوعة لتحديد ما إذا كانت الإدخال مشفرة أم لا.
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
كلمة المرور الاختيارية للتشفير.
Returns
معلومات الملف من الملف المكون.
Examples
استخراج اثنين من الإدخالات من الأرشيف النادر.
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".
على سبيل المثال ، على المنصات المستندة إلى Windows ، يجب أن تكون المسارات أقل من 248 حرفًا ، ويجب أن يكون اسم الملف أقل من 260 حرفًا.
ملف في path’ يحتوي على عمود (:) في وسط السلسلة.
لم يتم العثور على الملف.
المسار المحدد غير صالح ، على سبيل المثال ، على محرك أقراص غير مسجلة.
الملف مفتوح بالفعل.
يتم تدمير البيانات. -أو- فشل التحقق من CRC أو MAC للدخول.
Extract(الشبكة، string)
إخراج الدخول إلى التدفق المقدم.
public void Extract(Stream destination, string password = null)
Parameters
destination
Stream
كلمات مفتاحية يجب أن تكون مكتوبة
password
string
كلمة المرور الاختيارية للتشفير.
Examples
استخراج إدخال من الأرشيف الغريب مع كلمة مرور.
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.
يتم تدمير البيانات. -أو- فشل التحقق من CRC أو MAC للدخول.
Open(الستار)
يفتح إدخال الاستخراج ويقدم تدفقًا مع محتوى الإدخال المضغوط.
public Stream Open(string password = null)
Parameters
password
string
يمكن أيضًا إعدادها داخل 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.