Class SevenZipArchiveEntry

Class SevenZipArchiveEntry

İsim alanı : Aspose.Zip.SevenZip Toplama: Aspose.Zip.dll (25.5.0)

7z arşivinde tek bir dosyayı temsil eder.

public abstract class SevenZipArchiveEntry : IArchiveFileEntry

Inheritance

object SevenZipArchiveEntry

Derived

SevenZipArchiveEntryEncrypted , SevenZipArchiveEntryPlain

Implements

IArchiveFileEntry

mirasçı üyeleri

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Remarks

Bir Aspose.Zip.SevenZip.SevenZipArchiveEntry örneğini Aspose.Zip.SevenZip.SevenZipArchiveEntry’ye kaydırınKripte olup olmadığını belirlemek için.

Properties

CompressedSize

Bir kompres dosyasının büyüklüğünü alır.

public ulong CompressedSize { get; }

Mülkiyet Değer

ulong

CompressionSettings

Kompresyon veya dekompresyon için ayarlar alınır.

public SevenZipCompressionSettings CompressionSettings { get; }

Mülkiyet Değer

SevenZipCompressionSettings

FileAttributes

Bir host sisteminden dosya özelliklerini alır.

protected FileAttributes FileAttributes { get; }

Mülkiyet Değer

FileAttributes

IsDirectory

Giriş bir dizin olup olmadığını gösteren bir değer alır.

public bool IsDirectory { get; }

Mülkiyet Değer

bool

ModificationTime

En son değiştirilmiş tarih ve zaman alınır.

public DateTime ModificationTime { get; }

Mülkiyet Değer

DateTime

Name

Arşiv içindeki giriş isimini alır.

public string Name { get; protected set; }

Mülkiyet Değer

string

Source

Giriş için veri kaynağı akışını alır.

protected Stream Source { get; }

Mülkiyet Değer

Stream

UncompressedSize

Orijinal bir dosya boyutunu alır.

public ulong UncompressedSize { get; }

Mülkiyet Değer

ulong

Methods

Extract(String ve String)

Dosya sistemine verilen yoldan giriş çıkarır.

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

Parameters

path string

Hedef dosyasına giden yol. eğer dosya zaten mevcutsa, aşırı yazılacaktır.

password string

Şifreleme için seçmeli şifreleme.

Returns

FileInfo

Bir kompozit dosyanın dosya bilgisi.

Examples

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

Exceptions

ArgumentNullException

path’ is null.

SecurityException

Müşteri, gerekli izinleri almamaktadır.

ArgumentException

path’ boş, yalnızca beyaz alanlar içerir veya geçersiz karakterler içerir.

UnauthorizedAccessException

path" dosyasına erişim reddedilir.

PathTooLongException

Belirlenen path’, dosya adı, ya da her ikisi de sistem tarafından tanımlanan maksimum uzunluğu aşmaktadır. Örneğin, Windows tabanlı platformlarda, yollar 248 karakterden az olmalıdır ve dosya isimleri 260 karakterden az olmalıdır.

NotSupportedException

path’daki dosya, satırın ortasında bir sütun (:) içerir.

InvalidDataException

Arşiv bozulmuştur.

Extract(akış, string)

Gönderilen akışın içeriğini çıkarır.

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

Parameters

destination Stream

Destination stream. yazılabilir olması gerekir.

password string

Şifreleme için seçmeli şifreleme.

Examples

Bir zip arşivi girişini şifre ile çıkarın.

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

Exceptions

ArgumentException

destination’ does not support writing.

InvalidOperationException

Arşiv çıkarmak için açılmıyor. - veya - Bu giriş bir dizin.

InvalidDataException

Giriş içindeki yanlış bilgiler.

FinalizeCompressedData(akış , byte[])

Kompres edilen verileri takip eden herhangi bir başlık çıkış akışı yazın.

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

Parameters

outputStream Stream

Giriş için çıkış akışı.

encoderProperties byte […]

Kompresörün özellikleri

Returns

int

Belirli veri blokları girdikten sonra eklenen “teknik” bayt sayısı.

GetDestinationStream(Stream)

Giriş için destinasyon akışı, dekore edilebilir.

protected abstract Stream GetDestinationStream(Stream outputStream)

Parameters

outputStream Stream

Giriş için çıkış akışı.

Returns

Stream

Giriş kompresyonu için hedef akışı.

Open(Sırt)

Ekstraksiyon için giriş açılır ve giriş içeriği ile bir akış sağlar.

public Stream Open(string password = null)

Parameters

password string

Şifreleme için seçmeli şifreleme.

Returns

Stream

Giriş içeriğini temsil eden akım.

Examples

Kullanımı :Stream decompressed = entry.Open();

.NET 4.0 ve üstü - Stream.CopyTo yöntemi kullanın:decompressed.CopyTo(httpResponse.OutputStream)

.NET 3.5 ve öncesi - byteyi manuel olarak kopyalayın:

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

Etkinlik Türü

EventHandler &lt için; ProgressEventArgs >

Examples

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

Remarks

Etkinlik göndericisi Aspose.Zip.SevenZip.SevenZipArchiveEntry örneğidir.

LZMA2 girişleri için çok yönlü modda davet etmez.

 Türkçe