Class SevenZipArchiveEntry

Class SevenZipArchiveEntry

اسم الفضاء : Aspose.Zip.SevenZip تجميع: Aspose.Zip.dll (25.5.0)

يمثل ملفًا واحدًا داخل أرشيف 7Z.

public abstract class SevenZipArchiveEntry : IArchiveFileEntry

Inheritance

object SevenZipArchiveEntry

Derived

SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain

Implements

IArchiveFileEntry

الأعضاء الموروثين

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مخفضة لتحديد ما إذا كانت الإدخال مشفرة أم لا.

Properties

CompressedSize

يحصل على حجم ملف مضغوط.

public ulong CompressedSize { get; }

قيمة الممتلكات

ulong

CompressionSettings

يحصل على إعدادات للضغط أو الانكماش.

public SevenZipCompressionSettings CompressionSettings { get; }

قيمة الممتلكات

SevenZipCompressionSettings

FileAttributes

يحصل على خصائص الملفات من نظام المضيف.

protected FileAttributes FileAttributes { get; }

قيمة الممتلكات

FileAttributes

IsDirectory

يحصل على قيمة تشير إلى ما إذا كان الإدخال يمثل دليل.

public bool IsDirectory { get; }

قيمة الممتلكات

bool

ModificationTime

يتم تعديل الموعد والوقت الأخير.

public DateTime ModificationTime { get; }

قيمة الممتلكات

DateTime

Name

يحصل على اسم الإدخال داخل الأرشيف.

public string Name { get; protected set; }

قيمة الممتلكات

string

Source

يحصل على تدفق مصدر البيانات للدخول.

protected Stream Source { get; }

قيمة الممتلكات

Stream

UncompressedSize

يحصل على حجم الملف الأصلي.

public ulong UncompressedSize { get; }

قيمة الممتلكات

ulong

Methods

Extract(ستيفن، ستيفن)

استخراج الدخول إلى نظام الملفات عن طريق المسار المقدم.

public FileInfo Extract(string path, string password = null)

Parameters

path string

المسار إلى الملف المستهدف.إذا كان الملف موجودًا بالفعل ، فسيتم إعادة كتابته.

password string

كلمة المرور الاختيارية للتشفير.

Returns

FileInfo

ملف المعلومات من ملف مكون.

Examples

using (var archive = new SevenZipArchive("archive.7z"))
{
    archive.Entries[0].Extract("data.bin");
}

Exceptions

ArgumentNullException

path’ is null.

SecurityException

لا يحصل المتصل على إذن الوصول المطلوب.

ArgumentException

الطريق " فارغ ، يحتوي على مساحات بيضاء فقط ، أو يحتوي على أحرف غير صحيحة.

UnauthorizedAccessException

يتم رفض الوصول إلى ملف path".

PathTooLongException

على سبيل المثال ، على المنصات المستندة إلى Windows ، يجب أن تكون المسارات أقل من 248 حرفًا ، ويجب أن يكون اسم الملف أقل من 260 حرفًا.

NotSupportedException

ملف في path’ يحتوي على عمود (:) في وسط السلسلة.

InvalidDataException

وقد تم تدمير الأرشيف

Extract(الشبكة، string)

إخراج الدخول إلى التدفق المقدم.

public void Extract(Stream destination, string password = null)

Parameters

destination Stream

كلمات مفتاحية يجب أن تكون مكتوبة

password string

كلمة المرور الاختيارية للتشفير.

Examples

استخراج إدخال من أرشيف zip مع كلمة المرور.

using (var archive = new SevenZipArchive("archive.7z"))
{
    archive.Entries[0].Extract(httpResponseStream);
}

Exceptions

ArgumentException

destination’ does not support writing.

InvalidOperationException

لا يتم فتح الأرشيف للاستخراج. - أو - هذا الإدخال هو دليل.

InvalidDataException

بيانات غير صحيحة داخل الدخول.

FinalizeCompressedData(بيوت , byte[])

اكتب إلى تدفق الناتج أي عناوين تتبع البيانات المضغوطة.

protected abstract int FinalizeCompressedData(Stream outputStream, byte[] encoderProperties)

Parameters

outputStream Stream

تدفق الخروج من الدخول.

encoderProperties byte [ ]

خصائص المضغوط

Returns

int

عدد بايتات “التقنية” التي تم إضافتها بعد إدخال كتلة بيانات كبيرة.

GetDestinationStream(Stream)

تدفق الوجهة للدخول ، يمكن تزيينها.

protected abstract Stream GetDestinationStream(Stream outputStream)

Parameters

outputStream Stream

تدفق الخروج من الدخول.

Returns

Stream

تدفق الوجهة للضغط الدخول.

Open(الستار)

يفتح الإدخال للاستخراج ويقدم تدفقًا مع محتوى الإدخال.

public Stream Open(string password = null)

Parameters

password string

كلمة المرور الاختيارية للتشفير.

Returns

Stream

التدفق الذي يمثل المحتوى من الدخول.

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 &lt؛ ProgressEventArgs >

Examples

archive.Entries[0].CompressionProgressed += (s, e) =&gt; { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };

Remarks

إرسال الحدث هو مثال Aspose.Zip.SevenZip.SevenZipArchiveEntry.

لا يستدعي في وضع متعددة الأبعاد للإدخالات LZMA2.

 عربي