Class ArchiveEntry
İsim alanı : Aspose.Zip Toplama: Aspose.Zip.dll (25.5.0)
Arşiv içindeki tek dosyayı temsil eder.
public abstract class ArchiveEntry : IArchiveFileEntry
Inheritance
Derived
ArchiveEntryEncrypted , ArchiveEntryPlain
Implements
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.ArchiveEntry örneğini Aspose.Zip.ArchiveEntry şifrelenmiş olup olmadığını belirlemek için ekleyin.
Constructors
ArchiveEntry(Çerçeve, CompressionSettings, FuncUnt)
Aspose.Zip.ArchiveEntry sınıfının yeni bir örneğini başlatır.
protected ArchiveEntry(string name, CompressionSettings compressionSettings, Func<stream> sourceProvider, uint fileAttributes)
Parameters
name
string
Giriş Adı
compressionSettings
CompressionSettings
Kompresyon veya dekompresyon için ayarlar.
sourceProvider
Func
< için;
Stream
>
Giriş verileri ile geri akış yöntemi ya sıkıştırılmalıdır.
fileAttributes
uint
Dosya sisteminin özellikleri.
ArchiveEntry(string, CompressionSettings, Akış, uint, FileSystemInfo)
Aspose.Zip.ArchiveEntry sınıfının yeni bir örneğini başlatır.
protected ArchiveEntry(string name, CompressionSettings compressionSettings, Stream source, uint fileAttributes, FileSystemInfo fileInfo = null)
Parameters
name
string
Giriş Adı
compressionSettings
CompressionSettings
Kompresyon veya dekompresyon için ayarlar.
source
Stream
Giriş verileri ile akış ya sıkıştırılmalı ya da dekompres edilmelidir.
fileAttributes
uint
Dosya sisteminin özellikleri.
fileInfo
FileSystemInfo
Dosya veya dizin bilgileri giriş temelinde.
Properties
Comment
Arşiv içindeki giriş hakkında yorum alın.
public string Comment { get; protected set; }
Mülkiyet Değer
CompressedSize
Kompres dosyasının boyutunu alır.
public ulong CompressedSize { get; }
Mülkiyet Değer
CompressionSettings
Kompresyon veya dekompresyon için ayarlar alınır.
public CompressionSettings CompressionSettings { get; }
Mülkiyet Değer
DataSource
Giriş kaynağı, eğer giriş arşivine eklenmişse, çıkarılmamıştır.
public Stream DataSource { get; }
Mülkiyet Değer
Remarks
Bu kaynak bazı durumlarda ‘Archive.Save’ yöntemi içinde atanabilir.
FileAttributes
Host sisteminden dosya özelliklerini alır.
protected FileAttributes FileAttributes { get; }
Mülkiyet Değer
IsDirectory
Giriş bir dizin olup olmadığını gösteren bir değer alır.
public bool IsDirectory { get; }
Mülkiyet Değer
ModificationTime
En son değiştirilmiş tarih ve saat alınır veya ayarlanır.
public DateTime ModificationTime { get; set; }
Mülkiyet Değer
Name
Arşiv içindeki giriş isimini alır.
public string Name { get; protected set; }
Mülkiyet Değer
UncompressedSize
Orijinal dosyanın boyutunu alır.
public ulong UncompressedSize { get; }
Mülkiyet Değer
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
Dosya Bilgileri Kompozit Dosyası.
Examples
Zip arşivinden iki giriş çıkarın, her biri kendi şifre ile
using (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
using (Archive archive = new Archive(zipFile))
{
archive.Entries[0].Extract("first.bin", "first_pass");
archive.Entries[1].Extract("second.bin", "second_pass");
}
}
Exceptions
path’ is null.
Müşteri, gerekli izinleri almamaktadır.
path’ boş, yalnızca beyaz alanlar içerir veya geçersiz karakterler içerir.
path" dosyasına erişim reddedilir.
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.
path’daki dosya, satırın ortasında bir sütun (:) içerir.
Dosya bulunamadı.
Belirlenmiş yol geçersizdir, örneğin haritalmamış bir sürücü üzerinde olması.
Dosya zaten açıktır.
CRC veya MAC doğrulama giriş için başarısız oldu.
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 (FileStream zipFile = File.Open("archive.zip", FileMode.Open))
{
using (Archive archive = new Archive(zipFile))
{
archive.Entries[0].Extract(httpResponseStream, "p@s$");
}
}
Exceptions
CRC veya MAC doğrulama giriş için başarısız oldu.
Kaynak bozulmuş ya da okunamaz.
destination’ does not support writing.
Open(Sırt)
Ekstraksiyon için giriş açılır ve dekompres içeriği ile bir akış sağlar.
public Stream Open(string password = null)
Parameters
password
string
Şifreleme için seçmeli şifreleme.
Returns
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
<p>Read from the stream to get the original content of a file. See examples section.</p>
#### Exceptions
[InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)
The archive is in an incorrect state.
### <a id="Aspose_Zip_ArchiveEntry_CompressionProgressed"></a> CompressionProgressed
Raises when a portion of raw stream compressed.
```csharp
public event EventHandler<progresseventargs> CompressionProgressed
Etkinlik Türü
EventHandler < için; ProgressEventArgs >
Examples
archive.Entries[0].CompressionProgressed += (s, e) => { int percent = (int)((100 * (long)e.ProceededBytes) / entrySourceStream.Length); };
Remarks
Etkinlik göndericisi Aspose.Zip.ArchiveEntry örneğidir.
ExtractionProgressed
Üst akışın bir kısmı çıkarıldığında yükselir.
public event EventHandler<progresseventargs> ExtractionProgressed
Etkinlik Türü
EventHandler < için; ProgressEventArgs >
Examples
archive.Entries[0].ExtractionProgressed += (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); };
Remarks
Etkinlik göndericisi Aspose.Zip.ArchiveEntry örneğidir.