mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-24 16:05:27 +00:00
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.IO;
|
|
using SharpCompress.Common;
|
|
using SharpCompress.Common.SevenZip;
|
|
|
|
namespace SharpCompress.Archive.SevenZip
|
|
{
|
|
public class SevenZipArchiveEntry : SevenZipEntry, IArchiveEntry
|
|
{
|
|
private SevenZipArchive archive;
|
|
|
|
internal SevenZipArchiveEntry(SevenZipArchive archive, SevenZipFilePart part)
|
|
: base(part)
|
|
{
|
|
this.archive = archive;
|
|
}
|
|
|
|
public Stream OpenEntryStream()
|
|
{
|
|
return FilePart.GetCompressedStream();
|
|
}
|
|
|
|
public void WriteTo(Stream stream)
|
|
{
|
|
if (IsEncrypted)
|
|
{
|
|
throw new PasswordProtectedException("Entry is password protected and cannot be extracted.");
|
|
}
|
|
this.Extract(archive, stream);
|
|
}
|
|
|
|
public bool IsComplete
|
|
{
|
|
get { return true; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// This is a 7Zip Anti item
|
|
/// </summary>
|
|
public bool IsAnti
|
|
{
|
|
get { return FilePart.Header.IsAnti; }
|
|
}
|
|
}
|
|
} |