Class SevenZipArchiveEntry
اسم الفضاء : Aspose.Zip.SevenZip تجميع: Aspose.Zip.dll (25.5.0)
يمثل ملفًا واحدًا داخل أرشيف 7Z.
public abstract class SevenZipArchiveEntry : IArchiveFileEntry
Inheritance
Derived
SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain
Implements
الأعضاء الموروثين
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; }
قيمة الممتلكات
CompressionSettings
يحصل على إعدادات للضغط أو الانكماش.
public SevenZipCompressionSettings CompressionSettings { get; }
قيمة الممتلكات
FileAttributes
يحصل على خصائص الملفات من نظام المضيف.
protected FileAttributes FileAttributes { get; }
قيمة الممتلكات
IsDirectory
يحصل على قيمة تشير إلى ما إذا كان الإدخال يمثل دليل.
public bool IsDirectory { get; }
قيمة الممتلكات
ModificationTime
يتم تعديل الموعد والوقت الأخير.
public DateTime ModificationTime { get; }
قيمة الممتلكات
Name
يحصل على اسم الإدخال داخل الأرشيف.
public string Name { get; protected set; }
قيمة الممتلكات
Source
يحصل على تدفق مصدر البيانات للدخول.
protected Stream Source { get; }
قيمة الممتلكات
UncompressedSize
يحصل على حجم الملف الأصلي.
public ulong UncompressedSize { get; }
قيمة الممتلكات
Methods
Extract(ستيفن، ستيفن)
استخراج الدخول إلى نظام الملفات عن طريق المسار المقدم.
public FileInfo Extract(string path, string password = null)
Parameters
path
string
المسار إلى الملف المستهدف.إذا كان الملف موجودًا بالفعل ، فسيتم إعادة كتابته.
password
string
كلمة المرور الاختيارية للتشفير.
Returns
ملف المعلومات من ملف مكون.
Examples
using (var archive = new SevenZipArchive("archive.7z"))
{
archive.Entries[0].Extract("data.bin");
}
Exceptions
path’ is null.
لا يحصل المتصل على إذن الوصول المطلوب.
الطريق " فارغ ، يحتوي على مساحات بيضاء فقط ، أو يحتوي على أحرف غير صحيحة.
يتم رفض الوصول إلى ملف path".
على سبيل المثال ، على المنصات المستندة إلى Windows ، يجب أن تكون المسارات أقل من 248 حرفًا ، ويجب أن يكون اسم الملف أقل من 260 حرفًا.
ملف في path’ يحتوي على عمود (:) في وسط السلسلة.
وقد تم تدمير الأرشيف
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
destination’ does not support writing.
لا يتم فتح الأرشيف للاستخراج. - أو - هذا الإدخال هو دليل.
بيانات غير صحيحة داخل الدخول.
FinalizeCompressedData(بيوت , byte[])
اكتب إلى تدفق الناتج أي عناوين تتبع البيانات المضغوطة.
protected abstract int FinalizeCompressedData(Stream outputStream, byte[] encoderProperties)
Parameters
outputStream
Stream
تدفق الخروج من الدخول.
encoderProperties
byte
[ ]
خصائص المضغوط
Returns
عدد بايتات “التقنية” التي تم إضافتها بعد إدخال كتلة بيانات كبيرة.
GetDestinationStream(Stream)
تدفق الوجهة للدخول ، يمكن تزيينها.
protected abstract Stream GetDestinationStream(Stream outputStream)
Parameters
outputStream
Stream
تدفق الخروج من الدخول.
Returns
تدفق الوجهة للضغط الدخول.
Open(الستار)
يفتح الإدخال للاستخراج ويقدم تدفقًا مع محتوى الإدخال.
public Stream Open(string password = null)
Parameters
password
string
كلمة المرور الاختيارية للتشفير.
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.
#### 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 <؛ ProgressEventArgs >
Examples
archive.Entries[0].CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
إرسال الحدث هو مثال Aspose.Zip.SevenZip.SevenZipArchiveEntry.
لا يستدعي في وضع متعددة الأبعاد للإدخالات LZMA2.