-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add zip64 support for ZipArchive extraction
- Loading branch information
Mark Rydstrom
committed
Jan 24, 2017
1 parent
8e51d9d
commit 6be6ef0
Showing
10 changed files
with
177 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/SharpCompress/Common/Zip/Headers/Zip64DirectoryEndHeader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace SharpCompress.Common.Zip.Headers | ||
{ | ||
internal class Zip64DirectoryEndHeader : ZipHeader | ||
{ | ||
public Zip64DirectoryEndHeader() | ||
: base(ZipHeaderType.Zip64DirectoryEnd) | ||
{ | ||
} | ||
|
||
internal override void Read(BinaryReader reader) | ||
{ | ||
SizeOfDirectoryEndRecord = (long)reader.ReadUInt64(); | ||
VersionMadeBy = reader.ReadUInt16(); | ||
VersionNeededToExtract = reader.ReadUInt16(); | ||
VolumeNumber = reader.ReadUInt32(); | ||
FirstVolumeWithDirectory = reader.ReadUInt32(); | ||
TotalNumberOfEntriesInDisk = (long)reader.ReadUInt64(); | ||
TotalNumberOfEntries = (long)reader.ReadUInt64(); | ||
DirectorySize = (long)reader.ReadUInt64(); | ||
DirectoryStartOffsetRelativeToDisk = (long)reader.ReadUInt64(); | ||
DataSector = reader.ReadBytes((int)(SizeOfDirectoryEndRecord - SizeOfFixedHeaderDataExceptSignatureAndSizeFields)); | ||
} | ||
|
||
const int SizeOfFixedHeaderDataExceptSignatureAndSizeFields = 44; | ||
|
||
internal override void Write(BinaryWriter writer) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public long SizeOfDirectoryEndRecord { get; private set; } | ||
|
||
public ushort VersionMadeBy { get; private set; } | ||
|
||
public ushort VersionNeededToExtract { get; private set; } | ||
|
||
public uint VolumeNumber { get; private set; } | ||
|
||
public uint FirstVolumeWithDirectory { get; private set; } | ||
|
||
public long TotalNumberOfEntriesInDisk { get; private set; } | ||
|
||
public long TotalNumberOfEntries { get; private set; } | ||
|
||
public long DirectorySize { get; private set; } | ||
|
||
public long DirectoryStartOffsetRelativeToDisk { get; private set; } | ||
|
||
public byte[] DataSector { get; private set; } | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/SharpCompress/Common/Zip/Headers/Zip64DirectoryEndLocatorHeader.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.IO; | ||
|
||
namespace SharpCompress.Common.Zip.Headers | ||
{ | ||
internal class Zip64DirectoryEndLocatorHeader : ZipHeader | ||
{ | ||
public Zip64DirectoryEndLocatorHeader() | ||
: base(ZipHeaderType.Zip64DirectoryEndLocator) | ||
{ | ||
} | ||
|
||
internal override void Read(BinaryReader reader) | ||
{ | ||
FirstVolumeWithDirectory = reader.ReadUInt32(); | ||
RelativeOffsetOfTheEndOfDirectoryRecord = (long)reader.ReadUInt64(); | ||
TotalNumberOfVolumes = reader.ReadUInt32(); | ||
} | ||
|
||
internal override void Write(BinaryWriter writer) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public uint FirstVolumeWithDirectory { get; private set; } | ||
|
||
public long RelativeOffsetOfTheEndOfDirectoryRecord { get; private set; } | ||
|
||
public uint TotalNumberOfVolumes { get; private set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.