mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Compare commits
297 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f8bd6d7e3 | ||
|
|
f893c1272c | ||
|
|
e701f5277e | ||
|
|
f85fd1f6a4 | ||
|
|
8f7ea420b3 | ||
|
|
d8c8dabb52 | ||
|
|
9092ecf331 | ||
|
|
2fd9fe96ad | ||
|
|
02f68b793c | ||
|
|
57b9133a0f | ||
|
|
815f5e09e8 | ||
|
|
5bdf01ee59 | ||
|
|
bd9417e74c | ||
|
|
694e869162 | ||
|
|
45845f8963 | ||
|
|
a8b6def76a | ||
|
|
a4ebd5fb3d | ||
|
|
3da3b212fa | ||
|
|
c2528cf93e | ||
|
|
550fecd4d3 | ||
|
|
50b01428b4 | ||
|
|
bb59f28b22 | ||
|
|
7064cda6de | ||
|
|
525c1873e8 | ||
|
|
3d91b4eb5e | ||
|
|
f20c03180e | ||
|
|
08fee76b4e | ||
|
|
0f511c4b2a | ||
|
|
42d9dfd117 | ||
|
|
3983db08ff | ||
|
|
72114bceea | ||
|
|
c303f96682 | ||
|
|
0e785968c4 | ||
|
|
15110e18e2 | ||
|
|
5465af041b | ||
|
|
310d56fc16 | ||
|
|
231258ef69 | ||
|
|
16b7e3ffc8 | ||
|
|
513e59f830 | ||
|
|
b10a1cf2bd | ||
|
|
1656edaa29 | ||
|
|
cff49aacba | ||
|
|
19c32aff6c | ||
|
|
db3ec8337f | ||
|
|
e7bfc40461 | ||
|
|
3d3ca254ba | ||
|
|
b45bc859a4 | ||
|
|
912d7a8775 | ||
|
|
16885da1b5 | ||
|
|
26714052eb | ||
|
|
3df763a783 | ||
|
|
925842bc4b | ||
|
|
cead62704e | ||
|
|
3f24a744c0 | ||
|
|
cce97548a2 | ||
|
|
9270d7cabf | ||
|
|
264aa6d366 | ||
|
|
69fc74e376 | ||
|
|
a361d41e68 | ||
|
|
38766dac99 | ||
|
|
c30bc65281 | ||
|
|
296ebd942a | ||
|
|
afa19f7ad8 | ||
|
|
a193b2d3b1 | ||
|
|
be4a65e572 | ||
|
|
6832918e71 | ||
|
|
fd9a3ffbcc | ||
|
|
41added690 | ||
|
|
18641d4f9b | ||
|
|
4d0c5099d4 | ||
|
|
9d9d491245 | ||
|
|
7b81d18071 | ||
|
|
7d0acbc988 | ||
|
|
313c044c41 | ||
|
|
f6f8adf97e | ||
|
|
bc97d325ca | ||
|
|
0f2d325f20 | ||
|
|
63d5503e12 | ||
|
|
e53f2cac4a | ||
|
|
3b73464233 | ||
|
|
575f10f766 | ||
|
|
8d3fc3533b | ||
|
|
60370b8539 | ||
|
|
f6db114865 | ||
|
|
1c6c344b6b | ||
|
|
d0302898e0 | ||
|
|
057ac9b001 | ||
|
|
8be931bbcb | ||
|
|
3197ef289c | ||
|
|
631578c175 | ||
|
|
f1809163c7 | ||
|
|
60e1fe86f2 | ||
|
|
59d7de5bfc | ||
|
|
6e95c1d84a | ||
|
|
ee64670755 | ||
|
|
3f7d0f5b68 | ||
|
|
e3514c5c4b | ||
|
|
cc3a9cff88 | ||
|
|
15e821aa39 | ||
|
|
8dd1dbab5f | ||
|
|
65ce91ddf6 | ||
|
|
bf55595d6f | ||
|
|
2aa123ccd7 | ||
|
|
0990b06cc9 | ||
|
|
e05f9843ba | ||
|
|
683d2714d0 | ||
|
|
b8ef1ecafc | ||
|
|
467fc2d03d | ||
|
|
58b4fe4f28 | ||
|
|
97d5e0aac4 | ||
|
|
356c977cff | ||
|
|
99d6062376 | ||
|
|
f8538403e4 | ||
|
|
ba12019bc7 | ||
|
|
726b9c80f6 | ||
|
|
2894711c51 | ||
|
|
85280f6f4f | ||
|
|
d7f4c0ee32 | ||
|
|
1263c0d976 | ||
|
|
cd3cbd2b32 | ||
|
|
b3a4fed8be | ||
|
|
d0b4af6666 | ||
|
|
81ab5c189d | ||
|
|
6ef3be4b5c | ||
|
|
9f90a1d651 | ||
|
|
ce9a3fd1ef | ||
|
|
7c6f05058e | ||
|
|
a8c3a7439e | ||
|
|
839b3ab0cf | ||
|
|
44d54db80e | ||
|
|
a67d7bc429 | ||
|
|
079a818c6c | ||
|
|
6be6ef0b5c | ||
|
|
8e51d9d646 | ||
|
|
ea206f4f02 | ||
|
|
f175a2a252 | ||
|
|
3f7e559b86 | ||
|
|
2959b4d701 | ||
|
|
031286c5eb | ||
|
|
e181fa8c4a | ||
|
|
7b035bec5d | ||
|
|
f39d2bf53a | ||
|
|
7c8e407182 | ||
|
|
a09136d46b | ||
|
|
5fe1363ee1 | ||
|
|
b41823fc10 | ||
|
|
0a64fe28b0 | ||
|
|
e320ccfa9a | ||
|
|
9628ff9456 | ||
|
|
d540f78cfc | ||
|
|
66420cd299 | ||
|
|
dd0594471f | ||
|
|
844ba228ee | ||
|
|
7efc701b32 | ||
|
|
d7e29f7c4d | ||
|
|
f26ba91386 | ||
|
|
c73ac2039c | ||
|
|
671f9cd0cb | ||
|
|
131b5b9714 | ||
|
|
74af0889b9 | ||
|
|
e5ee399045 | ||
| deeb7a0f64 | |||
|
|
5af3bab1dc | ||
|
|
28be84d315 | ||
|
|
a0528c737d | ||
|
|
b506e488e8 | ||
|
|
58eb0e08d6 | ||
|
|
562701894f | ||
|
|
54a562273b | ||
|
|
3f8c9c4cb0 | ||
|
|
3e7d28b043 | ||
|
|
40b10d4a26 | ||
|
|
f367630a2a | ||
|
|
b9e4f00862 | ||
|
|
d6e74d6163 | ||
|
|
4a4522b842 | ||
|
|
710ba4423d | ||
|
|
2a5494a804 | ||
|
|
568909800c | ||
|
|
7513a608b1 | ||
|
|
911e9878bd | ||
|
|
899d7d6e61 | ||
|
|
260c0ee776 | ||
|
|
d71520808d | ||
|
|
177fc2a12c | ||
|
|
5dafcb02d4 | ||
|
|
c4fde80c5e | ||
|
|
06e3486ec4 | ||
|
|
bd7c783aaf | ||
|
|
d732e3cfa4 | ||
|
|
c24cdc66ed | ||
|
|
efa6f7a82e | ||
| ddbbc3b847 | |||
|
|
7037161c07 | ||
|
|
b0b62fcf91 | ||
|
|
bd8ba7b854 | ||
|
|
3a52c68270 | ||
|
|
89fd778bd8 | ||
|
|
6e3e8343a8 | ||
|
|
9224237a99 | ||
|
|
8d16925662 | ||
|
|
ef0bf2758e | ||
|
|
351a7552b9 | ||
|
|
9dcc127454 | ||
|
|
81ff334aae | ||
|
|
e76ed60483 | ||
|
|
04d04576bf | ||
|
|
dbd713756f | ||
|
|
6d821dffa6 | ||
|
|
40e559e608 | ||
|
|
b3fe26fc56 | ||
|
|
bb930da2f1 | ||
|
|
732e352261 | ||
|
|
8f2ada3f20 | ||
|
|
762381fac6 | ||
|
|
c440fdf88d | ||
|
|
7f3f6bb135 | ||
|
|
cb7853174d | ||
|
|
ef8575a107 | ||
|
|
6f3f82e0ad | ||
|
|
7b1609abe2 | ||
|
|
691c44a3b5 | ||
|
|
98c629c789 | ||
|
|
8367bff9fe | ||
|
|
ff22cd774e | ||
|
|
ee5e3fbc1d | ||
|
|
d13b2ad073 | ||
|
|
e9a7efc371 | ||
|
|
9b8ddda191 | ||
|
|
1fc14e1075 | ||
|
|
b3a5204e74 | ||
|
|
0fab1ff976 | ||
|
|
a05b692fc3 | ||
|
|
ed7f140364 | ||
|
|
a4b594121e | ||
|
|
fe8da55c95 | ||
|
|
42c4eab4be | ||
|
|
2e8844c896 | ||
|
|
aed7ff003d | ||
|
|
681b28f654 | ||
|
|
0de64b1551 | ||
|
|
526df2404e | ||
|
|
f20274aac7 | ||
|
|
08b899fdac | ||
|
|
7b91b6e7c8 | ||
|
|
1661b7ec36 | ||
|
|
e5ab9dc883 | ||
|
|
25d22e33a7 | ||
|
|
8ceac9000c | ||
|
|
ecceec8e1a | ||
|
|
d5c88ebab3 | ||
|
|
0a2adbc205 | ||
|
|
3be7f9da37 | ||
|
|
3f2ca67416 | ||
|
|
21087323af | ||
|
|
505838a32a | ||
|
|
fd3f9eb382 | ||
|
|
05f92018c3 | ||
|
|
b8fc4a2415 | ||
|
|
ccd2fc6568 | ||
|
|
a30872809d | ||
|
|
7abf2ed58b | ||
|
|
4822f571c3 | ||
|
|
b0fdac3e6f | ||
|
|
df62c1d3b2 | ||
|
|
56912ade7a | ||
|
|
43698b41a7 | ||
|
|
fd2beeab48 | ||
|
|
5647a424e7 | ||
|
|
a0a418e90b | ||
|
|
75e09b24c0 | ||
|
|
0b06023b82 | ||
|
|
49707498a5 | ||
|
|
a4c2d27985 | ||
|
|
9fac34fb21 | ||
|
|
d4b22936af | ||
|
|
f0d0143be0 | ||
|
|
7d1593e887 | ||
|
|
2588444948 | ||
|
|
69abb8446f | ||
|
|
bec2662d23 | ||
|
|
dd35052de9 | ||
|
|
2a630e04b2 | ||
|
|
231b78e096 | ||
|
|
ce6e1d26f4 | ||
|
|
69a25cd142 | ||
|
|
cc2ad7d8d5 | ||
|
|
6fee1f6dc3 | ||
|
|
6e0f4ecbc9 | ||
|
|
e5d10e3dba | ||
|
|
0ba87b6c62 | ||
|
|
da47306f04 | ||
|
|
1930126a59 | ||
|
|
baf9f391f1 | ||
|
|
979703dd1f | ||
|
|
ab9e8063dc | ||
|
|
68c09d7221 |
11
.circleci/config.yml
Normal file
11
.circleci/config.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: adamhathcock/cake-build:latest
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Build
|
||||
command: ./build.sh
|
||||
|
||||
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# need original files to be windows
|
||||
*.txt text eol=crlf
|
||||
28
.gitignore
vendored
28
.gitignore
vendored
@@ -1,11 +1,17 @@
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
_ReSharper.SharpCompress/
|
||||
bin/
|
||||
*.suo
|
||||
*.user
|
||||
TestArchives/Scratch/
|
||||
TestArchives/Scratch2/
|
||||
TestResults/
|
||||
*.nupkg
|
||||
packages/*/
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
_ReSharper.SharpCompress/
|
||||
bin/
|
||||
*.suo
|
||||
*.user
|
||||
TestArchives/Scratch/
|
||||
TestArchives/Scratch2/
|
||||
TestResults/
|
||||
*.nupkg
|
||||
packages/*/
|
||||
project.lock.json
|
||||
tests/TestArchives/Scratch
|
||||
.vs
|
||||
tools
|
||||
.vscode
|
||||
.idea/
|
||||
|
||||
60
FORMATS.md
Normal file
60
FORMATS.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Formats
|
||||
|
||||
## Accessing Archives
|
||||
|
||||
- Archive classes allow random access to a seekable stream.
|
||||
- Reader classes allow forward-only reading on a stream.
|
||||
- Writer classes allow forward-only Writing on a stream.
|
||||
|
||||
## Supported Format Table
|
||||
|
||||
| Archive Format | Compression Format(s) | Compress/Decompress | Archive API | Reader API | Writer API |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| Rar | Rar | Decompress (1) | RarArchive | RarReader | N/A |
|
||||
| Zip (2) | None, DEFLATE, BZip2, LZMA/LZMA2, PPMd | Both | ZipArchive | ZipReader | ZipWriter |
|
||||
| Tar | None | Both | TarArchive | TarReader | TarWriter (3) |
|
||||
| Tar.GZip | DEFLATE | Both | TarArchive | TarReader | TarWriter (3) |
|
||||
| Tar.BZip2 | BZip2 | Both | TarArchive | TarReader | TarWriter (3) |
|
||||
| Tar.LZip | LZMA | Both | TarArchive | TarReader | TarWriter (3) |
|
||||
| Tar.XZ | LZMA2 | Decompress | TarArchive | TarReader | TarWriter (3) |
|
||||
| GZip (single file) | DEFLATE | Both | GZipArchive | GZipReader | GZipWriter |
|
||||
| 7Zip (4) | LZMA, LZMA2, BZip2, PPMd, BCJ, BCJ2, Deflate | Decompress | SevenZipArchive | N/A | N/A |
|
||||
| LZip (single file) (5) | LZip (LZMA) | Both | LZipArchive | LZipReader | LZipWriter |
|
||||
|
||||
1. SOLID Rars are only supported in the RarReader API.
|
||||
2. Zip format supports pkware and WinzipAES encryption. However, encrypted LZMA is not supported. Zip64 reading/writing is supported but only with seekable streams as the Zip spec doesn't support Zip64 data in post data descriptors.
|
||||
3. The Tar format requires a file size in the header. If no size is specified to the TarWriter and the stream is not seekable, then an exception will be thrown.
|
||||
4. The 7Zip format doesn't allow for reading as a forward-only stream so 7Zip is only supported through the Archive API
|
||||
5. LZip has no support for extra data like the file name or timestamp. There is a default filename used when looking at the entry Key on the archive.
|
||||
|
||||
## Compression Streams
|
||||
|
||||
For those who want to directly compress/decompress bits. The single file formats are represented here as well. However, BZip2, LZip and XZ have no metadata (GZip has a little) so using them without something like a Tar file makes little sense.
|
||||
|
||||
| Compressor | Compress/Decompress |
|
||||
| --- | --- |
|
||||
| BZip2Stream | Both |
|
||||
| GZipStream | Both |
|
||||
| DeflateStream | Both |
|
||||
| LZMAStream | Both |
|
||||
| PPMdStream | Both |
|
||||
| ADCStream | Decompress |
|
||||
| LZipStream | Both |
|
||||
| XZStream | Decompress |
|
||||
|
||||
## Archive Formats vs Compression
|
||||
|
||||
Sometimes the terminology gets mixed.
|
||||
|
||||
### Compression
|
||||
|
||||
DEFLATE, LZMA are pure compression algorithms
|
||||
|
||||
### Formats
|
||||
|
||||
Formats like Zip, 7Zip, Rar are archive formats only. They use other compression methods (e.g. DEFLATE, LZMA, etc.) or propriatory (e.g RAR)
|
||||
|
||||
### Overlap
|
||||
|
||||
GZip, BZip2 and LZip are single file archival formats. The overlap in the API happens because Tar uses the single file formats as "compression" methods and the API tries to hide this a bit.
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>sharpcompress</id>
|
||||
<version>0.11.2</version>
|
||||
<title>SharpCompress - Pure C# Decompression/Compression</title>
|
||||
<authors>Adam Hathcock</authors>
|
||||
<owners>Adam Hathcock</owners>
|
||||
<licenseUrl>https://github.com/adamhathcock/sharpcompress/blob/master/LICENSE.txt</licenseUrl>
|
||||
<projectUrl>https://github.com/adamhathcock/sharpcompress</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>SharpCompress is a compression library for .NET/Mono/Silverlight/WP7/WindowsStore that can unrar, decompress 7zip, zip/unzip, tar/untar bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented.</description>
|
||||
<releaseNotes />
|
||||
<language>en-US</language>
|
||||
<tags>rar unrar zip unzip bzip2 gzip tar 7zip</tags>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\bin\Full\SharpCompress.dll" target="lib\net40\SharpCompress.dll" />
|
||||
<file src="..\bin\WindowsStore\SharpCompress.dll" target="lib\netcore45\SharpCompress.dll" />
|
||||
<file src="..\bin\Portable\SharpCompress.dll" target="lib\portable-net4+sl5+wp8+win8\SharpCompress.dll" />
|
||||
</files>
|
||||
</package>
|
||||
204
README.md
204
README.md
@@ -1,62 +1,188 @@
|
||||
SharpCompress
|
||||
=============
|
||||
# SharpCompress
|
||||
|
||||
Github mirror of http://sharpcompress.codeplex.com
|
||||
|
||||
SharpCompress is a compression library for .NET/Mono/Silverlight/WP7 that can unrar, un7zip, unzip, untar unbzip2 and ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip are implemented.
|
||||
SharpCompress is a compression library in pure C# for .NET 3.5, 4.5, .NET Standard 1.0, 1.3 that can unrar, un7zip, unzip, untar unbzip2 and ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip are implemented.
|
||||
|
||||
The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream).
|
||||
|
||||
A Simple Request
|
||||
AppVeyor Build -
|
||||
[](https://ci.appveyor.com/project/adamhathcock/sharpcompress/branch/master)
|
||||
|
||||
Circle CI Build -
|
||||
[](https://circleci.com/gh/adamhathcock/sharpcompress)
|
||||
|
||||
## Need Help?
|
||||
Post Issues on Github!
|
||||
|
||||
Check the [Supported Formats](FORMATS.md) and [Basic Usage.](USAGE.md)
|
||||
|
||||
## Recommended Formats
|
||||
|
||||
In general, I recommend GZip (Deflate)/BZip2 (BZip)/LZip (LZMA) as the simplicity of the formats lend to better long term archival as well as the streamability. Tar is often used in conjunction for multiple files in a single archive (e.g. `.tar.gz`)
|
||||
|
||||
Zip is okay, but it's a very hap-hazard format and the variation in headers and implementations makes it hard to get correct. Uses Deflate by default but supports a lot of compression methods.
|
||||
|
||||
RAR is not recommended as it's a propriatory format and the compression is closed source. Use Tar/LZip for LZMA
|
||||
|
||||
7Zip and XZ both are overly complicated. 7Zip does not support streamable formats. XZ has known holes explained here: (http://www.nongnu.org/lzip/xz_inadequate.html) Use Tar/LZip for LZMA compression instead.
|
||||
|
||||
## A Simple Request
|
||||
|
||||
Hi everyone. I hope you're using SharpCompress and finding it useful. Please give me feedback on what you'd like to see changed especially as far as usability goes. New feature suggestions are always welcome as well. I would also like to know what projects SharpCompress is being used in. I like seeing how it is used to give me ideas for future versions. Thanks!
|
||||
|
||||
Want to contribute?
|
||||
Please do not email me directly to ask for help. If you think there is a real issue, please report it here.
|
||||
|
||||
## Want to contribute?
|
||||
|
||||
I'm always looking for help or ideas. Please submit code or email with ideas. Unfortunately, just letting me know you'd like to help is not enough because I really have no overall plan of what needs to be done. I'll definitely accept code submissions and add you as a member of the project!
|
||||
|
||||
TODOs (always lots):
|
||||
## TODOs (always lots)
|
||||
|
||||
* RAR 5 support
|
||||
* 7Zip writing
|
||||
* Zip64
|
||||
* Zip64 (Need writing and extend Reading)
|
||||
* Multi-volume Zip support.
|
||||
|
||||
Version 0.11.1:
|
||||
==============
|
||||
- Added Cancel on IReader
|
||||
- Removed .NET 2.0 support and LinqBridge dependency
|
||||
## Version Log
|
||||
|
||||
Version 0.11:
|
||||
==============
|
||||
- Been over a year, contains mainly fixes from contributors!
|
||||
- Possible breaking change: ArchiveEncoding is UTF8 by default now.
|
||||
- TAR supports writing long names using longlink
|
||||
- RAR Protect Header added
|
||||
### Version 0.18
|
||||
|
||||
Version 0.10.3:
|
||||
==============
|
||||
- Finally fixed Disposal issue when creating a new archive with the Archive API
|
||||
* [Now on Github releases](https://github.com/adamhathcock/sharpcompress/releases/tag/0.18)
|
||||
|
||||
Version 0.10.2:
|
||||
==============
|
||||
- Fixed Rar Header reading for invalid extended time headers.
|
||||
- Windows Store assembly is now strong named
|
||||
- Known issues with Long Tar names being worked on
|
||||
- Updated to VS2013
|
||||
- Portable targets SL5 and Windows Phone 8 (up from SL4 and WP7)
|
||||
### Version 0.17.1
|
||||
|
||||
Version 0.10.1:
|
||||
==============
|
||||
- Fixed 7Zip extraction performance problem
|
||||
* Fix - [Bug Fix for .NET Core on Windows](https://github.com/adamhathcock/sharpcompress/pull/257)
|
||||
|
||||
Version 0.10:
|
||||
==============
|
||||
- Added support for RAR Decryption (thanks to https://github.com/hrasyid)
|
||||
- Embedded some BouncyCastle crypto classes to allow RAR Decryption and Winzip AES Decryption in Portable and Windows Store DLLs
|
||||
- Built in Release (I think)
|
||||
### Version 0.17.0
|
||||
|
||||
Some Help/Discussion:
|
||||
https://sharpcompress.codeplex.com/discussions
|
||||
* New - Full LZip support! Can read and write LZip files and Tars inside LZip files. [Make LZip a first class citizen. #241](https://github.com/adamhathcock/sharpcompress/issues/241)
|
||||
* New - XZ read support! Can read XZ files and Tars inside XZ files. [XZ in SharpCompress #91](https://github.com/adamhathcock/sharpcompress/issues/94)
|
||||
* Fix - [Regression - zip file writing on seekable streams always assumed stream start was 0. Introduced with Zip64 writing.](https://github.com/adamhathcock/sharpcompress/issues/244)
|
||||
* Fix - [Zip files with post-data descriptors can be properly skipped via decompression](https://github.com/adamhathcock/sharpcompress/issues/162)
|
||||
|
||||
### Version 0.16.2
|
||||
|
||||
* Fix [.NET 3.5 should support files and cryptography (was a regression from 0.16.0)](https://github.com/adamhathcock/sharpcompress/pull/251)
|
||||
* Fix [Zip per entry compression customization wrote the wrong method into the zip archive](https://github.com/adamhathcock/sharpcompress/pull/249)
|
||||
|
||||
### Version 0.16.1
|
||||
|
||||
* Fix [Preserve compression method when getting a compressed stream](https://github.com/adamhathcock/sharpcompress/pull/235)
|
||||
* Fix [RAR entry key normalization fix](https://github.com/adamhathcock/sharpcompress/issues/201)
|
||||
|
||||
### Version 0.16.0
|
||||
|
||||
* Breaking - [Progress Event Tracking rethink](https://github.com/adamhathcock/sharpcompress/pull/226)
|
||||
* Update to VS2017 - [VS2017](https://github.com/adamhathcock/sharpcompress/pull/231) - Framework targets have been changed.
|
||||
* New - [Add Zip64 writing](https://github.com/adamhathcock/sharpcompress/pull/211)
|
||||
* [Fix invalid/mismatching Zip version flags.](https://github.com/adamhathcock/sharpcompress/issues/164) - This allows nuget/System.IO.Packaging to read zip files generated by SharpCompress
|
||||
* [Fix 7Zip directory hiding](https://github.com/adamhathcock/sharpcompress/pull/215/files)
|
||||
* [Verify RAR CRC headers](https://github.com/adamhathcock/sharpcompress/pull/220)
|
||||
|
||||
### Version 0.15.2
|
||||
|
||||
* [Fix invalid headers](https://github.com/adamhathcock/sharpcompress/pull/210) - fixes an issue creating large-ish zip archives that was introduced with zip64 reading.
|
||||
|
||||
### Version 0.15.1
|
||||
|
||||
* [Zip64 extending information and ZipReader](https://github.com/adamhathcock/sharpcompress/pull/206)
|
||||
|
||||
### Version 0.15.0
|
||||
|
||||
* [Add zip64 support for ZipArchive extraction](https://github.com/adamhathcock/sharpcompress/pull/205)
|
||||
|
||||
### Version 0.14.1
|
||||
|
||||
* [.NET Assemblies aren't strong named](https://github.com/adamhathcock/sharpcompress/issues/158)
|
||||
* [Pkware encryption for Zip files didn't allow for multiple reads of an entry](https://github.com/adamhathcock/sharpcompress/issues/197)
|
||||
* [GZip Entry couldn't be read multiple times](https://github.com/adamhathcock/sharpcompress/issues/198)
|
||||
|
||||
### Version 0.14.0
|
||||
|
||||
* [Support for LZip reading in for Tars](https://github.com/adamhathcock/sharpcompress/pull/191)
|
||||
|
||||
### Version 0.13.1
|
||||
|
||||
* [Fix null password on ReaderFactory. Fix null options on SevenZipArchive](https://github.com/adamhathcock/sharpcompress/pull/188)
|
||||
* [Make PpmdProperties lazy to avoid unnecessary allocations.](https://github.com/adamhathcock/sharpcompress/pull/185)
|
||||
|
||||
### Version 0.13.0
|
||||
|
||||
* Breaking change: Big refactor of Options on API.
|
||||
* 7Zip supports Deflate
|
||||
|
||||
### Version 0.12.4
|
||||
|
||||
* Forward only zip issue fix https://github.com/adamhathcock/sharpcompress/issues/160
|
||||
* Try to fix frameworks again by copying targets from JSON.NET
|
||||
|
||||
### Version 0.12.3
|
||||
|
||||
* 7Zip fixes https://github.com/adamhathcock/sharpcompress/issues/73
|
||||
* Maybe all profiles will work with project.json now
|
||||
|
||||
### Version 0.12.2
|
||||
|
||||
* Support Profile 259 again
|
||||
|
||||
### Version 0.12.1
|
||||
|
||||
* Support Silverlight 5
|
||||
|
||||
### Version 0.12.0
|
||||
|
||||
* .NET Core RTM!
|
||||
* Bug fix for Tar long paths
|
||||
|
||||
### Version 0.11.6
|
||||
|
||||
* Bug fix for global header in Tar
|
||||
* Writers now have a leaveOpen `bool` overload. They won't close streams if not-requested to.
|
||||
|
||||
### Version 0.11.5
|
||||
|
||||
* Bug fix in Skip method
|
||||
|
||||
### Version 0.11.4
|
||||
|
||||
* SharpCompress is now endian neutral (matters for Mono platforms)
|
||||
* Fix for Inflate (need to change implementation)
|
||||
* Fixes for RAR detection
|
||||
|
||||
### Version 0.11.1
|
||||
|
||||
* Added Cancel on IReader
|
||||
* Removed .NET 2.0 support and LinqBridge dependency
|
||||
|
||||
### Version 0.11
|
||||
|
||||
* Been over a year, contains mainly fixes from contributors!
|
||||
* Possible breaking change: ArchiveEncoding is UTF8 by default now.
|
||||
* TAR supports writing long names using longlink
|
||||
* RAR Protect Header added
|
||||
|
||||
### Version 0.10.3
|
||||
|
||||
* Finally fixed Disposal issue when creating a new archive with the Archive API
|
||||
|
||||
### Version 0.10.2
|
||||
|
||||
* Fixed Rar Header reading for invalid extended time headers.
|
||||
* Windows Store assembly is now strong named
|
||||
* Known issues with Long Tar names being worked on
|
||||
* Updated to VS2013
|
||||
* Portable targets SL5 and Windows Phone 8 (up from SL4 and WP7)
|
||||
|
||||
### Version 0.10.1
|
||||
|
||||
* Fixed 7Zip extraction performance problem
|
||||
|
||||
### Version 0.10:
|
||||
|
||||
* Added support for RAR Decryption (thanks to https://github.com/hrasyid)
|
||||
* Embedded some BouncyCastle crypto classes to allow RAR Decryption and Winzip AES Decryption in Portable and Windows Store DLLs
|
||||
* Built in Release (I think)
|
||||
|
||||
XZ implementation based on: https://github.com/sambott/XZ.NET by @sambott
|
||||
|
||||
7Zip implementation based on: https://code.google.com/p/managed-lzma/
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Archive;
|
||||
using SharpCompress.Archive.GZip;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class GZipArchiveTests : ArchiveTests
|
||||
{
|
||||
public GZipArchiveTests()
|
||||
{
|
||||
UseExtensionInsteadOfNameToVerify = true;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GZip_Archive_Generic()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
|
||||
using (var archive = ArchiveFactory.Open(stream))
|
||||
{
|
||||
var entry = archive.Entries.First();
|
||||
entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key));
|
||||
}
|
||||
CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"),
|
||||
Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GZip_Archive()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
|
||||
using (var archive = GZipArchive.Open(stream))
|
||||
{
|
||||
var entry = archive.Entries.First();
|
||||
entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key));
|
||||
}
|
||||
CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"),
|
||||
Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar"));
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidOperationException))]
|
||||
public void GZip_Archive_NoAdd()
|
||||
{
|
||||
string jpg = Path.Combine(ORIGINAL_FILES_PATH, "jpg\\test.jpg");
|
||||
ResetScratch();
|
||||
using (Stream stream = File.Open(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz"), FileMode.Open))
|
||||
using (var archive = GZipArchive.Open(stream))
|
||||
{
|
||||
archive.AddEntry("jpg\\test.jpg", jpg);
|
||||
archive.SaveTo(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar.gz"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SharpCompress.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("SharpCompress.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f01fddfb-445f-4548-9f69-88b69a8b71b0")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
SharpCompress.Test/Properties/Resources.Designer.cs
generated
63
SharpCompress.Test/Properties/Resources.Designer.cs
generated
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.269
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SharpCompress.Test.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpCompress.Test.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
SharpCompress.Test/Properties/Settings.Designer.cs
generated
26
SharpCompress.Test/Properties/Settings.Designer.cs
generated
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.269
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace SharpCompress.Test.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,84 +0,0 @@
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class RewindableStreamTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestRewind()
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
BinaryWriter bw = new BinaryWriter(ms);
|
||||
bw.Write(1);
|
||||
bw.Write(2);
|
||||
bw.Write(3);
|
||||
bw.Write(4);
|
||||
bw.Write(5);
|
||||
bw.Write(6);
|
||||
bw.Write(7);
|
||||
bw.Flush();
|
||||
ms.Position = 0;
|
||||
RewindableStream stream = new RewindableStream(ms);
|
||||
stream.StartRecording();
|
||||
BinaryReader br = new BinaryReader(stream);
|
||||
Assert.AreEqual(br.ReadInt32(), 1);
|
||||
Assert.AreEqual(br.ReadInt32(), 2);
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
stream.Rewind(true);
|
||||
stream.StartRecording();
|
||||
Assert.AreEqual(br.ReadInt32(), 1);
|
||||
Assert.AreEqual(br.ReadInt32(), 2);
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
Assert.AreEqual(br.ReadInt32(), 5);
|
||||
Assert.AreEqual(br.ReadInt32(), 6);
|
||||
Assert.AreEqual(br.ReadInt32(), 7);
|
||||
stream.Rewind(true);
|
||||
stream.StartRecording();
|
||||
Assert.AreEqual(br.ReadInt32(), 1);
|
||||
Assert.AreEqual(br.ReadInt32(), 2);
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestIncompleteRewind()
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
BinaryWriter bw = new BinaryWriter(ms);
|
||||
bw.Write(1);
|
||||
bw.Write(2);
|
||||
bw.Write(3);
|
||||
bw.Write(4);
|
||||
bw.Write(5);
|
||||
bw.Write(6);
|
||||
bw.Write(7);
|
||||
bw.Flush();
|
||||
ms.Position = 0;
|
||||
RewindableStream stream = new RewindableStream(ms);
|
||||
stream.StartRecording();
|
||||
BinaryReader br = new BinaryReader(stream);
|
||||
Assert.AreEqual(br.ReadInt32(), 1);
|
||||
Assert.AreEqual(br.ReadInt32(), 2);
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
stream.Rewind(true);
|
||||
Assert.AreEqual(br.ReadInt32(), 1);
|
||||
Assert.AreEqual(br.ReadInt32(), 2);
|
||||
stream.StartRecording();
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
Assert.AreEqual(br.ReadInt32(), 5);
|
||||
stream.Rewind(true);
|
||||
Assert.AreEqual(br.ReadInt32(), 3);
|
||||
Assert.AreEqual(br.ReadInt32(), 4);
|
||||
Assert.AreEqual(br.ReadInt32(), 5);
|
||||
Assert.AreEqual(br.ReadInt32(), 6);
|
||||
Assert.AreEqual(br.ReadInt32(), 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class SevenZipArchiveTests : ArchiveTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_LZMA_StreamRead()
|
||||
{
|
||||
ArchiveStreamRead("7Zip.LZMA.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_LZMA_PathRead()
|
||||
{
|
||||
ArchiveFileRead("7Zip.LZMA.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_PPMd_StreamRead()
|
||||
{
|
||||
ArchiveStreamRead("7Zip.PPMd.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_PPMd_StreamRead_Extract_All()
|
||||
{
|
||||
ArchiveStreamReadExtractAll("7Zip.PPMd.7z", CompressionType.PPMd);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_PPMd_PathRead()
|
||||
{
|
||||
ArchiveFileRead("7Zip.PPMd.7z");
|
||||
}
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_LZMA2_StreamRead()
|
||||
{
|
||||
ArchiveStreamRead("7Zip.LZMA2.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_LZMA2_PathRead()
|
||||
{
|
||||
ArchiveFileRead("7Zip.LZMA2.7z");
|
||||
}
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_BZip2_StreamRead()
|
||||
{
|
||||
ArchiveStreamRead("7Zip.BZip2.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_BZip2_PathRead()
|
||||
{
|
||||
ArchiveFileRead("7Zip.BZip2.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void SevenZipArchive_LZMA_Time_Attributes_PathRead()
|
||||
{
|
||||
ArchiveFileReadEx("7Zip.LZMA.7z");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(IndexOutOfRangeException))]
|
||||
public void SevenZipArchive_BZip2_Split()
|
||||
{
|
||||
ArchiveStreamRead("Original.7z.001", "Original.7z.002",
|
||||
"Original.7z.003", "Original.7z.004", "Original.7z.005",
|
||||
"Original.7z.006", "Original.7z.007");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E9C3C94B-FB27-4B4F-B225-57513C254D37}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress.Test</RootNamespace>
|
||||
<AssemblyName>SharpCompress.Test.Portable</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\DebugPortable\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\SharpCompress\SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ArchiveTests.cs" />
|
||||
<Compile Include="GZip\GZipWriterTests.cs" />
|
||||
<Compile Include="GZip\GZipArchiveTests.cs" />
|
||||
<Compile Include="Rar\RarHeaderFactoryTest.cs" />
|
||||
<Compile Include="SevenZip\SevenZipArchiveTests.cs" />
|
||||
<Compile Include="Streams\StreamTests.cs" />
|
||||
<Compile Include="Tar\TarWriterTests.cs" />
|
||||
<Compile Include="Tar\TarReaderTests.cs" />
|
||||
<Compile Include="Zip\ZipWriterTests.cs" />
|
||||
<Compile Include="WriterTests.cs" />
|
||||
<Compile Include="Rar\RarReaderTests.cs" />
|
||||
<Compile Include="ReaderTests.cs" />
|
||||
<Compile Include="Tar\TarArchiveTests.cs" />
|
||||
<Compile Include="Zip\ZipArchiveTests.cs" />
|
||||
<Compile Include="Rar\RarArchiveTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RewindableStreamTest.cs" />
|
||||
<Compile Include="TestBase.cs" />
|
||||
<Compile Include="TestStream.cs" />
|
||||
<Compile Include="Zip\ZipReaderTests.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="..\SharpCompress\SharpCompress.pfx">
|
||||
<Link>SharpCompress.pfx</Link>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpCompress\SharpCompress.PortableTest.csproj">
|
||||
<Project>{efdcaf57-fd4d-4e5d-a3d5-f26b875817ed}</Project>
|
||||
<Name>SharpCompress.PortableTest</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress.Test</RootNamespace>
|
||||
<AssemblyName>SharpCompress.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>..\SharpCompress\SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ArchiveTests.cs" />
|
||||
<Compile Include="GZip\GZipWriterTests.cs" />
|
||||
<Compile Include="GZip\GZipArchiveTests.cs" />
|
||||
<Compile Include="Rar\RarHeaderFactoryTest.cs" />
|
||||
<Compile Include="SevenZip\SevenZipArchiveTests.cs" />
|
||||
<Compile Include="Streams\StreamTests.cs" />
|
||||
<Compile Include="Tar\TarWriterTests.cs" />
|
||||
<Compile Include="Tar\TarReaderTests.cs" />
|
||||
<Compile Include="Zip\ZipWriterTests.cs" />
|
||||
<Compile Include="WriterTests.cs" />
|
||||
<Compile Include="Rar\RarReaderTests.cs" />
|
||||
<Compile Include="ReaderTests.cs" />
|
||||
<Compile Include="Tar\TarArchiveTests.cs" />
|
||||
<Compile Include="Zip\ZipArchiveTests.cs" />
|
||||
<Compile Include="Rar\RarArchiveTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RewindableStreamTest.cs" />
|
||||
<Compile Include="TestBase.cs" />
|
||||
<Compile Include="TestStream.cs" />
|
||||
<Compile Include="Zip\ZipReaderTests.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="..\SharpCompress\SharpCompress.pfx">
|
||||
<Link>SharpCompress.pfx</Link>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpCompress\SharpCompress.Unsigned.csproj">
|
||||
<Project>{27d535cb-2fd3-4621-8c9a-46161fc77a5d}</Project>
|
||||
<Name>SharpCompress.Unsigned</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,92 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader.Tar;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class TarReaderTests : ReaderTests
|
||||
{
|
||||
public TarReaderTests()
|
||||
{
|
||||
UseExtensionInsteadOfNameToVerify = true;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_Reader()
|
||||
{
|
||||
Read("Tar.tar", CompressionType.None);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_BZip2_Reader()
|
||||
{
|
||||
Read("Tar.tar.bz2", CompressionType.BZip2);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_GZip_Reader()
|
||||
{
|
||||
Read("Tar.tar.gz", CompressionType.GZip);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_BZip2_Entry_Stream()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.bz2")))
|
||||
using (var reader = TarReader.Open(stream))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Assert.AreEqual(reader.Entry.CompressionType, CompressionType.BZip2);
|
||||
using (var entryStream = reader.OpenEntryStream())
|
||||
{
|
||||
string file = Path.GetFileName(reader.Entry.Key);
|
||||
string folder = Path.GetDirectoryName(reader.Entry.Key);
|
||||
string destdir = Path.Combine(SCRATCH_FILES_PATH, folder);
|
||||
if (!Directory.Exists(destdir))
|
||||
{
|
||||
Directory.CreateDirectory(destdir);
|
||||
}
|
||||
string destinationFileName = Path.Combine(destdir, file);
|
||||
|
||||
using (FileStream fs = File.OpenWrite(destinationFileName))
|
||||
{
|
||||
entryStream.TransferTo(fs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_BZip2_Skip_Entry_Stream()
|
||||
{
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.bz2")))
|
||||
using (var reader = TarReader.Open(stream))
|
||||
{
|
||||
List<string> names = new List<string>();
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Assert.AreEqual(reader.Entry.CompressionType, CompressionType.BZip2);
|
||||
using (var entryStream = reader.OpenEntryStream())
|
||||
{
|
||||
entryStream.SkipEntry();
|
||||
names.Add(reader.Entry.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.AreEqual(names.Count, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class TarWriterTests : WriterTests
|
||||
{
|
||||
public TarWriterTests()
|
||||
: base(ArchiveType.Tar)
|
||||
{
|
||||
UseExtensionInsteadOfNameToVerify = true;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_Writer()
|
||||
{
|
||||
Write(CompressionType.None, "Tar.noEmptyDirs.tar", "Tar.noEmptyDirs.tar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_BZip2_Writer()
|
||||
{
|
||||
Write(CompressionType.BZip2, "Tar.noEmptyDirs.tar.bz2", "Tar.noEmptyDirs.tar.bz2");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidFormatException))]
|
||||
public void Tar_Rar_Write()
|
||||
{
|
||||
Write(CompressionType.Rar, "Zip.ppmd.noEmptyDirs.zip", "Zip.ppmd.noEmptyDirs.zip");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
using SharpCompress.Writer;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
public class WriterTests : TestBase
|
||||
{
|
||||
private ArchiveType type;
|
||||
|
||||
protected WriterTests(ArchiveType type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
protected void Write(CompressionType compressionType, string archive, string archiveToVerifyAgainst)
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.OpenWrite(Path.Combine(SCRATCH2_FILES_PATH, archive)))
|
||||
using (var writer = WriterFactory.Open(stream, type, compressionType))
|
||||
{
|
||||
writer.WriteAll(ORIGINAL_FILES_PATH, "*", SearchOption.AllDirectories);
|
||||
}
|
||||
CompareArchivesByPath(Path.Combine(SCRATCH2_FILES_PATH, archive),
|
||||
Path.Combine(TEST_ARCHIVES_PATH, archiveToVerifyAgainst));
|
||||
|
||||
using (Stream stream = File.OpenRead(Path.Combine(SCRATCH2_FILES_PATH, archive)))
|
||||
using (var reader = ReaderFactory.Open(stream))
|
||||
{
|
||||
reader.WriteAllToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath);
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,224 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
using SharpCompress.Reader.Zip;
|
||||
using SharpCompress.Writer;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class ZipReaderTests : ReaderTests
|
||||
{
|
||||
public ZipReaderTests()
|
||||
{
|
||||
UseExtensionInsteadOfNameToVerify = true;
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_ZipX_Streamed_Read()
|
||||
{
|
||||
Read("Zip.Zipx", CompressionType.LZMA);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_BZip2_Streamed_Read()
|
||||
{
|
||||
Read("Zip.bzip2.dd.zip", CompressionType.BZip2);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_BZip2_Read()
|
||||
{
|
||||
Read("Zip.bzip2.zip", CompressionType.BZip2);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_Deflate_Streamed2_Read()
|
||||
{
|
||||
Read("Zip.deflate.dd-.zip", CompressionType.Deflate);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_Deflate_Streamed_Read()
|
||||
{
|
||||
Read("Zip.deflate.dd.zip", CompressionType.Deflate);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_Deflate_Read()
|
||||
{
|
||||
Read("Zip.deflate.zip", CompressionType.Deflate);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_LZMA_Streamed_Read()
|
||||
{
|
||||
Read("Zip.lzma.dd.zip", CompressionType.LZMA);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_LZMA_Read()
|
||||
{
|
||||
Read("Zip.lzma.zip", CompressionType.LZMA);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_PPMd_Streamed_Read()
|
||||
{
|
||||
Read("Zip.ppmd.dd.zip", CompressionType.PPMd);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Zip_PPMd_Read()
|
||||
{
|
||||
Read("Zip.ppmd.zip", CompressionType.PPMd);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_None_Read()
|
||||
{
|
||||
Read("Zip.none.zip", CompressionType.None);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_Deflate_NoEmptyDirs_Read()
|
||||
{
|
||||
Read("Zip.deflate.noEmptyDirs.zip", CompressionType.Deflate);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_BZip2_PkwareEncryption_Read()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.bzip2.pkware.zip")))
|
||||
using (var reader = ZipReader.Open(stream, "test"))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Assert.AreEqual(reader.Entry.CompressionType, CompressionType.BZip2);
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_Reader_Disposal_Test()
|
||||
{
|
||||
ResetScratch();
|
||||
using (TestStream stream = new TestStream(File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd.zip"))))
|
||||
{
|
||||
using (var reader = ReaderFactory.Open(stream, Options.None))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
|
||||
ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
Assert.IsTrue(stream.IsDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_Reader_Disposal_Test2()
|
||||
{
|
||||
ResetScratch();
|
||||
using (TestStream stream = new TestStream(File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd.zip"))))
|
||||
{
|
||||
var reader = ReaderFactory.Open(stream, Options.None);
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
|
||||
ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
Assert.IsFalse(stream.IsDisposed);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void Zip_LZMA_WinzipAES_Read()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.lzma.winzipaes.zip")))
|
||||
using (var reader = ZipReader.Open(stream, "test"))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Assert.AreEqual(reader.Entry.CompressionType, CompressionType.Unknown);
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Zip_Deflate_WinzipAES_Read()
|
||||
{
|
||||
ResetScratch();
|
||||
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.WinzipAES.zip")))
|
||||
using (var reader = ZipReader.Open(stream, "test"))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Assert.AreEqual(reader.Entry.CompressionType, CompressionType.Unknown);
|
||||
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH,
|
||||
ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
class NonSeekableMemoryStream : MemoryStream
|
||||
{
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSharpCompressWithEmptyStream()
|
||||
{
|
||||
MemoryStream stream = new NonSeekableMemoryStream();
|
||||
|
||||
using (IWriter zipWriter = WriterFactory.Open(stream, ArchiveType.Zip, CompressionType.Deflate))
|
||||
{
|
||||
zipWriter.Write("foo.txt", new MemoryStream(new byte[0]));
|
||||
zipWriter.Write("foo2.txt", new MemoryStream(new byte[10]));
|
||||
}
|
||||
|
||||
stream = new MemoryStream(stream.ToArray());
|
||||
File.WriteAllBytes("foo.zip", stream.ToArray());
|
||||
|
||||
using (IReader zipReader = ZipReader.Open(stream))
|
||||
{
|
||||
while (zipReader.MoveToNextEntry())
|
||||
{
|
||||
using (EntryStream entry = zipReader.OpenEntryStream())
|
||||
{
|
||||
MemoryStream tempStream = new MemoryStream();
|
||||
const int bufSize = 0x1000;
|
||||
byte[] buf = new byte[bufSize];
|
||||
int bytesRead = 0;
|
||||
while ((bytesRead = entry.Read(buf, 0, bufSize)) > 0)
|
||||
tempStream.Write(buf, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<!-- The configuration and platform will be used to determine which
|
||||
assemblies to include from solution and project documentation
|
||||
sources -->
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{a226cac9-f2c4-4cc2-94f9-163b3e221817}</ProjectGuid>
|
||||
<SHFBSchemaVersion>1.9.3.0</SHFBSchemaVersion>
|
||||
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
|
||||
Studio adds them anyway -->
|
||||
<AssemblyName>Documentation</AssemblyName>
|
||||
<RootNamespace>Documentation</RootNamespace>
|
||||
<Name>Documentation</Name>
|
||||
<!-- SHFB properties -->
|
||||
<OutputPath>.\Help\</OutputPath>
|
||||
<HtmlHelpName>sharpcompress</HtmlHelpName>
|
||||
<Language>en-US</Language>
|
||||
<RootNamespaceTitle>SharpCompress</RootNamespaceTitle>
|
||||
<SandcastlePath>..\..\Program Files (x86)\Sandcastle\</SandcastlePath>
|
||||
<DocumentationSources>
|
||||
<DocumentationSource sourceFile="bin\SharpCompress.dll" />
|
||||
<DocumentationSource sourceFile="bin\SharpCompress.xml" />
|
||||
</DocumentationSources>
|
||||
<HelpTitle>SharpCompress</HelpTitle>
|
||||
<PresentationStyle>Prototype</PresentationStyle>
|
||||
<HelpFileFormat>HtmlHelp1, Website</HelpFileFormat>
|
||||
<MissingTags>AutoDocumentCtors, AutoDocumentDispose</MissingTags>
|
||||
</PropertyGroup>
|
||||
<!-- There are no properties for these groups. AnyCPU needs to appear in
|
||||
order for Visual Studio to perform the build. The others are optional
|
||||
common platform types that may appear. -->
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Win32' ">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
|
||||
</PropertyGroup>
|
||||
<!-- Import the SHFB build targets -->
|
||||
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
|
||||
</Project>
|
||||
Binary file not shown.
@@ -1,71 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F18F1765-4A02-42FD-9BEF-F0E2FCBD9D17}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
NuGet\sharpcompress.nuspec = NuGet\sharpcompress.nuspec
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress", "SharpCompress\SharpCompress.csproj", "{10A689CF-76A2-4A4F-96E4-553C33398438}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Test", "SharpCompress.Test\SharpCompress.Test.csproj", "{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Portable", "SharpCompress\SharpCompress.Portable.csproj", "{7FA7D133-1417-4F85-9998-4C618AC8FEDA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.WindowsStore", "SharpCompress\SharpCompress.WindowsStore.csproj", "{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.PortableTest", "SharpCompress\SharpCompress.PortableTest.csproj", "{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Test.Portable", "SharpCompress.Test\SharpCompress.Test.Portable.csproj", "{E9C3C94B-FB27-4B4F-B225-57513C254D37}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Unsigned", "SharpCompress\SharpCompress.Unsigned.csproj", "{27D535CB-2FD3-4621-8C9A-46161FC77A5D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{27D535CB-2FD3-4621-8C9A-46161FC77A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{27D535CB-2FD3-4621-8C9A-46161FC77A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{27D535CB-2FD3-4621-8C9A-46161FC77A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{27D535CB-2FD3-4621-8C9A-46161FC77A5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{27D535CB-2FD3-4621-8C9A-46161FC77A5D} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.6
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F18F1765-4A02-42FD-9BEF-F0E2FCBD9D17}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C5BE746-03E5-4895-9988-0B57F162F86C}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0F0901FF-E8D9-426A-B5A2-17C7F47C1529}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress", "src\SharpCompress\SharpCompress.csproj", "{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCompress.Test", "tests\SharpCompress.Test\SharpCompress.Test.csproj", "{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998} = {3C5BE746-03E5-4895-9988-0B57F162F86C}
|
||||
{F2B1A1EB-0FA6-40D0-8908-E13247C7226F} = {0F0901FF-E8D9-426A-B5A2-17C7F47C1529}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,6 +1,120 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=181069325DAB1C4287CD564D6CDDEDB3/AbsolutePath/@EntryValue">D:\Git\sharpcompress\SharpCompress\sharpcompress.DotSettings</s:String>
|
||||
<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=181069325DAB1C4287CD564D6CDDEDB3/RelativePath/@EntryValue">..\SharpCompress\sharpcompress.DotSettings</s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=181069325DAB1C4287CD564D6CDDEDB3/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File181069325DAB1C4287CD564D6CDDEDB3/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:Double x:Key="/Default/Environment/InjectedLayers/InjectedLayerCustomization/=File181069325DAB1C4287CD564D6CDDEDB3/RelativePriority/@EntryValue">1</s:Double></wpf:ResourceDictionary>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleNamedExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Fdowhile/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Ffixed/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Ffor/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Fforeach/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Fifelse/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Flock/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Fusing/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeBraces_005Fwhile/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MethodSupportsCancellation/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantExplicitParamsArrayCreation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Basic_0020Clean/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Basic Clean"><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="False" RemoveRedundantParentheses="False" AddMissingParentheses="False" ArrangeBraces="True" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSReformatCode>True</CSReformatCode></Profile></s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Basic Clean</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/APPLY_ON_COMPLETION/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ARGUMENTS_NAMED/@EntryValue">Named</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_FIRST_ARG_BY_PAREN/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_LINQ_QUERY/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXPRESSION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_FOR_STMT/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTLINE_TYPE_PARAMETER_LIST/@EntryValue">True</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AFTER_START_COMMENT/@EntryValue">0</s:Int64>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_BEFORE_SINGLE_LINE_COMMENT/@EntryValue">1</s:Int64>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">SEPARATE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_ANONYMOUS_METHOD_BLOCK/@EntryValue">True</s:Boolean>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSORHOLDER_ON_SINGLE_LINE/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_INITIALIZER_ON_SINGLE_LINE/@EntryValue">True</s:Boolean>
|
||||
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_ARROW_OP/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
|
||||
|
||||
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/STICK_COMMENT/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARRAY_INITIALIZER_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_EXTENDS_LIST_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseVarWhenEvident</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseVarWhenEvident</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseVarWhenEvident</s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FCONSTANT/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FFUNCTION/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FBLOCK_005FSCOPE_005FVARIABLE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FCLASS/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FCONSTRUCTOR/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FFUNCTION/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FGLOBAL_005FVARIABLE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FLABEL/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FLOCAL_005FCONSTRUCTOR/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FLOCAL_005FVARIABLE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FOBJECT_005FPROPERTY_005FOF_005FFUNCTION/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FPARAMETER/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FCLASS/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FENUM/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FENUM_005FMEMBER/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FINTERFACE/@EntryIndexedValue"><Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FMODULE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FMODULE_005FEXPORTED/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FMODULE_005FLOCAL/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPRIVATE_005FMEMBER_005FACCESSOR/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPRIVATE_005FSTATIC_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPRIVATE_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPRIVATE_005FTYPE_005FMETHOD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPROTECTED_005FMEMBER_005FACCESSOR/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPROTECTED_005FSTATIC_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPROTECTED_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPROTECTED_005FTYPE_005FMETHOD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FMEMBER_005FACCESSOR/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FSTATIC_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FTYPE_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FPUBLIC_005FTYPE_005FMETHOD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=TS_005FTYPE_005FPARAMETER/@EntryIndexedValue"><Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FHTML_005FCONTROL/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FTAG_005FNAME/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/WebNaming/UserRules/=ASP_005FTAG_005FPREFIX/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
|
||||
BIN
SharpCompress.snk
Normal file
BIN
SharpCompress.snk
Normal file
Binary file not shown.
@@ -1,111 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Archive.GZip
|
||||
{
|
||||
internal class GZipWritableArchiveEntry : GZipArchiveEntry, IWritableArchiveEntry
|
||||
{
|
||||
private readonly string path;
|
||||
private readonly long size;
|
||||
private readonly DateTime? lastModified;
|
||||
private readonly bool closeStream;
|
||||
private readonly Stream stream;
|
||||
|
||||
internal GZipWritableArchiveEntry(GZipArchive archive, Stream stream,
|
||||
string path, long size, DateTime? lastModified, bool closeStream)
|
||||
: base(archive, null)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.path = path;
|
||||
this.size = size;
|
||||
this.lastModified = lastModified;
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return path; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return lastModified; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
Stream IWritableArchiveEntry.Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
//ensure new stream is at the start, this could be reset
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return new NonDisposingStream(stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Tar;
|
||||
using SharpCompress.Common.Tar.Headers;
|
||||
using SharpCompress.IO;
|
||||
using SharpCompress.Reader;
|
||||
using SharpCompress.Reader.Tar;
|
||||
using SharpCompress.Writer.Tar;
|
||||
|
||||
namespace SharpCompress.Archive.Tar
|
||||
{
|
||||
public class TarArchive : AbstractWritableArchive<TarArchiveEntry, TarVolume>
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public static TarArchive Open(string filePath)
|
||||
{
|
||||
return Open(filePath, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
public static TarArchive Open(FileInfo fileInfo)
|
||||
{
|
||||
return Open(fileInfo, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="options"></param>
|
||||
public static TarArchive Open(string filePath, Options options)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
public static TarArchive Open(FileInfo fileInfo, Options options)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
return new TarArchive(fileInfo, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
public static TarArchive Open(Stream stream)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return Open(stream, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
public static TarArchive Open(Stream stream, Options options)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return new TarArchive(stream, options);
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public static bool IsTarFile(string filePath)
|
||||
{
|
||||
return IsTarFile(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public static bool IsTarFile(FileInfo fileInfo)
|
||||
{
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (Stream stream = fileInfo.OpenRead())
|
||||
{
|
||||
return IsTarFile(stream);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsTarFile(Stream stream)
|
||||
{
|
||||
try
|
||||
{
|
||||
TarHeader tar = new TarHeader();
|
||||
tar.Read(new BinaryReader(stream));
|
||||
return tar.Name.Length > 0 && Enum.IsDefined(typeof (EntryType), tar.EntryType);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
internal TarArchive(FileInfo fileInfo, Options options)
|
||||
: base(ArchiveType.Tar, fileInfo, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<TarVolume> LoadVolumes(FileInfo file, Options options)
|
||||
{
|
||||
if (FlagUtility.HasFlag(options, Options.KeepStreamsOpen))
|
||||
{
|
||||
options = (Options)FlagUtility.SetFlag(options, Options.KeepStreamsOpen, false);
|
||||
}
|
||||
return new TarVolume(file.OpenRead(), options).AsEnumerable();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
internal TarArchive(Stream stream, Options options)
|
||||
: base(ArchiveType.Tar, stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
internal TarArchive()
|
||||
: base(ArchiveType.Tar)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<TarVolume> LoadVolumes(IEnumerable<Stream> streams, Options options)
|
||||
{
|
||||
return new TarVolume(streams.First(), options).AsEnumerable();
|
||||
}
|
||||
|
||||
protected override IEnumerable<TarArchiveEntry> LoadEntries(IEnumerable<TarVolume> volumes)
|
||||
{
|
||||
Stream stream = volumes.Single().Stream;
|
||||
TarHeader previousHeader = null;
|
||||
foreach (TarHeader header in TarHeaderFactory.ReadHeader(StreamingMode.Seekable, stream))
|
||||
{
|
||||
if (header != null)
|
||||
{
|
||||
if (header.EntryType == EntryType.LongName)
|
||||
{
|
||||
previousHeader = header;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (previousHeader != null)
|
||||
{
|
||||
var entry = new TarArchiveEntry(this, new TarFilePart(previousHeader, stream),
|
||||
CompressionType.None);
|
||||
|
||||
var oldStreamPos = stream.Position;
|
||||
|
||||
using(var entryStream = entry.OpenEntryStream())
|
||||
using(var memoryStream = new MemoryStream())
|
||||
{
|
||||
entryStream.TransferTo(memoryStream);
|
||||
memoryStream.Position = 0;
|
||||
var bytes = memoryStream.ToArray();
|
||||
|
||||
header.Name = ArchiveEncoding.Default.GetString(bytes, 0, bytes.Length).TrimNulls();
|
||||
}
|
||||
|
||||
stream.Position = oldStreamPos;
|
||||
|
||||
previousHeader = null;
|
||||
}
|
||||
yield return new TarArchiveEntry(this, new TarFilePart(header, stream), CompressionType.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static TarArchive Create()
|
||||
{
|
||||
return new TarArchive();
|
||||
}
|
||||
|
||||
protected override TarArchiveEntry CreateEntryInternal(string filePath, Stream source,
|
||||
long size, DateTime? modified, bool closeStream)
|
||||
{
|
||||
return new TarWritableArchiveEntry(this, source, CompressionType.Unknown, filePath, size, modified,
|
||||
closeStream);
|
||||
}
|
||||
|
||||
protected override void SaveTo(Stream stream, CompressionInfo compressionInfo,
|
||||
IEnumerable<TarArchiveEntry> oldEntries,
|
||||
IEnumerable<TarArchiveEntry> newEntries)
|
||||
{
|
||||
using (var writer = new TarWriter(stream, compressionInfo))
|
||||
{
|
||||
foreach (var entry in oldEntries.Concat(newEntries)
|
||||
.Where(x => !x.IsDirectory))
|
||||
{
|
||||
using (var entryStream = entry.OpenEntryStream())
|
||||
{
|
||||
writer.Write(entry.Key, entryStream, entry.LastModifiedTime, entry.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override IReader CreateReaderForSolidExtraction()
|
||||
{
|
||||
var stream = Volumes.Single().Stream;
|
||||
stream.Position = 0;
|
||||
return TarReader.Open(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Archive.Tar
|
||||
{
|
||||
internal class TarWritableArchiveEntry : TarArchiveEntry, IWritableArchiveEntry
|
||||
{
|
||||
private readonly string path;
|
||||
private readonly long size;
|
||||
private readonly DateTime? lastModified;
|
||||
private readonly bool closeStream;
|
||||
private readonly Stream stream;
|
||||
|
||||
internal TarWritableArchiveEntry(TarArchive archive, Stream stream, CompressionType compressionType,
|
||||
string path, long size, DateTime? lastModified, bool closeStream)
|
||||
: base(archive, null, compressionType)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.path = path;
|
||||
this.size = size;
|
||||
this.lastModified = lastModified;
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return path; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return lastModified; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
Stream IWritableArchiveEntry.Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
//ensure new stream is at the start, this could be reset
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return new NonDisposingStream(stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Archive.Zip
|
||||
{
|
||||
internal class ZipWritableArchiveEntry : ZipArchiveEntry, IWritableArchiveEntry
|
||||
{
|
||||
private readonly string path;
|
||||
private readonly long size;
|
||||
private readonly DateTime? lastModified;
|
||||
private readonly bool closeStream;
|
||||
private readonly Stream stream;
|
||||
private bool isDisposed;
|
||||
|
||||
internal ZipWritableArchiveEntry(ZipArchive archive, Stream stream, string path, long size,
|
||||
DateTime? lastModified, bool closeStream)
|
||||
: base(archive, null)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.path = path;
|
||||
this.size = size;
|
||||
this.lastModified = lastModified;
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return path; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return size; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return lastModified; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
Stream IWritableArchiveEntry.Stream
|
||||
{
|
||||
get
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
//ensure new stream is at the start, this could be reset
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return new NonDisposingStream(stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream && !isDisposed)
|
||||
{
|
||||
stream.Dispose();
|
||||
isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
#if PORTABLE
|
||||
[assembly: AssemblyTitle("SharpCompress.Portable")]
|
||||
[assembly: AssemblyProduct("SharpCompress.Portable")]
|
||||
#else
|
||||
|
||||
[assembly: AssemblyTitle("SharpCompress")]
|
||||
[assembly: AssemblyProduct("SharpCompress")]
|
||||
#endif
|
||||
|
||||
#if UNSIGNED
|
||||
[assembly: InternalsVisibleTo("SharpCompress.Test")]
|
||||
[assembly: InternalsVisibleTo("SharpCompress.Test.Portable")]
|
||||
#endif
|
||||
|
||||
[assembly: CLSCompliant(true)]
|
||||
@@ -1,23 +0,0 @@
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
public static class ArchiveEncoding
|
||||
{
|
||||
/// <summary>
|
||||
/// Default encoding to use when archive format doesn't specify one.
|
||||
/// </summary>
|
||||
public static Encoding Default { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Encoding used by encryption schemes which don't comply with RFC 2898.
|
||||
/// </summary>
|
||||
public static Encoding Password { get; set; }
|
||||
|
||||
static ArchiveEncoding()
|
||||
{
|
||||
Default = Encoding.UTF8;
|
||||
Password = Encoding.UTF8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using SharpCompress.Compressor.Deflate;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Detailed compression properties when saving.
|
||||
/// </summary>
|
||||
public class CompressionInfo
|
||||
{
|
||||
public CompressionInfo()
|
||||
{
|
||||
DeflateCompressionLevel = CompressionLevel.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The algorthm to use. Must be valid for the format type.
|
||||
/// </summary>
|
||||
public CompressionType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When CompressionType.Deflate is used, this property is referenced. Defaults to CompressionLevel.Default.
|
||||
/// </summary>
|
||||
public CompressionLevel DeflateCompressionLevel { get; set; }
|
||||
|
||||
public static implicit operator CompressionInfo(CompressionType compressionType)
|
||||
{
|
||||
return new CompressionInfo() {Type = compressionType};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.GZip
|
||||
{
|
||||
public class GZipEntry : Entry
|
||||
{
|
||||
private readonly GZipFilePart filePart;
|
||||
|
||||
internal GZipEntry(GZipFilePart filePart)
|
||||
{
|
||||
this.filePart = filePart;
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get { return CompressionType.GZip; }
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return filePart.FilePartName; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return filePart.DateModified; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return filePart.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
|
||||
internal static IEnumerable<GZipEntry> GetEntries(Stream stream)
|
||||
{
|
||||
yield return new GZipEntry(new GZipFilePart(stream));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.GZip
|
||||
{
|
||||
public class GZipVolume : Volume
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
private readonly FileInfo fileInfo;
|
||||
#endif
|
||||
|
||||
public GZipVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public GZipVolume(FileInfo fileInfo, Options options)
|
||||
: base(fileInfo.OpenRead(), options)
|
||||
{
|
||||
this.fileInfo = fileInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool IsFirstVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsMultiVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
[Flags]
|
||||
public enum Options
|
||||
{
|
||||
/// <summary>
|
||||
/// No options specified
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// SharpCompress will keep the supplied streams open
|
||||
/// </summary>
|
||||
KeepStreamsOpen = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Look for RarArchive (Check for self-extracting archives or cases where RarArchive isn't at the start of the file)
|
||||
/// </summary>
|
||||
LookForHeader = 2,
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Rar.Headers
|
||||
{
|
||||
internal class MarkHeader : RarHeader
|
||||
{
|
||||
protected override void ReadFromReader(MarkingBinaryReader reader)
|
||||
{
|
||||
}
|
||||
|
||||
internal bool IsValid()
|
||||
{
|
||||
if (!(HeadCRC == 0x6152))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(HeaderType == HeaderType.MarkHeader))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(Flags == 0x1a21))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(HeaderSize == BaseBlockSize))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool IsSignature()
|
||||
{
|
||||
bool valid = false;
|
||||
/*byte[] d = new byte[BaseBlock.BaseBlockSize];
|
||||
BinaryWriter writer = new BinaryWriter();
|
||||
writer.Write(HeadCRC);
|
||||
writer.Write((byte)HeaderType);
|
||||
writer.Write(flags);
|
||||
writer.Write(HeaderSize);
|
||||
writer.Flush
|
||||
|
||||
if (d[0] == 0x52) {
|
||||
if (d[1]==0x45 && d[2]==0x7e && d[3]==0x5e) {
|
||||
oldFormat=true;
|
||||
valid=true;
|
||||
}
|
||||
else if (d[1]==0x61 && d[2]==0x72 && d[3]==0x21 && d[4]==0x1a &&
|
||||
d[5]==0x07 && d[6]==0x00) {
|
||||
oldFormat=false;
|
||||
valid=true;
|
||||
}
|
||||
}*/
|
||||
return valid;
|
||||
}
|
||||
|
||||
internal bool OldFormat { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCompress.Common.Rar
|
||||
{
|
||||
internal class RarRijndael : IDisposable
|
||||
{
|
||||
internal const int CRYPTO_BLOCK_SIZE = 16;
|
||||
private readonly string password;
|
||||
private readonly byte[] salt;
|
||||
private byte[] aesInitializationVector;
|
||||
private Rijndael rijndael;
|
||||
|
||||
private RarRijndael(string password, byte[] salt)
|
||||
{
|
||||
this.password = password;
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
|
||||
rijndael = new RijndaelManaged() { Padding = PaddingMode.None };
|
||||
aesInitializationVector = new byte[CRYPTO_BLOCK_SIZE];
|
||||
int rawLength = 2 * password.Length;
|
||||
byte[] rawPassword = new byte[rawLength + 8];
|
||||
byte[] passwordBytes = Encoding.Unicode.GetBytes(password);
|
||||
for (int i = 0; i < rawLength; i++)
|
||||
{
|
||||
rawPassword[i] = passwordBytes[i];
|
||||
}
|
||||
for (int i = 0; i < salt.Length; i++)
|
||||
{
|
||||
rawPassword[i + rawLength] = salt[i];
|
||||
}
|
||||
|
||||
SHA1 sha = new SHA1CryptoServiceProvider();
|
||||
|
||||
const int noOfRounds = (1 << 18);
|
||||
IList<byte> bytes = new List<byte>();
|
||||
byte[] digest;
|
||||
|
||||
//TODO slow code below, find ways to optimize
|
||||
for (int i = 0; i < noOfRounds; i++)
|
||||
{
|
||||
bytes.AddRange(rawPassword);
|
||||
|
||||
bytes.AddRange(new[] { (byte)i, (byte)(i >> 8), (byte)(i >> CRYPTO_BLOCK_SIZE) });
|
||||
if (i % (noOfRounds / CRYPTO_BLOCK_SIZE) == 0)
|
||||
{
|
||||
digest = sha.ComputeHash(bytes.ToArray());
|
||||
aesInitializationVector[i / (noOfRounds / CRYPTO_BLOCK_SIZE)] = digest[19];
|
||||
}
|
||||
}
|
||||
|
||||
digest = sha.ComputeHash(bytes.ToArray());
|
||||
//slow code ends
|
||||
|
||||
byte[] aesKey = new byte[CRYPTO_BLOCK_SIZE];
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
aesKey[i * 4 + j] = (byte)
|
||||
(((digest[i * 4] * 0x1000000) & 0xff000000 |
|
||||
(uint)((digest[i * 4 + 1] * 0x10000) & 0xff0000) |
|
||||
(uint)((digest[i * 4 + 2] * 0x100) & 0xff00) |
|
||||
(uint)(digest[i * 4 + 3] & 0xff)) >> (j * 8));
|
||||
|
||||
rijndael.IV = new byte[CRYPTO_BLOCK_SIZE];
|
||||
rijndael.Key = aesKey;
|
||||
rijndael.BlockSize = CRYPTO_BLOCK_SIZE * 8;
|
||||
|
||||
}
|
||||
|
||||
public static RarRijndael InitializeFrom(string password, byte[] salt)
|
||||
{
|
||||
var rijndael = new RarRijndael(password, salt);
|
||||
rijndael.Initialize();
|
||||
return rijndael;
|
||||
}
|
||||
|
||||
public byte[] ProcessBlock(byte[] cipherText)
|
||||
{
|
||||
var plainText = new byte[CRYPTO_BLOCK_SIZE];
|
||||
var decryptedBytes = new List<byte>();
|
||||
var decryptor = rijndael.CreateDecryptor();
|
||||
using (var msDecrypt = new MemoryStream(cipherText))
|
||||
{
|
||||
using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
|
||||
{
|
||||
csDecrypt.ReadFully(plainText);
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < plainText.Length; j++)
|
||||
decryptedBytes.Add((byte)(plainText[j] ^ aesInitializationVector[j % 16])); //32:114, 33:101
|
||||
|
||||
for (int j = 0; j < aesInitializationVector.Length; j++)
|
||||
aesInitializationVector[j] = cipherText[j];
|
||||
return decryptedBytes.ToArray();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
((IDisposable)rijndael).Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
public class ReaderExtractionEventArgs<T> : EventArgs
|
||||
{
|
||||
internal ReaderExtractionEventArgs(T entry)
|
||||
{
|
||||
Item = entry;
|
||||
}
|
||||
public T Item { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SharpCompress.Common.SevenZip
|
||||
{
|
||||
public class SevenZipEntry : Entry
|
||||
{
|
||||
internal SevenZipEntry(SevenZipFilePart filePart)
|
||||
{
|
||||
this.FilePart = filePart;
|
||||
}
|
||||
|
||||
internal SevenZipFilePart FilePart { get; private set; }
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get { return FilePart.CompressionType; }
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return FilePart.Header.Crc ?? 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return FilePart.Header.Name; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return (long) FilePart.Header.Size; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return FilePart.Header.MTime; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return FilePart.Header.IsDir; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override int? Attrib
|
||||
{
|
||||
get { return (int) FilePart.Header.Attrib; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return FilePart.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.SevenZip
|
||||
{
|
||||
public class SevenZipVolume : Volume
|
||||
{
|
||||
public SevenZipVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Tar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Tar
|
||||
{
|
||||
public class TarEntry : Entry
|
||||
{
|
||||
private readonly TarFilePart filePart;
|
||||
private readonly CompressionType type;
|
||||
|
||||
internal TarEntry(TarFilePart filePart, CompressionType type)
|
||||
{
|
||||
this.filePart = filePart;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get { return type; }
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return filePart.Header.Name; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return filePart.Header.Size; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return filePart.Header.Size; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return filePart.Header.LastModifiedTime; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return filePart.Header.EntryType == EntryType.Directory; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return filePart.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
|
||||
internal static IEnumerable<TarEntry> GetEntries(StreamingMode mode, Stream stream,
|
||||
CompressionType compressionType)
|
||||
{
|
||||
foreach (TarHeader h in TarHeaderFactory.ReadHeader(mode, stream))
|
||||
{
|
||||
if (h != null)
|
||||
{
|
||||
if (mode == StreamingMode.Seekable)
|
||||
{
|
||||
yield return new TarEntry(new TarFilePart(h, stream), compressionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return new TarEntry(new TarFilePart(h, null), compressionType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Tar.Headers;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Tar
|
||||
{
|
||||
internal class TarFilePart : FilePart
|
||||
{
|
||||
private readonly Stream seekableStream;
|
||||
|
||||
internal TarFilePart(TarHeader header, Stream seekableStream)
|
||||
{
|
||||
this.seekableStream = seekableStream;
|
||||
Header = header;
|
||||
}
|
||||
|
||||
internal TarHeader Header { get; private set; }
|
||||
|
||||
internal override string FilePartName
|
||||
{
|
||||
get { return Header.Name; }
|
||||
}
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
if (seekableStream != null)
|
||||
{
|
||||
seekableStream.Position = Header.DataStartPosition.Value;
|
||||
return new ReadOnlySubStream(seekableStream, Header.Size);
|
||||
}
|
||||
return Header.PackedStream;
|
||||
}
|
||||
|
||||
internal override Stream GetRawStream()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.Tar
|
||||
{
|
||||
public class TarVolume : Volume
|
||||
{
|
||||
public TarVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace SharpCompress.Common.Zip.Headers
|
||||
{
|
||||
internal class LocalEntryHeader : ZipFileEntry
|
||||
{
|
||||
public LocalEntryHeader()
|
||||
: base(ZipHeaderType.LocalEntry)
|
||||
{
|
||||
}
|
||||
|
||||
internal override void Read(BinaryReader reader)
|
||||
{
|
||||
Version = reader.ReadUInt16();
|
||||
Flags = (HeaderFlags) reader.ReadUInt16();
|
||||
CompressionMethod = (ZipCompressionMethod) reader.ReadUInt16();
|
||||
LastModifiedTime = reader.ReadUInt16();
|
||||
LastModifiedDate = reader.ReadUInt16();
|
||||
Crc = reader.ReadUInt32();
|
||||
CompressedSize = reader.ReadUInt32();
|
||||
UncompressedSize = reader.ReadUInt32();
|
||||
ushort nameLength = reader.ReadUInt16();
|
||||
ushort extraLength = reader.ReadUInt16();
|
||||
byte[] name = reader.ReadBytes(nameLength);
|
||||
byte[] extra = reader.ReadBytes(extraLength);
|
||||
Name = DecodeString(name);
|
||||
LoadExtra(extra);
|
||||
|
||||
var unicodePathExtra = Extra.FirstOrDefault(u => u.Type == ExtraDataType.UnicodePathExtraField);
|
||||
if (unicodePathExtra!=null)
|
||||
{
|
||||
Name = ((ExtraUnicodePathExtraField) unicodePathExtra).UnicodeName;
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Write(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(Version);
|
||||
writer.Write((ushort) Flags);
|
||||
writer.Write((ushort) CompressionMethod);
|
||||
writer.Write(LastModifiedTime);
|
||||
writer.Write(LastModifiedDate);
|
||||
writer.Write(Crc);
|
||||
writer.Write(CompressedSize);
|
||||
writer.Write(UncompressedSize);
|
||||
|
||||
byte[] nameBytes = EncodeString(Name);
|
||||
|
||||
writer.Write((ushort) nameBytes.Length);
|
||||
writer.Write((ushort) 0);
|
||||
//if (Extra != null)
|
||||
//{
|
||||
// writer.Write(Extra);
|
||||
//}
|
||||
writer.Write(nameBytes);
|
||||
}
|
||||
|
||||
internal ushort Version { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCompress.Common.Zip.Headers
|
||||
{
|
||||
internal enum ExtraDataType : ushort
|
||||
{
|
||||
WinZipAes = 0x9901,
|
||||
|
||||
NotImplementedExtraData = 0xFFFF,
|
||||
// Third Party Mappings
|
||||
// -Info-ZIP Unicode Path Extra Field
|
||||
UnicodePathExtraField = 0x7075
|
||||
}
|
||||
|
||||
internal class ExtraData
|
||||
{
|
||||
internal ExtraDataType Type { get; set; }
|
||||
internal ushort Length { get; set; }
|
||||
internal byte[] DataBytes { get; set; }
|
||||
}
|
||||
|
||||
internal class ExtraUnicodePathExtraField : ExtraData
|
||||
{
|
||||
internal byte Version
|
||||
{
|
||||
get { return this.DataBytes[0]; }
|
||||
}
|
||||
|
||||
internal byte[] NameCRC32
|
||||
{
|
||||
get
|
||||
{
|
||||
var crc = new byte[4];
|
||||
Buffer.BlockCopy(this.DataBytes, 1, crc, 0, 4);
|
||||
return crc;
|
||||
}
|
||||
}
|
||||
|
||||
internal string UnicodeName
|
||||
{
|
||||
get
|
||||
{
|
||||
// PathNamelength = dataLength - Version(1 byte) - NameCRC32(4 bytes)
|
||||
var length = this.Length - 5;
|
||||
var nameStr = Encoding.UTF8.GetString(this.DataBytes, 5, length);
|
||||
return nameStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static class LocalEntryHeaderExtraFactory
|
||||
{
|
||||
internal static ExtraData Create(ExtraDataType type,ushort length, byte[] extraData)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ExtraDataType.UnicodePathExtraField:
|
||||
return new ExtraUnicodePathExtraField()
|
||||
{
|
||||
Type = type,
|
||||
Length = length,
|
||||
DataBytes = extraData
|
||||
};
|
||||
default:
|
||||
return new ExtraData
|
||||
{
|
||||
Type = type,
|
||||
Length = length,
|
||||
DataBytes = extraData
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCompress.Common.Zip.Headers
|
||||
{
|
||||
internal abstract class ZipFileEntry : ZipHeader
|
||||
{
|
||||
protected ZipFileEntry(ZipHeaderType type)
|
||||
: base(type)
|
||||
{
|
||||
Extra = new List<ExtraData>();
|
||||
}
|
||||
|
||||
internal bool IsDirectory
|
||||
{
|
||||
get { return Name.EndsWith("/"); }
|
||||
}
|
||||
|
||||
protected string DecodeString(byte[] str)
|
||||
{
|
||||
if (FlagUtility.HasFlag(Flags, HeaderFlags.UTF8))
|
||||
{
|
||||
return Encoding.UTF8.GetString(str, 0, str.Length);
|
||||
}
|
||||
|
||||
return ArchiveEncoding.Default.GetString(str, 0, str.Length);
|
||||
}
|
||||
|
||||
protected byte[] EncodeString(string str)
|
||||
{
|
||||
if (FlagUtility.HasFlag(Flags, HeaderFlags.UTF8))
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(str);
|
||||
}
|
||||
return ArchiveEncoding.Default.GetBytes(str);
|
||||
}
|
||||
|
||||
internal Stream PackedStream { get; set; }
|
||||
|
||||
internal string Name { get; set; }
|
||||
|
||||
internal HeaderFlags Flags { get; set; }
|
||||
|
||||
internal ZipCompressionMethod CompressionMethod { get; set; }
|
||||
|
||||
internal uint CompressedSize { get; set; }
|
||||
|
||||
internal long? DataStartPosition { get; set; }
|
||||
|
||||
internal uint UncompressedSize { get; set; }
|
||||
|
||||
internal List<ExtraData> Extra { get; set; }
|
||||
|
||||
internal PkwareTraditionalEncryptionData PkwareTraditionalEncryptionData { get; set; }
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
internal WinzipAesEncryptionData WinzipAesEncryptionData { get; set; }
|
||||
#endif
|
||||
|
||||
internal ushort LastModifiedDate { get; set; }
|
||||
|
||||
internal ushort LastModifiedTime { get; set; }
|
||||
|
||||
internal uint Crc { get; set; }
|
||||
|
||||
protected void LoadExtra(byte[] extra)
|
||||
{
|
||||
for (int i = 0; i < extra.Length-4;)
|
||||
{
|
||||
ExtraDataType type = (ExtraDataType) BitConverter.ToUInt16(extra, i);
|
||||
if (!Enum.IsDefined(typeof (ExtraDataType), type))
|
||||
{
|
||||
type = ExtraDataType.NotImplementedExtraData;
|
||||
}
|
||||
|
||||
ushort length = BitConverter.ToUInt16(extra, i + 2);
|
||||
byte[] data = new byte[length];
|
||||
Buffer.BlockCopy(extra, i + 4, data, 0, length);
|
||||
Extra.Add(LocalEntryHeaderExtraFactory.Create(type,length,data));
|
||||
|
||||
i += length + 4;
|
||||
}
|
||||
}
|
||||
|
||||
internal ZipFilePart Part { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Engines;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace SharpCompress.Common.Zip
|
||||
{
|
||||
internal class WinzipAesCryptoStream : Stream
|
||||
{
|
||||
private const int BLOCK_SIZE_IN_BYTES = 16;
|
||||
private readonly IBufferedCipher rijndael;
|
||||
private readonly byte[] counter = new byte[BLOCK_SIZE_IN_BYTES];
|
||||
private readonly Stream stream;
|
||||
private int nonce = 1;
|
||||
private byte[] counterOut = new byte[BLOCK_SIZE_IN_BYTES];
|
||||
private bool isFinalBlock;
|
||||
private long totalBytesLeftToRead;
|
||||
private bool isDisposed;
|
||||
|
||||
internal WinzipAesCryptoStream(Stream stream, WinzipAesEncryptionData winzipAesEncryptionData, long length)
|
||||
{
|
||||
this.stream = stream;
|
||||
totalBytesLeftToRead = length;
|
||||
|
||||
rijndael = CreateRijndael(winzipAesEncryptionData);
|
||||
}
|
||||
|
||||
private IBufferedCipher CreateRijndael(WinzipAesEncryptionData winzipAesEncryptionData)
|
||||
{
|
||||
var blockCipher = new BufferedBlockCipher(new RijndaelEngine());
|
||||
var param = new KeyParameter(winzipAesEncryptionData.KeyBytes);
|
||||
blockCipher.Init(true, param);
|
||||
return blockCipher;
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
isDisposed = true;
|
||||
if (disposing)
|
||||
{
|
||||
//read out last 10 auth bytes
|
||||
var ten = new byte[10];
|
||||
stream.Read(ten, 0, 10);
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (totalBytesLeftToRead == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int bytesToRead = count;
|
||||
if (count > totalBytesLeftToRead)
|
||||
{
|
||||
bytesToRead = (int)totalBytesLeftToRead;
|
||||
}
|
||||
int read = stream.Read(buffer, offset, bytesToRead);
|
||||
totalBytesLeftToRead -= read;
|
||||
|
||||
ReadTransformBlocks(buffer, offset, read);
|
||||
|
||||
return read;
|
||||
}
|
||||
|
||||
private int ReadTransformOneBlock(byte[] buffer, int offset, int last)
|
||||
{
|
||||
if (isFinalBlock)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
int bytesRemaining = last - offset;
|
||||
int bytesToRead = (bytesRemaining > BLOCK_SIZE_IN_BYTES)
|
||||
? BLOCK_SIZE_IN_BYTES
|
||||
: bytesRemaining;
|
||||
|
||||
// update the counter
|
||||
Array.Copy(BitConverter.GetBytes(nonce++), 0, counter, 0, 4);
|
||||
|
||||
// Determine if this is the final block
|
||||
if ((bytesToRead == bytesRemaining) && (totalBytesLeftToRead == 0))
|
||||
{
|
||||
counterOut = rijndael.DoFinal(counter, 0, BLOCK_SIZE_IN_BYTES);
|
||||
|
||||
isFinalBlock = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rijndael.ProcessBytes(counter, 0, BLOCK_SIZE_IN_BYTES, counterOut, 0);
|
||||
}
|
||||
XorInPlace(buffer, offset, bytesToRead);
|
||||
return bytesToRead;
|
||||
}
|
||||
|
||||
|
||||
private void XorInPlace(byte[] buffer, int offset, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
buffer[offset + i] = (byte)(counterOut[i] ^ buffer[offset + i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadTransformBlocks(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int posn = offset;
|
||||
int last = count + offset;
|
||||
|
||||
while (posn < buffer.Length && posn < last)
|
||||
{
|
||||
int n = ReadTransformOneBlock(buffer, posn, last);
|
||||
posn += n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SharpCompress.Crypto;
|
||||
|
||||
namespace SharpCompress.Common.Zip
|
||||
{
|
||||
internal class WinzipAesEncryptionData
|
||||
{
|
||||
private const int RFC2898_ITERATIONS = 1000;
|
||||
|
||||
private byte[] salt;
|
||||
private WinzipAesKeySize keySize;
|
||||
private byte[] passwordVerifyValue;
|
||||
private string password;
|
||||
|
||||
private byte[] generatedVerifyValue;
|
||||
|
||||
internal WinzipAesEncryptionData(WinzipAesKeySize keySize, byte[] salt, byte[] passwordVerifyValue,
|
||||
string password)
|
||||
{
|
||||
this.keySize = keySize;
|
||||
this.salt = salt;
|
||||
this.passwordVerifyValue = passwordVerifyValue;
|
||||
this.password = password;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
internal byte[] IvBytes { get; set; }
|
||||
internal byte[] KeyBytes { get; set; }
|
||||
|
||||
private int KeySizeInBytes
|
||||
{
|
||||
get { return KeyLengthInBytes(keySize); }
|
||||
}
|
||||
|
||||
internal static int KeyLengthInBytes(WinzipAesKeySize keySize)
|
||||
{
|
||||
switch (keySize)
|
||||
{
|
||||
case WinzipAesKeySize.KeySize128:
|
||||
return 16;
|
||||
case WinzipAesKeySize.KeySize192:
|
||||
return 24;
|
||||
case WinzipAesKeySize.KeySize256:
|
||||
return 32;
|
||||
}
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
var utf8 = new UTF8Encoding(false);
|
||||
var paramz = new PBKDF2(utf8.GetBytes(password), salt, RFC2898_ITERATIONS);
|
||||
KeyBytes = paramz.GetBytes(KeySizeInBytes);
|
||||
IvBytes = paramz.GetBytes(KeySizeInBytes);
|
||||
generatedVerifyValue = paramz.GetBytes(2);
|
||||
|
||||
|
||||
short verify = BitConverter.ToInt16(passwordVerifyValue, 0);
|
||||
if (password != null)
|
||||
{
|
||||
short generated = BitConverter.ToInt16(generatedVerifyValue, 0);
|
||||
if (verify != generated)
|
||||
throw new InvalidFormatException("bad password");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SharpCompress.Common.Zip.Headers;
|
||||
|
||||
namespace SharpCompress.Common.Zip
|
||||
{
|
||||
public class ZipEntry : Entry
|
||||
{
|
||||
private readonly ZipFilePart filePart;
|
||||
private readonly DateTime? lastModifiedTime;
|
||||
|
||||
internal ZipEntry(ZipFilePart filePart)
|
||||
{
|
||||
if (filePart != null)
|
||||
{
|
||||
this.filePart = filePart;
|
||||
lastModifiedTime = Utility.DosDateToDateTime(filePart.Header.LastModifiedDate,
|
||||
filePart.Header.LastModifiedTime);
|
||||
}
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (filePart.Header.CompressionMethod)
|
||||
{
|
||||
case ZipCompressionMethod.BZip2:
|
||||
{
|
||||
return CompressionType.BZip2;
|
||||
}
|
||||
case ZipCompressionMethod.Deflate:
|
||||
{
|
||||
return CompressionType.Deflate;
|
||||
}
|
||||
case ZipCompressionMethod.LZMA:
|
||||
{
|
||||
return CompressionType.LZMA;
|
||||
}
|
||||
case ZipCompressionMethod.PPMd:
|
||||
{
|
||||
return CompressionType.PPMd;
|
||||
}
|
||||
case ZipCompressionMethod.None:
|
||||
{
|
||||
return CompressionType.None;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return CompressionType.Unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override long Crc
|
||||
{
|
||||
get { return filePart.Header.Crc; }
|
||||
}
|
||||
|
||||
public override string Key
|
||||
{
|
||||
get { return filePart.Header.Name; }
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return filePart.Header.CompressedSize; }
|
||||
}
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get { return filePart.Header.UncompressedSize; }
|
||||
}
|
||||
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return lastModifiedTime; }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return FlagUtility.HasFlag(filePart.Header.Flags, HeaderFlags.Encrypted); }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return filePart.Header.IsDirectory; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return filePart.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common.Zip.Headers;
|
||||
using SharpCompress.Compressor;
|
||||
using SharpCompress.Compressor.BZip2;
|
||||
using SharpCompress.Compressor.Deflate;
|
||||
using SharpCompress.Compressor.LZMA;
|
||||
using SharpCompress.Compressor.PPMd;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Common.Zip
|
||||
{
|
||||
internal abstract class ZipFilePart : FilePart
|
||||
{
|
||||
internal ZipFilePart(ZipFileEntry header, Stream stream)
|
||||
{
|
||||
Header = header;
|
||||
header.Part = this;
|
||||
this.BaseStream = stream;
|
||||
}
|
||||
|
||||
internal Stream BaseStream { get; private set; }
|
||||
internal ZipFileEntry Header { get; set; }
|
||||
|
||||
|
||||
internal override string FilePartName
|
||||
{
|
||||
get { return Header.Name; }
|
||||
}
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
if (!Header.HasData)
|
||||
{
|
||||
return Stream.Null;
|
||||
}
|
||||
Stream decompressionStream = CreateDecompressionStream(GetCryptoStream(CreateBaseStream()));
|
||||
if (LeaveStreamOpen)
|
||||
{
|
||||
return new NonDisposingStream(decompressionStream);
|
||||
}
|
||||
return decompressionStream;
|
||||
}
|
||||
|
||||
internal override Stream GetRawStream()
|
||||
{
|
||||
if (!Header.HasData)
|
||||
{
|
||||
return Stream.Null;
|
||||
}
|
||||
return CreateBaseStream();
|
||||
}
|
||||
|
||||
protected abstract Stream CreateBaseStream();
|
||||
|
||||
protected bool LeaveStreamOpen
|
||||
{
|
||||
get { return FlagUtility.HasFlag(Header.Flags, HeaderFlags.UsePostDataDescriptor); }
|
||||
}
|
||||
|
||||
protected Stream CreateDecompressionStream(Stream stream)
|
||||
{
|
||||
switch (Header.CompressionMethod)
|
||||
{
|
||||
case ZipCompressionMethod.None:
|
||||
{
|
||||
return stream;
|
||||
}
|
||||
case ZipCompressionMethod.Deflate:
|
||||
{
|
||||
return new DeflateStream(stream, CompressionMode.Decompress);
|
||||
}
|
||||
case ZipCompressionMethod.BZip2:
|
||||
{
|
||||
return new BZip2Stream(stream, CompressionMode.Decompress);
|
||||
}
|
||||
case ZipCompressionMethod.LZMA:
|
||||
{
|
||||
if (FlagUtility.HasFlag(Header.Flags, HeaderFlags.Encrypted))
|
||||
{
|
||||
throw new NotSupportedException("LZMA with pkware encryption.");
|
||||
}
|
||||
var reader = new BinaryReader(stream);
|
||||
reader.ReadUInt16(); //LZMA version
|
||||
var props = new byte[reader.ReadUInt16()];
|
||||
reader.Read(props, 0, props.Length);
|
||||
return new LzmaStream(props, stream,
|
||||
Header.CompressedSize > 0 ? Header.CompressedSize - 4 - props.Length : -1,
|
||||
FlagUtility.HasFlag(Header.Flags, HeaderFlags.Bit1)
|
||||
? -1
|
||||
: (long)Header.UncompressedSize);
|
||||
}
|
||||
case ZipCompressionMethod.PPMd:
|
||||
{
|
||||
var props = new byte[2];
|
||||
stream.Read(props, 0, props.Length);
|
||||
return new PpmdStream(new PpmdProperties(props), stream, false);
|
||||
}
|
||||
case ZipCompressionMethod.WinzipAes:
|
||||
{
|
||||
ExtraData data = Header.Extra.Where(x => x.Type == ExtraDataType.WinZipAes).SingleOrDefault();
|
||||
if (data == null)
|
||||
{
|
||||
throw new InvalidFormatException("No Winzip AES extra data found.");
|
||||
}
|
||||
if (data.Length != 7)
|
||||
{
|
||||
throw new InvalidFormatException("Winzip data length is not 7.");
|
||||
}
|
||||
ushort method = BitConverter.ToUInt16(data.DataBytes, 0);
|
||||
|
||||
if (method != 0x01 && method != 0x02)
|
||||
{
|
||||
throw new InvalidFormatException("Unexpected vendor version number for WinZip AES metadata");
|
||||
}
|
||||
|
||||
ushort vendorId = BitConverter.ToUInt16(data.DataBytes, 2);
|
||||
if (vendorId != 0x4541)
|
||||
{
|
||||
throw new InvalidFormatException("Unexpected vendor ID for WinZip AES metadata");
|
||||
}
|
||||
Header.CompressionMethod = (ZipCompressionMethod)BitConverter.ToUInt16(data.DataBytes, 5);
|
||||
return CreateDecompressionStream(stream);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException("CompressionMethod: " + Header.CompressionMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Stream GetCryptoStream(Stream plainStream)
|
||||
{
|
||||
if ((Header.CompressedSize == 0)
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
&& ((Header.PkwareTraditionalEncryptionData != null)
|
||||
|| (Header.WinzipAesEncryptionData != null)))
|
||||
#else
|
||||
&& (Header.PkwareTraditionalEncryptionData != null))
|
||||
#endif
|
||||
{
|
||||
throw new NotSupportedException("Cannot encrypt file with unknown size at start.");
|
||||
}
|
||||
if ((Header.CompressedSize == 0)
|
||||
&& FlagUtility.HasFlag(Header.Flags, HeaderFlags.UsePostDataDescriptor))
|
||||
{
|
||||
plainStream = new NonDisposingStream(plainStream); //make sure AES doesn't close
|
||||
}
|
||||
else
|
||||
{
|
||||
plainStream = new ReadOnlySubStream(plainStream, Header.CompressedSize); //make sure AES doesn't close
|
||||
}
|
||||
if (Header.PkwareTraditionalEncryptionData != null)
|
||||
{
|
||||
return new PkwareTraditionalCryptoStream(plainStream, Header.PkwareTraditionalEncryptionData,
|
||||
CryptoMode.Decrypt);
|
||||
}
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
if (Header.WinzipAesEncryptionData != null)
|
||||
{
|
||||
//only read 10 less because the last ten are auth bytes
|
||||
return new WinzipAesCryptoStream(plainStream, Header.WinzipAesEncryptionData, Header.CompressedSize - 10);
|
||||
}
|
||||
#endif
|
||||
return plainStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001,2004-2005 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This package is based on the work done by Keiron Liddle, Aftex Software
|
||||
* <keiron@aftexsw.com> to whom the Ant project is very grateful for his
|
||||
* great code.
|
||||
*/
|
||||
|
||||
namespace SharpCompress.Compressor.BZip2
|
||||
{
|
||||
/**
|
||||
* Base class for both the compress and decompress classes.
|
||||
* Holds common arrays, and static data.
|
||||
*
|
||||
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
|
||||
*/
|
||||
|
||||
internal class BZip2Constants
|
||||
{
|
||||
public const int baseBlockSize = 100000;
|
||||
public const int MAX_ALPHA_SIZE = 258;
|
||||
public const int MAX_CODE_LEN = 23;
|
||||
public const int RUNA = 0;
|
||||
public const int RUNB = 1;
|
||||
public const int N_GROUPS = 6;
|
||||
public const int G_SIZE = 50;
|
||||
public const int N_ITERS = 4;
|
||||
public const int MAX_SELECTORS = (2 + (900000/G_SIZE));
|
||||
public const int NUM_OVERSHOOT_BYTES = 20;
|
||||
|
||||
public static int[] rNums =
|
||||
{
|
||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
|
||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
|
||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
|
||||
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
|
||||
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
|
||||
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
|
||||
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
|
||||
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
|
||||
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
|
||||
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
|
||||
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
|
||||
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
|
||||
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
|
||||
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
|
||||
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
|
||||
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
|
||||
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
|
||||
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
|
||||
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
|
||||
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
|
||||
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
|
||||
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
|
||||
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
|
||||
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
|
||||
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
|
||||
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
|
||||
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
|
||||
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
|
||||
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
|
||||
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
|
||||
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
|
||||
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
|
||||
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
|
||||
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
|
||||
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
|
||||
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
|
||||
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
|
||||
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
|
||||
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
|
||||
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
|
||||
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
|
||||
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
|
||||
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
|
||||
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
|
||||
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
|
||||
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
|
||||
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
|
||||
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
|
||||
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
|
||||
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
|
||||
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
|
||||
936, 638
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001,2004-2005 The Apache Software Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This package is based on the work done by Keiron Liddle), Aftex Software
|
||||
* <keiron@aftexsw.com> to whom the Ant project is very grateful for his
|
||||
* great code.
|
||||
*/
|
||||
|
||||
namespace SharpCompress.Compressor.BZip2
|
||||
{
|
||||
/**
|
||||
* A simple class the hold and calculate the CRC for sanity checking
|
||||
* of the data.
|
||||
*
|
||||
* @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
|
||||
*/
|
||||
|
||||
internal class CRC
|
||||
{
|
||||
public static int[] crc32Table =
|
||||
{
|
||||
unchecked((int) 0x00000000), unchecked((int) 0x04c11db7), unchecked((int) 0x09823b6e),
|
||||
unchecked((int) 0x0d4326d9),
|
||||
unchecked((int) 0x130476dc), unchecked((int) 0x17c56b6b), unchecked((int) 0x1a864db2),
|
||||
unchecked((int) 0x1e475005),
|
||||
unchecked((int) 0x2608edb8), unchecked((int) 0x22c9f00f), unchecked((int) 0x2f8ad6d6),
|
||||
unchecked((int) 0x2b4bcb61),
|
||||
unchecked((int) 0x350c9b64), unchecked((int) 0x31cd86d3), unchecked((int) 0x3c8ea00a),
|
||||
unchecked((int) 0x384fbdbd),
|
||||
unchecked((int) 0x4c11db70), unchecked((int) 0x48d0c6c7), unchecked((int) 0x4593e01e),
|
||||
unchecked((int) 0x4152fda9),
|
||||
unchecked((int) 0x5f15adac), unchecked((int) 0x5bd4b01b), unchecked((int) 0x569796c2),
|
||||
unchecked((int) 0x52568b75),
|
||||
unchecked((int) 0x6a1936c8), unchecked((int) 0x6ed82b7f), unchecked((int) 0x639b0da6),
|
||||
unchecked((int) 0x675a1011),
|
||||
unchecked((int) 0x791d4014), unchecked((int) 0x7ddc5da3), unchecked((int) 0x709f7b7a),
|
||||
unchecked((int) 0x745e66cd),
|
||||
unchecked((int) 0x9823b6e0), unchecked((int) 0x9ce2ab57), unchecked((int) 0x91a18d8e),
|
||||
unchecked((int) 0x95609039),
|
||||
unchecked((int) 0x8b27c03c), unchecked((int) 0x8fe6dd8b), unchecked((int) 0x82a5fb52),
|
||||
unchecked((int) 0x8664e6e5),
|
||||
unchecked((int) 0xbe2b5b58), unchecked((int) 0xbaea46ef), unchecked((int) 0xb7a96036),
|
||||
unchecked((int) 0xb3687d81),
|
||||
unchecked((int) 0xad2f2d84), unchecked((int) 0xa9ee3033), unchecked((int) 0xa4ad16ea),
|
||||
unchecked((int) 0xa06c0b5d),
|
||||
unchecked((int) 0xd4326d90), unchecked((int) 0xd0f37027), unchecked((int) 0xddb056fe),
|
||||
unchecked((int) 0xd9714b49),
|
||||
unchecked((int) 0xc7361b4c), unchecked((int) 0xc3f706fb), unchecked((int) 0xceb42022),
|
||||
unchecked((int) 0xca753d95),
|
||||
unchecked((int) 0xf23a8028), unchecked((int) 0xf6fb9d9f), unchecked((int) 0xfbb8bb46),
|
||||
unchecked((int) 0xff79a6f1),
|
||||
unchecked((int) 0xe13ef6f4), unchecked((int) 0xe5ffeb43), unchecked((int) 0xe8bccd9a),
|
||||
unchecked((int) 0xec7dd02d),
|
||||
unchecked((int) 0x34867077), unchecked((int) 0x30476dc0), unchecked((int) 0x3d044b19),
|
||||
unchecked((int) 0x39c556ae),
|
||||
unchecked((int) 0x278206ab), unchecked((int) 0x23431b1c), unchecked((int) 0x2e003dc5),
|
||||
unchecked((int) 0x2ac12072),
|
||||
unchecked((int) 0x128e9dcf), unchecked((int) 0x164f8078), unchecked((int) 0x1b0ca6a1),
|
||||
unchecked((int) 0x1fcdbb16),
|
||||
unchecked((int) 0x018aeb13), unchecked((int) 0x054bf6a4), unchecked((int) 0x0808d07d),
|
||||
unchecked((int) 0x0cc9cdca),
|
||||
unchecked((int) 0x7897ab07), unchecked((int) 0x7c56b6b0), unchecked((int) 0x71159069),
|
||||
unchecked((int) 0x75d48dde),
|
||||
unchecked((int) 0x6b93dddb), unchecked((int) 0x6f52c06c), unchecked((int) 0x6211e6b5),
|
||||
unchecked((int) 0x66d0fb02),
|
||||
unchecked((int) 0x5e9f46bf), unchecked((int) 0x5a5e5b08), unchecked((int) 0x571d7dd1),
|
||||
unchecked((int) 0x53dc6066),
|
||||
unchecked((int) 0x4d9b3063), unchecked((int) 0x495a2dd4), unchecked((int) 0x44190b0d),
|
||||
unchecked((int) 0x40d816ba),
|
||||
unchecked((int) 0xaca5c697), unchecked((int) 0xa864db20), unchecked((int) 0xa527fdf9),
|
||||
unchecked((int) 0xa1e6e04e),
|
||||
unchecked((int) 0xbfa1b04b), unchecked((int) 0xbb60adfc), unchecked((int) 0xb6238b25),
|
||||
unchecked((int) 0xb2e29692),
|
||||
unchecked((int) 0x8aad2b2f), unchecked((int) 0x8e6c3698), unchecked((int) 0x832f1041),
|
||||
unchecked((int) 0x87ee0df6),
|
||||
unchecked((int) 0x99a95df3), unchecked((int) 0x9d684044), unchecked((int) 0x902b669d),
|
||||
unchecked((int) 0x94ea7b2a),
|
||||
unchecked((int) 0xe0b41de7), unchecked((int) 0xe4750050), unchecked((int) 0xe9362689),
|
||||
unchecked((int) 0xedf73b3e),
|
||||
unchecked((int) 0xf3b06b3b), unchecked((int) 0xf771768c), unchecked((int) 0xfa325055),
|
||||
unchecked((int) 0xfef34de2),
|
||||
unchecked((int) 0xc6bcf05f), unchecked((int) 0xc27dede8), unchecked((int) 0xcf3ecb31),
|
||||
unchecked((int) 0xcbffd686),
|
||||
unchecked((int) 0xd5b88683), unchecked((int) 0xd1799b34), unchecked((int) 0xdc3abded),
|
||||
unchecked((int) 0xd8fba05a),
|
||||
unchecked((int) 0x690ce0ee), unchecked((int) 0x6dcdfd59), unchecked((int) 0x608edb80),
|
||||
unchecked((int) 0x644fc637),
|
||||
unchecked((int) 0x7a089632), unchecked((int) 0x7ec98b85), unchecked((int) 0x738aad5c),
|
||||
unchecked((int) 0x774bb0eb),
|
||||
unchecked((int) 0x4f040d56), unchecked((int) 0x4bc510e1), unchecked((int) 0x46863638),
|
||||
unchecked((int) 0x42472b8f),
|
||||
unchecked((int) 0x5c007b8a), unchecked((int) 0x58c1663d), unchecked((int) 0x558240e4),
|
||||
unchecked((int) 0x51435d53),
|
||||
unchecked((int) 0x251d3b9e), unchecked((int) 0x21dc2629), unchecked((int) 0x2c9f00f0),
|
||||
unchecked((int) 0x285e1d47),
|
||||
unchecked((int) 0x36194d42), unchecked((int) 0x32d850f5), unchecked((int) 0x3f9b762c),
|
||||
unchecked((int) 0x3b5a6b9b),
|
||||
unchecked((int) 0x0315d626), unchecked((int) 0x07d4cb91), unchecked((int) 0x0a97ed48),
|
||||
unchecked((int) 0x0e56f0ff),
|
||||
unchecked((int) 0x1011a0fa), unchecked((int) 0x14d0bd4d), unchecked((int) 0x19939b94),
|
||||
unchecked((int) 0x1d528623),
|
||||
unchecked((int) 0xf12f560e), unchecked((int) 0xf5ee4bb9), unchecked((int) 0xf8ad6d60),
|
||||
unchecked((int) 0xfc6c70d7),
|
||||
unchecked((int) 0xe22b20d2), unchecked((int) 0xe6ea3d65), unchecked((int) 0xeba91bbc),
|
||||
unchecked((int) 0xef68060b),
|
||||
unchecked((int) 0xd727bbb6), unchecked((int) 0xd3e6a601), unchecked((int) 0xdea580d8),
|
||||
unchecked((int) 0xda649d6f),
|
||||
unchecked((int) 0xc423cd6a), unchecked((int) 0xc0e2d0dd), unchecked((int) 0xcda1f604),
|
||||
unchecked((int) 0xc960ebb3),
|
||||
unchecked((int) 0xbd3e8d7e), unchecked((int) 0xb9ff90c9), unchecked((int) 0xb4bcb610),
|
||||
unchecked((int) 0xb07daba7),
|
||||
unchecked((int) 0xae3afba2), unchecked((int) 0xaafbe615), unchecked((int) 0xa7b8c0cc),
|
||||
unchecked((int) 0xa379dd7b),
|
||||
unchecked((int) 0x9b3660c6), unchecked((int) 0x9ff77d71), unchecked((int) 0x92b45ba8),
|
||||
unchecked((int) 0x9675461f),
|
||||
unchecked((int) 0x8832161a), unchecked((int) 0x8cf30bad), unchecked((int) 0x81b02d74),
|
||||
unchecked((int) 0x857130c3),
|
||||
unchecked((int) 0x5d8a9099), unchecked((int) 0x594b8d2e), unchecked((int) 0x5408abf7),
|
||||
unchecked((int) 0x50c9b640),
|
||||
unchecked((int) 0x4e8ee645), unchecked((int) 0x4a4ffbf2), unchecked((int) 0x470cdd2b),
|
||||
unchecked((int) 0x43cdc09c),
|
||||
unchecked((int) 0x7b827d21), unchecked((int) 0x7f436096), unchecked((int) 0x7200464f),
|
||||
unchecked((int) 0x76c15bf8),
|
||||
unchecked((int) 0x68860bfd), unchecked((int) 0x6c47164a), unchecked((int) 0x61043093),
|
||||
unchecked((int) 0x65c52d24),
|
||||
unchecked((int) 0x119b4be9), unchecked((int) 0x155a565e), unchecked((int) 0x18197087),
|
||||
unchecked((int) 0x1cd86d30),
|
||||
unchecked((int) 0x029f3d35), unchecked((int) 0x065e2082), unchecked((int) 0x0b1d065b),
|
||||
unchecked((int) 0x0fdc1bec),
|
||||
unchecked((int) 0x3793a651), unchecked((int) 0x3352bbe6), unchecked((int) 0x3e119d3f),
|
||||
unchecked((int) 0x3ad08088),
|
||||
unchecked((int) 0x2497d08d), unchecked((int) 0x2056cd3a), unchecked((int) 0x2d15ebe3),
|
||||
unchecked((int) 0x29d4f654),
|
||||
unchecked((int) 0xc5a92679), unchecked((int) 0xc1683bce), unchecked((int) 0xcc2b1d17),
|
||||
unchecked((int) 0xc8ea00a0),
|
||||
unchecked((int) 0xd6ad50a5), unchecked((int) 0xd26c4d12), unchecked((int) 0xdf2f6bcb),
|
||||
unchecked((int) 0xdbee767c),
|
||||
unchecked((int) 0xe3a1cbc1), unchecked((int) 0xe760d676), unchecked((int) 0xea23f0af),
|
||||
unchecked((int) 0xeee2ed18),
|
||||
unchecked((int) 0xf0a5bd1d), unchecked((int) 0xf464a0aa), unchecked((int) 0xf9278673),
|
||||
unchecked((int) 0xfde69bc4),
|
||||
unchecked((int) 0x89b8fd09), unchecked((int) 0x8d79e0be), unchecked((int) 0x803ac667),
|
||||
unchecked((int) 0x84fbdbd0),
|
||||
unchecked((int) 0x9abc8bd5), unchecked((int) 0x9e7d9662), unchecked((int) 0x933eb0bb),
|
||||
unchecked((int) 0x97ffad0c),
|
||||
unchecked((int) 0xafb010b1), unchecked((int) 0xab710d06), unchecked((int) 0xa6322bdf),
|
||||
unchecked((int) 0xa2f33668),
|
||||
unchecked((int) 0xbcb4666d), unchecked((int) 0xb8757bda), unchecked((int) 0xb5365d03),
|
||||
unchecked((int) 0xb1f740b4)
|
||||
};
|
||||
|
||||
public CRC()
|
||||
{
|
||||
InitialiseCRC();
|
||||
}
|
||||
|
||||
internal void InitialiseCRC()
|
||||
{
|
||||
globalCrc = unchecked((int) 0xffffffff);
|
||||
}
|
||||
|
||||
internal int GetFinalCRC()
|
||||
{
|
||||
return ~globalCrc;
|
||||
}
|
||||
|
||||
internal int GetGlobalCRC()
|
||||
{
|
||||
return globalCrc;
|
||||
}
|
||||
|
||||
internal void SetGlobalCRC(int newCrc)
|
||||
{
|
||||
globalCrc = newCrc;
|
||||
}
|
||||
|
||||
internal void UpdateCRC(int inCh)
|
||||
{
|
||||
int temp = (globalCrc >> 24) ^ inCh;
|
||||
if (temp < 0)
|
||||
{
|
||||
temp = 256 + temp;
|
||||
}
|
||||
globalCrc = (globalCrc << 8) ^ CRC.crc32Table[temp];
|
||||
}
|
||||
|
||||
internal int globalCrc;
|
||||
}
|
||||
}
|
||||
@@ -1,464 +0,0 @@
|
||||
// Tree.cs
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2009 Dino Chiesa and Microsoft Corporation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This code module is part of DotNetZip, a zipfile class library.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// See the file License.txt for the license details.
|
||||
// More info on: http://dotnetzip.codeplex.com
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// last saved (in emacs):
|
||||
// Time-stamp: <2009-October-28 13:29:50>
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// This module defines classes for zlib compression and
|
||||
// decompression. This code is derived from the jzlib implementation of
|
||||
// zlib. In keeping with the license for jzlib, the copyright to that
|
||||
// code is below.
|
||||
//
|
||||
// ------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in
|
||||
// the documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The names of the authors may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
|
||||
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
|
||||
// INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// This program is based on zlib-1.1.3; credit to authors
|
||||
// Jean-loup Gailly(jloup@gzip.org) and Mark Adler(madler@alumni.caltech.edu)
|
||||
// and contributors of zlib.
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
namespace SharpCompress.Compressor.Deflate
|
||||
{
|
||||
internal sealed partial class DeflateManager
|
||||
{
|
||||
#region Nested type: Tree
|
||||
|
||||
private sealed class Tree
|
||||
{
|
||||
internal const int Buf_size = 8*2;
|
||||
private static readonly int HEAP_SIZE = (2*InternalConstants.L_CODES + 1);
|
||||
|
||||
|
||||
internal static readonly sbyte[] bl_order = new sbyte[]
|
||||
{
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2,
|
||||
14,
|
||||
1, 15
|
||||
};
|
||||
|
||||
|
||||
// The lengths of the bit length codes are sent in order of decreasing
|
||||
// probability, to avoid transmitting the lengths for unused bit
|
||||
// length codes.
|
||||
|
||||
// see definition of array dist_code below
|
||||
//internal const int DIST_CODE_LEN = 512;
|
||||
|
||||
private static readonly sbyte[] _dist_code = new sbyte[]
|
||||
{
|
||||
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10,
|
||||
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11,
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||
12, 12,
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||
12, 12,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15,
|
||||
0, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21,
|
||||
21, 21,
|
||||
22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23,
|
||||
23, 23,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
|
||||
25, 25,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29
|
||||
};
|
||||
|
||||
internal static readonly sbyte[] LengthCode = new sbyte[]
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11,
|
||||
12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15
|
||||
, 15, 15,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17
|
||||
, 17, 17,
|
||||
18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19
|
||||
, 19, 19,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
, 20, 20,
|
||||
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21
|
||||
, 21, 21,
|
||||
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22
|
||||
, 22, 22,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23
|
||||
, 23, 23,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24
|
||||
, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24
|
||||
, 24, 24,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25
|
||||
, 25, 25,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25
|
||||
, 25, 25,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26
|
||||
, 26, 26,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26
|
||||
, 26, 26,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27
|
||||
, 27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27
|
||||
, 27, 28
|
||||
};
|
||||
|
||||
|
||||
internal static readonly int[] LengthBase = new[]
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28,
|
||||
32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0
|
||||
};
|
||||
|
||||
|
||||
internal static readonly int[] DistanceBase = new[]
|
||||
{
|
||||
0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128,
|
||||
192,
|
||||
256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144
|
||||
, 8192, 12288, 16384, 24576
|
||||
};
|
||||
|
||||
|
||||
internal short[] dyn_tree; // the dynamic tree
|
||||
internal int max_code; // largest code with non zero frequency
|
||||
internal StaticTree staticTree; // the corresponding static tree
|
||||
|
||||
/// <summary>
|
||||
/// Map from a distance to a distance code.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// No side effects. _dist_code[256] and _dist_code[257] are never used.
|
||||
/// </remarks>
|
||||
internal static int DistanceCode(int dist)
|
||||
{
|
||||
return (dist < 256)
|
||||
? _dist_code[dist]
|
||||
: _dist_code[256 + SharedUtils.URShift(dist, 7)];
|
||||
}
|
||||
|
||||
// Compute the optimal bit lengths for a tree and update the total bit length
|
||||
// for the current block.
|
||||
// IN assertion: the fields freq and dad are set, heap[heap_max] and
|
||||
// above are the tree nodes sorted by increasing frequency.
|
||||
// OUT assertions: the field len is set to the optimal bit length, the
|
||||
// array bl_count contains the frequencies for each bit length.
|
||||
// The length opt_len is updated; static_len is also updated if stree is
|
||||
// not null.
|
||||
internal void gen_bitlen(DeflateManager s)
|
||||
{
|
||||
short[] tree = dyn_tree;
|
||||
short[] stree = staticTree.treeCodes;
|
||||
int[] extra = staticTree.extraBits;
|
||||
int base_Renamed = staticTree.extraBase;
|
||||
int max_length = staticTree.maxLength;
|
||||
int h; // heap index
|
||||
int n, m; // iterate over the tree elements
|
||||
int bits; // bit length
|
||||
int xbits; // extra bits
|
||||
short f; // frequency
|
||||
int overflow = 0; // number of elements with bit length too large
|
||||
|
||||
for (bits = 0; bits <= InternalConstants.MAX_BITS; bits++)
|
||||
s.bl_count[bits] = 0;
|
||||
|
||||
// In a first pass, compute the optimal bit lengths (which may
|
||||
// overflow in the case of the bit length tree).
|
||||
tree[s.heap[s.heap_max]*2 + 1] = 0; // root of the heap
|
||||
|
||||
for (h = s.heap_max + 1; h < HEAP_SIZE; h++)
|
||||
{
|
||||
n = s.heap[h];
|
||||
bits = tree[tree[n*2 + 1]*2 + 1] + 1;
|
||||
if (bits > max_length)
|
||||
{
|
||||
bits = max_length;
|
||||
overflow++;
|
||||
}
|
||||
tree[n*2 + 1] = (short) bits;
|
||||
// We overwrite tree[n*2+1] which is no longer needed
|
||||
|
||||
if (n > max_code)
|
||||
continue; // not a leaf node
|
||||
|
||||
s.bl_count[bits]++;
|
||||
xbits = 0;
|
||||
if (n >= base_Renamed)
|
||||
xbits = extra[n - base_Renamed];
|
||||
f = tree[n*2];
|
||||
s.opt_len += f*(bits + xbits);
|
||||
if (stree != null)
|
||||
s.static_len += f*(stree[n*2 + 1] + xbits);
|
||||
}
|
||||
if (overflow == 0)
|
||||
return;
|
||||
|
||||
// This happens for example on obj2 and pic of the Calgary corpus
|
||||
// Find the first bit length which could increase:
|
||||
do
|
||||
{
|
||||
bits = max_length - 1;
|
||||
while (s.bl_count[bits] == 0)
|
||||
bits--;
|
||||
s.bl_count[bits]--; // move one leaf down the tree
|
||||
s.bl_count[bits + 1] = (short) (s.bl_count[bits + 1] + 2); // move one overflow item as its brother
|
||||
s.bl_count[max_length]--;
|
||||
// The brother of the overflow item also moves one step up,
|
||||
// but this does not affect bl_count[max_length]
|
||||
overflow -= 2;
|
||||
} while (overflow > 0);
|
||||
|
||||
for (bits = max_length; bits != 0; bits--)
|
||||
{
|
||||
n = s.bl_count[bits];
|
||||
while (n != 0)
|
||||
{
|
||||
m = s.heap[--h];
|
||||
if (m > max_code)
|
||||
continue;
|
||||
if (tree[m*2 + 1] != bits)
|
||||
{
|
||||
s.opt_len = (int) (s.opt_len + (bits - (long) tree[m*2 + 1])*tree[m*2]);
|
||||
tree[m*2 + 1] = (short) bits;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Construct one Huffman tree and assigns the code bit strings and lengths.
|
||||
// Update the total bit length for the current block.
|
||||
// IN assertion: the field freq is set for all tree elements.
|
||||
// OUT assertions: the fields len and code are set to the optimal bit length
|
||||
// and corresponding code. The length opt_len is updated; static_len is
|
||||
// also updated if stree is not null. The field max_code is set.
|
||||
internal void build_tree(DeflateManager s)
|
||||
{
|
||||
short[] tree = dyn_tree;
|
||||
short[] stree = staticTree.treeCodes;
|
||||
int elems = staticTree.elems;
|
||||
int n, m; // iterate over heap elements
|
||||
int max_code = -1; // largest code with non zero frequency
|
||||
int node; // new node being created
|
||||
|
||||
// Construct the initial heap, with least frequent element in
|
||||
// heap[1]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
|
||||
// heap[0] is not used.
|
||||
s.heap_len = 0;
|
||||
s.heap_max = HEAP_SIZE;
|
||||
|
||||
for (n = 0; n < elems; n++)
|
||||
{
|
||||
if (tree[n*2] != 0)
|
||||
{
|
||||
s.heap[++s.heap_len] = max_code = n;
|
||||
s.depth[n] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tree[n*2 + 1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// The pkzip format requires that at least one distance code exists,
|
||||
// and that at least one bit should be sent even if there is only one
|
||||
// possible code. So to avoid special checks later on we force at least
|
||||
// two codes of non zero frequency.
|
||||
while (s.heap_len < 2)
|
||||
{
|
||||
node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);
|
||||
tree[node*2] = 1;
|
||||
s.depth[node] = 0;
|
||||
s.opt_len--;
|
||||
if (stree != null)
|
||||
s.static_len -= stree[node*2 + 1];
|
||||
// node is 0 or 1 so it does not have extra bits
|
||||
}
|
||||
this.max_code = max_code;
|
||||
|
||||
// The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
|
||||
// establish sub-heaps of increasing lengths:
|
||||
|
||||
for (n = s.heap_len/2; n >= 1; n--)
|
||||
s.pqdownheap(tree, n);
|
||||
|
||||
// Construct the Huffman tree by repeatedly combining the least two
|
||||
// frequent nodes.
|
||||
|
||||
node = elems; // next internal node of the tree
|
||||
do
|
||||
{
|
||||
// n = node of least frequency
|
||||
n = s.heap[1];
|
||||
s.heap[1] = s.heap[s.heap_len--];
|
||||
s.pqdownheap(tree, 1);
|
||||
m = s.heap[1]; // m = node of next least frequency
|
||||
|
||||
s.heap[--s.heap_max] = n; // keep the nodes sorted by frequency
|
||||
s.heap[--s.heap_max] = m;
|
||||
|
||||
// Create a new node father of n and m
|
||||
tree[node*2] = unchecked((short) (tree[n*2] + tree[m*2]));
|
||||
s.depth[node] = (sbyte) (Math.Max((byte) s.depth[n], (byte) s.depth[m]) + 1);
|
||||
tree[n*2 + 1] = tree[m*2 + 1] = (short) node;
|
||||
|
||||
// and insert the new node in the heap
|
||||
s.heap[1] = node++;
|
||||
s.pqdownheap(tree, 1);
|
||||
} while (s.heap_len >= 2);
|
||||
|
||||
s.heap[--s.heap_max] = s.heap[1];
|
||||
|
||||
// At this point, the fields freq and dad are set. We can now
|
||||
// generate the bit lengths.
|
||||
|
||||
gen_bitlen(s);
|
||||
|
||||
// The field len is now set, we can generate the bit codes
|
||||
gen_codes(tree, max_code, s.bl_count);
|
||||
}
|
||||
|
||||
// Generate the codes for a given tree and bit counts (which need not be
|
||||
// optimal).
|
||||
// IN assertion: the array bl_count contains the bit length statistics for
|
||||
// the given tree and the field len is set for all tree elements.
|
||||
// OUT assertion: the field code is set for all tree elements of non
|
||||
// zero code length.
|
||||
internal static void gen_codes(short[] tree, int max_code, short[] bl_count)
|
||||
{
|
||||
var next_code = new short[InternalConstants.MAX_BITS + 1]; // next code value for each bit length
|
||||
short code = 0; // running code value
|
||||
int bits; // bit index
|
||||
int n; // code index
|
||||
|
||||
// The distribution counts are first used to generate the code values
|
||||
// without bit reversal.
|
||||
for (bits = 1; bits <= InternalConstants.MAX_BITS; bits++)
|
||||
unchecked
|
||||
{
|
||||
next_code[bits] = code = (short) ((code + bl_count[bits - 1]) << 1);
|
||||
}
|
||||
|
||||
// Check that the bit counts in bl_count are consistent. The last code
|
||||
// must be all ones.
|
||||
//Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
||||
// "inconsistent bit counts");
|
||||
//Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||
|
||||
for (n = 0; n <= max_code; n++)
|
||||
{
|
||||
int len = tree[n*2 + 1];
|
||||
if (len == 0)
|
||||
continue;
|
||||
// Now reverse the bits
|
||||
tree[n*2] = unchecked((short) (bi_reverse(next_code[len]++, len)));
|
||||
}
|
||||
}
|
||||
|
||||
// Reverse the first len bits of a code, using straightforward code (a faster
|
||||
// method would use a table)
|
||||
// IN assertion: 1 <= len <= 15
|
||||
internal static int bi_reverse(int code, int len)
|
||||
{
|
||||
int res = 0;
|
||||
do
|
||||
{
|
||||
res |= code & 1;
|
||||
code >>= 1; //SharedUtils.URShift(code, 1);
|
||||
res <<= 1;
|
||||
} while (--len > 0);
|
||||
return res >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
namespace SharpCompress.Compressor.LZMA
|
||||
{
|
||||
public class LzmaEncoderProperties
|
||||
{
|
||||
internal CoderPropID[] propIDs;
|
||||
internal object[] properties;
|
||||
|
||||
public LzmaEncoderProperties()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
public LzmaEncoderProperties(bool eos)
|
||||
: this(eos, 1 << 20)
|
||||
{
|
||||
}
|
||||
|
||||
public LzmaEncoderProperties(bool eos, int dictionary)
|
||||
: this(eos, dictionary, 32)
|
||||
{
|
||||
}
|
||||
|
||||
public LzmaEncoderProperties(bool eos, int dictionary, int numFastBytes)
|
||||
{
|
||||
int posStateBits = 2;
|
||||
int litContextBits = 3;
|
||||
int litPosBits = 0;
|
||||
int algorithm = 2;
|
||||
string mf = "bt4";
|
||||
|
||||
propIDs = new CoderPropID[]
|
||||
{
|
||||
CoderPropID.DictionarySize,
|
||||
CoderPropID.PosStateBits,
|
||||
CoderPropID.LitContextBits,
|
||||
CoderPropID.LitPosBits,
|
||||
CoderPropID.Algorithm,
|
||||
CoderPropID.NumFastBytes,
|
||||
CoderPropID.MatchFinder,
|
||||
CoderPropID.EndMarker
|
||||
};
|
||||
properties = new object[]
|
||||
{
|
||||
dictionary,
|
||||
posStateBits,
|
||||
litContextBits,
|
||||
litPosBits,
|
||||
algorithm,
|
||||
numFastBytes,
|
||||
mf,
|
||||
eos
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace SharpCompress.Compressor.Rar.PPM
|
||||
{
|
||||
internal enum BlockTypes
|
||||
{
|
||||
BLOCK_LZ = 0,
|
||||
BLOCK_PPM = 1,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,46 +0,0 @@
|
||||
namespace SharpCompress.Compressor.Rar.VM
|
||||
{
|
||||
internal class VMCmdFlags
|
||||
{
|
||||
public const byte VMCF_OP0 = 0;
|
||||
public const byte VMCF_OP1 = 1;
|
||||
public const byte VMCF_OP2 = 2;
|
||||
public const byte VMCF_OPMASK = 3;
|
||||
public const byte VMCF_BYTEMODE = 4;
|
||||
public const byte VMCF_JUMP = 8;
|
||||
public const byte VMCF_PROC = 16;
|
||||
public const byte VMCF_USEFLAGS = 32;
|
||||
public const byte VMCF_CHFLAGS = 64;
|
||||
|
||||
public static byte[] VM_CmdFlags = new byte[]
|
||||
{
|
||||
VMCF_OP2 | VMCF_BYTEMODE, VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP1 | VMCF_BYTEMODE | VMCF_CHFLAGS, VMCF_OP1 | VMCF_JUMP,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS,
|
||||
VMCF_OP1 | VMCF_JUMP | VMCF_USEFLAGS, VMCF_OP1, VMCF_OP1,
|
||||
VMCF_OP1 | VMCF_PROC, VMCF_OP0 | VMCF_PROC, VMCF_OP1 | VMCF_BYTEMODE,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_CHFLAGS,
|
||||
VMCF_OP1 | VMCF_BYTEMODE | VMCF_CHFLAGS, VMCF_OP0, VMCF_OP0,
|
||||
VMCF_OP0 | VMCF_USEFLAGS, VMCF_OP0 | VMCF_CHFLAGS, VMCF_OP2, VMCF_OP2,
|
||||
VMCF_OP2 | VMCF_BYTEMODE, VMCF_OP2 | VMCF_BYTEMODE,
|
||||
VMCF_OP2 | VMCF_BYTEMODE,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_USEFLAGS | VMCF_CHFLAGS,
|
||||
VMCF_OP2 | VMCF_BYTEMODE | VMCF_USEFLAGS | VMCF_CHFLAGS, VMCF_OP0
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace SharpCompress.Compressor.Rar.VM
|
||||
{
|
||||
internal class VMStandardFilterSignature
|
||||
{
|
||||
internal VMStandardFilterSignature(int length, uint crc, VMStandardFilters type)
|
||||
{
|
||||
this.Length = length;
|
||||
CRC = crc;
|
||||
this.Type = type;
|
||||
}
|
||||
|
||||
internal int Length { get; private set; }
|
||||
|
||||
internal uint CRC { get; private set; }
|
||||
|
||||
internal VMStandardFilters Type { get; private set; }
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,376 +0,0 @@
|
||||
using System;
|
||||
|
||||
|
||||
namespace Org.BouncyCastle.Crypto
|
||||
{
|
||||
/**
|
||||
* A wrapper class that allows block ciphers to be used to process data in
|
||||
* a piecemeal fashion. The BufferedBlockCipher outputs a block only when the
|
||||
* buffer is full and more data is being added, or on a doFinal.
|
||||
* <p>
|
||||
* Note: in the case where the underlying cipher is either a CFB cipher or an
|
||||
* OFB one the last block may not be a multiple of the block size.
|
||||
* </p>
|
||||
*/
|
||||
public class BufferedBlockCipher
|
||||
: BufferedCipherBase
|
||||
{
|
||||
internal byte[] buf;
|
||||
internal int bufOff;
|
||||
internal bool forEncryption;
|
||||
internal IBlockCipher cipher;
|
||||
|
||||
/**
|
||||
* constructor for subclasses
|
||||
*/
|
||||
protected BufferedBlockCipher()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a buffered block cipher without padding.
|
||||
*
|
||||
* @param cipher the underlying block cipher this buffering object wraps.
|
||||
* false otherwise.
|
||||
*/
|
||||
public BufferedBlockCipher(
|
||||
IBlockCipher cipher)
|
||||
{
|
||||
if (cipher == null)
|
||||
throw new ArgumentNullException("cipher");
|
||||
|
||||
this.cipher = cipher;
|
||||
buf = new byte[cipher.GetBlockSize()];
|
||||
bufOff = 0;
|
||||
}
|
||||
|
||||
public override string AlgorithmName
|
||||
{
|
||||
get { return cipher.AlgorithmName; }
|
||||
}
|
||||
|
||||
/**
|
||||
* initialise the cipher.
|
||||
*
|
||||
* @param forEncryption if true the cipher is initialised for
|
||||
* encryption, if false for decryption.
|
||||
* @param param the key and other data required by the cipher.
|
||||
* @exception ArgumentException if the parameters argument is
|
||||
* inappropriate.
|
||||
*/
|
||||
// Note: This doubles as the Init in the event that this cipher is being used as an IWrapper
|
||||
public override void Init(
|
||||
bool forEncryption,
|
||||
ICipherParameters parameters)
|
||||
{
|
||||
this.forEncryption = forEncryption;
|
||||
|
||||
//if (parameters is ParametersWithRandom)
|
||||
//{
|
||||
// parameters = ((ParametersWithRandom) parameters).Parameters;
|
||||
//}
|
||||
|
||||
Reset();
|
||||
|
||||
cipher.Init(forEncryption, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the blocksize for the underlying cipher.
|
||||
*
|
||||
* @return the blocksize for the underlying cipher.
|
||||
*/
|
||||
public override int GetBlockSize()
|
||||
{
|
||||
return cipher.GetBlockSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* return the size of the output buffer required for an update
|
||||
* an input of len bytes.
|
||||
*
|
||||
* @param len the length of the input.
|
||||
* @return the space required to accommodate a call to update
|
||||
* with len bytes of input.
|
||||
*/
|
||||
public override int GetUpdateOutputSize(
|
||||
int length)
|
||||
{
|
||||
int total = length + bufOff;
|
||||
int leftOver = total % buf.Length;
|
||||
return total - leftOver;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the size of the output buffer required for an update plus a
|
||||
* doFinal with an input of len bytes.
|
||||
*
|
||||
* @param len the length of the input.
|
||||
* @return the space required to accommodate a call to update and doFinal
|
||||
* with len bytes of input.
|
||||
*/
|
||||
public override int GetOutputSize(
|
||||
int length)
|
||||
{
|
||||
// Note: Can assume IsPartialBlockOkay is true for purposes of this calculation
|
||||
return length + bufOff;
|
||||
}
|
||||
|
||||
/**
|
||||
* process a single byte, producing an output block if neccessary.
|
||||
*
|
||||
* @param in the input byte.
|
||||
* @param out the space for any output that might be produced.
|
||||
* @param outOff the offset from which the output will be copied.
|
||||
* @return the number of output bytes copied to out.
|
||||
* @exception DataLengthException if there isn't enough space in out.
|
||||
* @exception InvalidOperationException if the cipher isn't initialised.
|
||||
*/
|
||||
public override int ProcessByte(
|
||||
byte input,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
buf[bufOff++] = input;
|
||||
|
||||
if (bufOff == buf.Length)
|
||||
{
|
||||
if ((outOff + buf.Length) > output.Length)
|
||||
throw new DataLengthException("output buffer too short");
|
||||
|
||||
bufOff = 0;
|
||||
return cipher.ProcessBlock(buf, 0, output, outOff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override byte[] ProcessByte(
|
||||
byte input)
|
||||
{
|
||||
int outLength = GetUpdateOutputSize(1);
|
||||
|
||||
byte[] outBytes = outLength > 0 ? new byte[outLength] : null;
|
||||
|
||||
int pos = ProcessByte(input, outBytes, 0);
|
||||
|
||||
if (outLength > 0 && pos < outLength)
|
||||
{
|
||||
byte[] tmp = new byte[pos];
|
||||
Array.Copy(outBytes, 0, tmp, 0, pos);
|
||||
outBytes = tmp;
|
||||
}
|
||||
|
||||
return outBytes;
|
||||
}
|
||||
|
||||
public override byte[] ProcessBytes(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length)
|
||||
{
|
||||
if (input == null)
|
||||
throw new ArgumentNullException("input");
|
||||
if (length < 1)
|
||||
return null;
|
||||
|
||||
int outLength = GetUpdateOutputSize(length);
|
||||
|
||||
byte[] outBytes = outLength > 0 ? new byte[outLength] : null;
|
||||
|
||||
int pos = ProcessBytes(input, inOff, length, outBytes, 0);
|
||||
|
||||
if (outLength > 0 && pos < outLength)
|
||||
{
|
||||
byte[] tmp = new byte[pos];
|
||||
Array.Copy(outBytes, 0, tmp, 0, pos);
|
||||
outBytes = tmp;
|
||||
}
|
||||
|
||||
return outBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* process an array of bytes, producing output if necessary.
|
||||
*
|
||||
* @param in the input byte array.
|
||||
* @param inOff the offset at which the input data starts.
|
||||
* @param len the number of bytes to be copied out of the input array.
|
||||
* @param out the space for any output that might be produced.
|
||||
* @param outOff the offset from which the output will be copied.
|
||||
* @return the number of output bytes copied to out.
|
||||
* @exception DataLengthException if there isn't enough space in out.
|
||||
* @exception InvalidOperationException if the cipher isn't initialised.
|
||||
*/
|
||||
public override int ProcessBytes(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
if (length < 1)
|
||||
{
|
||||
if (length < 0)
|
||||
throw new ArgumentException("Can't have a negative input length!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int blockSize = GetBlockSize();
|
||||
int outLength = GetUpdateOutputSize(length);
|
||||
|
||||
if (outLength > 0)
|
||||
{
|
||||
if ((outOff + outLength) > output.Length)
|
||||
{
|
||||
throw new DataLengthException("output buffer too short");
|
||||
}
|
||||
}
|
||||
|
||||
int resultLen = 0;
|
||||
int gapLen = buf.Length - bufOff;
|
||||
if (length > gapLen)
|
||||
{
|
||||
Array.Copy(input, inOff, buf, bufOff, gapLen);
|
||||
resultLen += cipher.ProcessBlock(buf, 0, output, outOff);
|
||||
bufOff = 0;
|
||||
length -= gapLen;
|
||||
inOff += gapLen;
|
||||
while (length > buf.Length)
|
||||
{
|
||||
resultLen += cipher.ProcessBlock(input, inOff, output, outOff + resultLen);
|
||||
length -= blockSize;
|
||||
inOff += blockSize;
|
||||
}
|
||||
}
|
||||
Array.Copy(input, inOff, buf, bufOff, length);
|
||||
bufOff += length;
|
||||
if (bufOff == buf.Length)
|
||||
{
|
||||
resultLen += cipher.ProcessBlock(buf, 0, output, outOff + resultLen);
|
||||
bufOff = 0;
|
||||
}
|
||||
return resultLen;
|
||||
}
|
||||
|
||||
public override byte[] DoFinal()
|
||||
{
|
||||
byte[] outBytes = EmptyBuffer;
|
||||
|
||||
int length = GetOutputSize(0);
|
||||
if (length > 0)
|
||||
{
|
||||
outBytes = new byte[length];
|
||||
|
||||
int pos = DoFinal(outBytes, 0);
|
||||
if (pos < outBytes.Length)
|
||||
{
|
||||
byte[] tmp = new byte[pos];
|
||||
Array.Copy(outBytes, 0, tmp, 0, pos);
|
||||
outBytes = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
return outBytes;
|
||||
}
|
||||
|
||||
public override byte[] DoFinal(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int inLen)
|
||||
{
|
||||
if (input == null)
|
||||
throw new ArgumentNullException("input");
|
||||
|
||||
int length = GetOutputSize(inLen);
|
||||
|
||||
byte[] outBytes = EmptyBuffer;
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
outBytes = new byte[length];
|
||||
|
||||
int pos = (inLen > 0)
|
||||
? ProcessBytes(input, inOff, inLen, outBytes, 0)
|
||||
: 0;
|
||||
|
||||
pos += DoFinal(outBytes, pos);
|
||||
|
||||
if (pos < outBytes.Length)
|
||||
{
|
||||
byte[] tmp = new byte[pos];
|
||||
Array.Copy(outBytes, 0, tmp, 0, pos);
|
||||
outBytes = tmp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
return outBytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the last block in the buffer.
|
||||
*
|
||||
* @param out the array the block currently being held is copied into.
|
||||
* @param outOff the offset at which the copying starts.
|
||||
* @return the number of output bytes copied to out.
|
||||
* @exception DataLengthException if there is insufficient space in out for
|
||||
* the output, or the input is not block size aligned and should be.
|
||||
* @exception InvalidOperationException if the underlying cipher is not
|
||||
* initialised.
|
||||
* @exception InvalidCipherTextException if padding is expected and not found.
|
||||
* @exception DataLengthException if the input is not block size
|
||||
* aligned.
|
||||
*/
|
||||
public override int DoFinal(
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (bufOff != 0)
|
||||
{
|
||||
if (!cipher.IsPartialBlockOkay)
|
||||
{
|
||||
throw new DataLengthException("data not block size aligned");
|
||||
}
|
||||
|
||||
if (outOff + bufOff > output.Length)
|
||||
{
|
||||
throw new DataLengthException("output buffer too short for DoFinal()");
|
||||
}
|
||||
|
||||
// NB: Can't copy directly, or we may write too much output
|
||||
cipher.ProcessBlock(buf, 0, buf, 0);
|
||||
Array.Copy(buf, 0, output, outOff, bufOff);
|
||||
}
|
||||
|
||||
return bufOff;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the buffer and cipher. After resetting the object is in the same
|
||||
* state as it was after the last init (if there was one).
|
||||
*/
|
||||
public override void Reset()
|
||||
{
|
||||
Array.Clear(buf, 0, buf.Length);
|
||||
bufOff = 0;
|
||||
|
||||
cipher.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto
|
||||
{
|
||||
public abstract class BufferedCipherBase
|
||||
: IBufferedCipher
|
||||
{
|
||||
protected static readonly byte[] EmptyBuffer = new byte[0];
|
||||
|
||||
public abstract string AlgorithmName { get; }
|
||||
|
||||
public abstract void Init(bool forEncryption, ICipherParameters parameters);
|
||||
|
||||
public abstract int GetBlockSize();
|
||||
|
||||
public abstract int GetOutputSize(int inputLen);
|
||||
public abstract int GetUpdateOutputSize(int inputLen);
|
||||
|
||||
public abstract byte[] ProcessByte(byte input);
|
||||
|
||||
public virtual int ProcessByte(
|
||||
byte input,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
byte[] outBytes = ProcessByte(input);
|
||||
if (outBytes == null)
|
||||
return 0;
|
||||
if (outOff + outBytes.Length > output.Length)
|
||||
throw new DataLengthException("output buffer too short");
|
||||
outBytes.CopyTo(output, outOff);
|
||||
return outBytes.Length;
|
||||
}
|
||||
|
||||
public virtual byte[] ProcessBytes(
|
||||
byte[] input)
|
||||
{
|
||||
return ProcessBytes(input, 0, input.Length);
|
||||
}
|
||||
|
||||
public abstract byte[] ProcessBytes(byte[] input, int inOff, int length);
|
||||
|
||||
public virtual int ProcessBytes(
|
||||
byte[] input,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
return ProcessBytes(input, 0, input.Length, output, outOff);
|
||||
}
|
||||
|
||||
public virtual int ProcessBytes(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
byte[] outBytes = ProcessBytes(input, inOff, length);
|
||||
if (outBytes == null)
|
||||
return 0;
|
||||
if (outOff + outBytes.Length > output.Length)
|
||||
throw new DataLengthException("output buffer too short");
|
||||
outBytes.CopyTo(output, outOff);
|
||||
return outBytes.Length;
|
||||
}
|
||||
|
||||
public abstract byte[] DoFinal();
|
||||
|
||||
public virtual byte[] DoFinal(
|
||||
byte[] input)
|
||||
{
|
||||
return DoFinal(input, 0, input.Length);
|
||||
}
|
||||
|
||||
public abstract byte[] DoFinal(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length);
|
||||
|
||||
public virtual int DoFinal(
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
byte[] outBytes = DoFinal();
|
||||
if (outOff + outBytes.Length > output.Length)
|
||||
throw new DataLengthException("output buffer too short");
|
||||
outBytes.CopyTo(output, outOff);
|
||||
return outBytes.Length;
|
||||
}
|
||||
|
||||
public virtual int DoFinal(
|
||||
byte[] input,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
return DoFinal(input, 0, input.Length, output, outOff);
|
||||
}
|
||||
|
||||
public virtual int DoFinal(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length,
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
int len = ProcessBytes(input, inOff, length, output, outOff);
|
||||
len += DoFinal(output, outOff + len);
|
||||
return len;
|
||||
}
|
||||
|
||||
public abstract void Reset();
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto.Digests
|
||||
{
|
||||
public abstract class GeneralDigest
|
||||
: IDigest
|
||||
{
|
||||
private const int BYTE_LENGTH = 64;
|
||||
|
||||
private byte[] xBuf;
|
||||
private int xBufOff;
|
||||
|
||||
private long byteCount;
|
||||
|
||||
internal GeneralDigest()
|
||||
{
|
||||
xBuf = new byte[4];
|
||||
}
|
||||
|
||||
internal GeneralDigest(GeneralDigest t)
|
||||
{
|
||||
xBuf = new byte[t.xBuf.Length];
|
||||
Array.Copy(t.xBuf, 0, xBuf, 0, t.xBuf.Length);
|
||||
|
||||
xBufOff = t.xBufOff;
|
||||
byteCount = t.byteCount;
|
||||
}
|
||||
|
||||
public void Update(byte input)
|
||||
{
|
||||
xBuf[xBufOff++] = input;
|
||||
|
||||
if (xBufOff == xBuf.Length)
|
||||
{
|
||||
ProcessWord(xBuf, 0);
|
||||
xBufOff = 0;
|
||||
}
|
||||
|
||||
byteCount++;
|
||||
}
|
||||
|
||||
public void BlockUpdate(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int length)
|
||||
{
|
||||
//
|
||||
// fill the current word
|
||||
//
|
||||
while ((xBufOff != 0) && (length > 0))
|
||||
{
|
||||
Update(input[inOff]);
|
||||
inOff++;
|
||||
length--;
|
||||
}
|
||||
|
||||
//
|
||||
// process whole words.
|
||||
//
|
||||
while (length > xBuf.Length)
|
||||
{
|
||||
ProcessWord(input, inOff);
|
||||
|
||||
inOff += xBuf.Length;
|
||||
length -= xBuf.Length;
|
||||
byteCount += xBuf.Length;
|
||||
}
|
||||
|
||||
//
|
||||
// load in the remainder.
|
||||
//
|
||||
while (length > 0)
|
||||
{
|
||||
Update(input[inOff]);
|
||||
|
||||
inOff++;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
public void Finish()
|
||||
{
|
||||
long bitLength = (byteCount << 3);
|
||||
|
||||
//
|
||||
// add the pad bytes.
|
||||
//
|
||||
Update((byte)128);
|
||||
|
||||
while (xBufOff != 0)
|
||||
Update((byte)0);
|
||||
ProcessLength(bitLength);
|
||||
ProcessBlock();
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
{
|
||||
byteCount = 0;
|
||||
xBufOff = 0;
|
||||
Array.Clear(xBuf, 0, xBuf.Length);
|
||||
}
|
||||
|
||||
public int GetByteLength()
|
||||
{
|
||||
return BYTE_LENGTH;
|
||||
}
|
||||
|
||||
internal abstract void ProcessWord(byte[] input, int inOff);
|
||||
internal abstract void ProcessLength(long bitLength);
|
||||
internal abstract void ProcessBlock();
|
||||
public abstract string AlgorithmName { get; }
|
||||
public abstract int GetDigestSize();
|
||||
public abstract int DoFinal(byte[] output, int outOff);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto.Macs
|
||||
{
|
||||
/**
|
||||
* HMAC implementation based on RFC2104
|
||||
*
|
||||
* H(K XOR opad, H(K XOR ipad, text))
|
||||
*/
|
||||
public class HMac
|
||||
: IMac
|
||||
{
|
||||
private const byte IPAD = (byte)0x36;
|
||||
private const byte OPAD = (byte)0x5C;
|
||||
|
||||
private readonly IDigest digest;
|
||||
private readonly int digestSize;
|
||||
private readonly int blockLength;
|
||||
|
||||
private readonly byte[] inputPad;
|
||||
private readonly byte[] outputPad;
|
||||
|
||||
public HMac(
|
||||
IDigest digest)
|
||||
{
|
||||
this.digest = digest;
|
||||
this.digestSize = digest.GetDigestSize();
|
||||
this.blockLength = digest.GetByteLength();
|
||||
this.inputPad = new byte[blockLength];
|
||||
this.outputPad = new byte[blockLength];
|
||||
}
|
||||
|
||||
public string AlgorithmName
|
||||
{
|
||||
get { return digest.AlgorithmName + "/HMAC"; }
|
||||
}
|
||||
|
||||
public IDigest GetUnderlyingDigest()
|
||||
{
|
||||
return digest;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
ICipherParameters parameters)
|
||||
{
|
||||
digest.Reset();
|
||||
|
||||
byte[] key = ((KeyParameter)parameters).GetKey();
|
||||
int keyLength = key.Length;
|
||||
|
||||
if (keyLength > blockLength)
|
||||
{
|
||||
digest.BlockUpdate(key, 0, key.Length);
|
||||
digest.DoFinal(inputPad, 0);
|
||||
|
||||
keyLength = digestSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Array.Copy(key, 0, inputPad, 0, keyLength);
|
||||
}
|
||||
|
||||
Array.Clear(inputPad, keyLength, blockLength - keyLength);
|
||||
Array.Copy(inputPad, 0, outputPad, 0, blockLength);
|
||||
|
||||
xor(inputPad, IPAD);
|
||||
xor(outputPad, OPAD);
|
||||
|
||||
// Initialise the digest
|
||||
digest.BlockUpdate(inputPad, 0, inputPad.Length);
|
||||
}
|
||||
|
||||
public int GetMacSize()
|
||||
{
|
||||
return digestSize;
|
||||
}
|
||||
|
||||
public void Update(
|
||||
byte input)
|
||||
{
|
||||
digest.Update(input);
|
||||
}
|
||||
|
||||
public void BlockUpdate(
|
||||
byte[] input,
|
||||
int inOff,
|
||||
int len)
|
||||
{
|
||||
digest.BlockUpdate(input, inOff, len);
|
||||
}
|
||||
|
||||
public int DoFinal(
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
byte[] tmp = new byte[digestSize];
|
||||
digest.DoFinal(tmp, 0);
|
||||
|
||||
digest.BlockUpdate(outputPad, 0, outputPad.Length);
|
||||
digest.BlockUpdate(tmp, 0, tmp.Length);
|
||||
|
||||
int len = digest.DoFinal(output, outOff);
|
||||
|
||||
// Initialise the digest
|
||||
digest.BlockUpdate(inputPad, 0, inputPad.Length);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the mac generator.
|
||||
*/
|
||||
public void Reset()
|
||||
{
|
||||
// Reset underlying digest
|
||||
digest.Reset();
|
||||
|
||||
// Initialise the digest
|
||||
digest.BlockUpdate(inputPad, 0, inputPad.Length);
|
||||
}
|
||||
|
||||
private static void xor(byte[] a, byte n)
|
||||
{
|
||||
for (int i = 0; i < a.Length; ++i)
|
||||
{
|
||||
a[i] ^= n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto
|
||||
{
|
||||
/// <remarks>Block cipher engines are expected to conform to this interface.</remarks>
|
||||
public interface IBufferedCipher
|
||||
{
|
||||
/// <summary>The name of the algorithm this cipher implements.</summary>
|
||||
string AlgorithmName { get; }
|
||||
|
||||
/// <summary>Initialise the cipher.</summary>
|
||||
/// <param name="forEncryption">If true the cipher is initialised for encryption,
|
||||
/// if false for decryption.</param>
|
||||
/// <param name="parameters">The key and other data required by the cipher.</param>
|
||||
void Init(bool forEncryption, ICipherParameters parameters);
|
||||
|
||||
int GetBlockSize();
|
||||
|
||||
int GetOutputSize(int inputLen);
|
||||
|
||||
int GetUpdateOutputSize(int inputLen);
|
||||
|
||||
byte[] ProcessByte(byte input);
|
||||
int ProcessByte(byte input, byte[] output, int outOff);
|
||||
|
||||
byte[] ProcessBytes(byte[] input);
|
||||
byte[] ProcessBytes(byte[] input, int inOff, int length);
|
||||
int ProcessBytes(byte[] input, byte[] output, int outOff);
|
||||
int ProcessBytes(byte[] input, int inOff, int length, byte[] output, int outOff);
|
||||
|
||||
byte[] DoFinal();
|
||||
byte[] DoFinal(byte[] input);
|
||||
byte[] DoFinal(byte[] input, int inOff, int length);
|
||||
int DoFinal(byte[] output, int outOff);
|
||||
int DoFinal(byte[] input, byte[] output, int outOff);
|
||||
int DoFinal(byte[] input, int inOff, int length, byte[] output, int outOff);
|
||||
|
||||
/// <summary>
|
||||
/// Reset the cipher. After resetting the cipher is in the same state
|
||||
/// as it was after the last init (if there was one).
|
||||
/// </summary>
|
||||
void Reset();
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
namespace Org.BouncyCastle.Crypto
|
||||
{
|
||||
public interface IDigest
|
||||
{
|
||||
/**
|
||||
* return the algorithm name
|
||||
*
|
||||
* @return the algorithm name
|
||||
*/
|
||||
string AlgorithmName { get; }
|
||||
|
||||
/**
|
||||
* return the size, in bytes, of the digest produced by this message digest.
|
||||
*
|
||||
* @return the size, in bytes, of the digest produced by this message digest.
|
||||
*/
|
||||
int GetDigestSize();
|
||||
|
||||
/**
|
||||
* return the size, in bytes, of the internal buffer used by this digest.
|
||||
*
|
||||
* @return the size, in bytes, of the internal buffer used by this digest.
|
||||
*/
|
||||
int GetByteLength();
|
||||
|
||||
/**
|
||||
* update the message digest with a single byte.
|
||||
*
|
||||
* @param inByte the input byte to be entered.
|
||||
*/
|
||||
void Update(byte input);
|
||||
|
||||
/**
|
||||
* update the message digest with a block of bytes.
|
||||
*
|
||||
* @param input the byte array containing the data.
|
||||
* @param inOff the offset into the byte array where the data starts.
|
||||
* @param len the length of the data.
|
||||
*/
|
||||
void BlockUpdate(byte[] input, int inOff, int length);
|
||||
|
||||
/**
|
||||
* Close the digest, producing the final digest value. The doFinal
|
||||
* call leaves the digest reset.
|
||||
*
|
||||
* @param output the array the digest is to be copied into.
|
||||
* @param outOff the offset into the out array the digest is to start at.
|
||||
*/
|
||||
int DoFinal(byte[] output, int outOff);
|
||||
|
||||
/**
|
||||
* reset the digest back to it's initial state.
|
||||
*/
|
||||
void Reset();
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
namespace Org.BouncyCastle.Crypto
|
||||
{
|
||||
public interface IMac
|
||||
{
|
||||
/**
|
||||
* Initialise the MAC.
|
||||
*
|
||||
* @param param the key and other data required by the MAC.
|
||||
* @exception ArgumentException if the parameters argument is
|
||||
* inappropriate.
|
||||
*/
|
||||
void Init(ICipherParameters parameters);
|
||||
|
||||
/**
|
||||
* Return the name of the algorithm the MAC implements.
|
||||
*
|
||||
* @return the name of the algorithm the MAC implements.
|
||||
*/
|
||||
string AlgorithmName { get; }
|
||||
|
||||
/**
|
||||
* Return the block size for this MAC (in bytes).
|
||||
*
|
||||
* @return the block size for this MAC in bytes.
|
||||
*/
|
||||
int GetMacSize();
|
||||
|
||||
/**
|
||||
* add a single byte to the mac for processing.
|
||||
*
|
||||
* @param in the byte to be processed.
|
||||
* @exception InvalidOperationException if the MAC is not initialised.
|
||||
*/
|
||||
void Update(byte input);
|
||||
|
||||
/**
|
||||
* @param in the array containing the input.
|
||||
* @param inOff the index in the array the data begins at.
|
||||
* @param len the length of the input starting at inOff.
|
||||
* @exception InvalidOperationException if the MAC is not initialised.
|
||||
* @exception DataLengthException if there isn't enough data in in.
|
||||
*/
|
||||
void BlockUpdate(byte[] input, int inOff, int len);
|
||||
|
||||
/**
|
||||
* Compute the final stage of the MAC writing the output to the out
|
||||
* parameter.
|
||||
* <p>
|
||||
* doFinal leaves the MAC in the same state it was after the last init.
|
||||
* </p>
|
||||
* @param out the array the MAC is to be output to.
|
||||
* @param outOff the offset into the out buffer the output is to start at.
|
||||
* @exception DataLengthException if there isn't enough space in out.
|
||||
* @exception InvalidOperationException if the MAC is not initialised.
|
||||
*/
|
||||
int DoFinal(byte[] output, int outOff);
|
||||
|
||||
/**
|
||||
* Reset the MAC. At the end of resetting the MAC should be in the
|
||||
* in the same state it was after the last init (if there was one).
|
||||
*/
|
||||
void Reset();
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
using System;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Digests;
|
||||
using Org.BouncyCastle.Crypto.Macs;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
|
||||
namespace SharpCompress.Crypto
|
||||
{
|
||||
//Gathered from:
|
||||
//http://stackoverflow.com/questions/3210795/pbkdf2-in-bouncy-castle-c-sharp and Rfc2898DeriveBytes
|
||||
internal class PBKDF2
|
||||
{
|
||||
private readonly IMac hMac = new HMac(new Sha1Digest());
|
||||
private readonly byte[] state = new byte[20];
|
||||
private int endIndex;
|
||||
private int startIndex;
|
||||
private uint block = 1u;
|
||||
private readonly byte[] password;
|
||||
private readonly byte[] salt;
|
||||
private readonly int iterations;
|
||||
|
||||
|
||||
public PBKDF2(byte[] password, byte[] salt, int iterations)
|
||||
{
|
||||
this.password = password;
|
||||
this.salt = salt;
|
||||
this.iterations = iterations;
|
||||
}
|
||||
|
||||
public byte[] GetBytes(int cb)
|
||||
{
|
||||
if (cb <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("cb");
|
||||
}
|
||||
byte[] array = new byte[cb];
|
||||
int i = 0;
|
||||
int num = endIndex - startIndex;
|
||||
if (num > 0)
|
||||
{
|
||||
if (cb < num)
|
||||
{
|
||||
Buffer.BlockCopy(state, startIndex, array, 0, cb);
|
||||
startIndex += cb;
|
||||
return array;
|
||||
}
|
||||
Buffer.BlockCopy(state, startIndex, array, 0, num);
|
||||
startIndex = (endIndex = 0);
|
||||
i += num;
|
||||
}
|
||||
while (i < cb)
|
||||
{
|
||||
byte[] src = Hash();
|
||||
int num2 = cb - i;
|
||||
if (num2 <= 20)
|
||||
{
|
||||
Buffer.BlockCopy(src, 0, array, i, num2);
|
||||
i += num2;
|
||||
Buffer.BlockCopy(src, num2, state, startIndex, 20 - num2);
|
||||
endIndex += 20 - num2;
|
||||
return array;
|
||||
}
|
||||
Buffer.BlockCopy(src, 0, array, i, 20);
|
||||
i += 20;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
private byte[] Hash()
|
||||
{
|
||||
byte[] array = UIntToOctet(block);
|
||||
ICipherParameters param = new KeyParameter(password);
|
||||
|
||||
hMac.Init(param);
|
||||
hMac.BlockUpdate(salt, 0, salt.Length);
|
||||
|
||||
hMac.BlockUpdate(array, 0, array.Length);
|
||||
byte[] array2 = new byte[20];
|
||||
hMac.DoFinal(array2, 0);
|
||||
|
||||
hMac.Init(param);
|
||||
|
||||
byte[] array3 = new byte[20];
|
||||
Buffer.BlockCopy(array2, 0, array3, 0, 20);
|
||||
int num = 2;
|
||||
while (num <= (long)((ulong)iterations))
|
||||
{
|
||||
hMac.BlockUpdate(array2, 0, array2.Length);
|
||||
hMac.DoFinal(array2, 0);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
array3[i] ^= array2[i];
|
||||
}
|
||||
num++;
|
||||
}
|
||||
block += 1u;
|
||||
return array3;
|
||||
}
|
||||
|
||||
internal static byte[] UIntToOctet(uint i)
|
||||
{
|
||||
byte[] bytes = BitConverter.GetBytes(i);
|
||||
byte[] result = new[]
|
||||
{
|
||||
bytes[3],
|
||||
bytes[2],
|
||||
bytes[1],
|
||||
bytes[0]
|
||||
};
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
return bytes;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
namespace Org.BouncyCastle.Crypto.Utilities
|
||||
{
|
||||
internal sealed class Pack
|
||||
{
|
||||
private Pack()
|
||||
{
|
||||
}
|
||||
|
||||
internal static void UInt32_To_BE(uint n, byte[] bs)
|
||||
{
|
||||
bs[0] = (byte)(n >> 24);
|
||||
bs[1] = (byte)(n >> 16);
|
||||
bs[2] = (byte)(n >> 8);
|
||||
bs[3] = (byte)(n);
|
||||
}
|
||||
|
||||
internal static void UInt32_To_BE(uint n, byte[] bs, int off)
|
||||
{
|
||||
bs[off] = (byte)(n >> 24);
|
||||
bs[++off] = (byte)(n >> 16);
|
||||
bs[++off] = (byte)(n >> 8);
|
||||
bs[++off] = (byte)(n);
|
||||
}
|
||||
|
||||
internal static uint BE_To_UInt32(byte[] bs)
|
||||
{
|
||||
uint n = (uint)bs[0] << 24;
|
||||
n |= (uint)bs[1] << 16;
|
||||
n |= (uint)bs[2] << 8;
|
||||
n |= (uint)bs[3];
|
||||
return n;
|
||||
}
|
||||
|
||||
internal static uint BE_To_UInt32(byte[] bs, int off)
|
||||
{
|
||||
uint n = (uint)bs[off] << 24;
|
||||
n |= (uint)bs[++off] << 16;
|
||||
n |= (uint)bs[++off] << 8;
|
||||
n |= (uint)bs[++off];
|
||||
return n;
|
||||
}
|
||||
|
||||
internal static ulong BE_To_UInt64(byte[] bs)
|
||||
{
|
||||
uint hi = BE_To_UInt32(bs);
|
||||
uint lo = BE_To_UInt32(bs, 4);
|
||||
return ((ulong)hi << 32) | (ulong)lo;
|
||||
}
|
||||
|
||||
internal static ulong BE_To_UInt64(byte[] bs, int off)
|
||||
{
|
||||
uint hi = BE_To_UInt32(bs, off);
|
||||
uint lo = BE_To_UInt32(bs, off + 4);
|
||||
return ((ulong)hi << 32) | (ulong)lo;
|
||||
}
|
||||
|
||||
internal static void UInt64_To_BE(ulong n, byte[] bs)
|
||||
{
|
||||
UInt32_To_BE((uint)(n >> 32), bs);
|
||||
UInt32_To_BE((uint)(n), bs, 4);
|
||||
}
|
||||
|
||||
internal static void UInt64_To_BE(ulong n, byte[] bs, int off)
|
||||
{
|
||||
UInt32_To_BE((uint)(n >> 32), bs, off);
|
||||
UInt32_To_BE((uint)(n), bs, off + 4);
|
||||
}
|
||||
|
||||
internal static void UInt32_To_LE(uint n, byte[] bs)
|
||||
{
|
||||
bs[0] = (byte)(n);
|
||||
bs[1] = (byte)(n >> 8);
|
||||
bs[2] = (byte)(n >> 16);
|
||||
bs[3] = (byte)(n >> 24);
|
||||
}
|
||||
|
||||
internal static void UInt32_To_LE(uint n, byte[] bs, int off)
|
||||
{
|
||||
bs[off] = (byte)(n);
|
||||
bs[++off] = (byte)(n >> 8);
|
||||
bs[++off] = (byte)(n >> 16);
|
||||
bs[++off] = (byte)(n >> 24);
|
||||
}
|
||||
|
||||
internal static uint LE_To_UInt32(byte[] bs)
|
||||
{
|
||||
uint n = (uint)bs[0];
|
||||
n |= (uint)bs[1] << 8;
|
||||
n |= (uint)bs[2] << 16;
|
||||
n |= (uint)bs[3] << 24;
|
||||
return n;
|
||||
}
|
||||
|
||||
internal static uint LE_To_UInt32(byte[] bs, int off)
|
||||
{
|
||||
uint n = (uint)bs[off];
|
||||
n |= (uint)bs[++off] << 8;
|
||||
n |= (uint)bs[++off] << 16;
|
||||
n |= (uint)bs[++off] << 24;
|
||||
return n;
|
||||
}
|
||||
|
||||
internal static ulong LE_To_UInt64(byte[] bs)
|
||||
{
|
||||
uint lo = LE_To_UInt32(bs);
|
||||
uint hi = LE_To_UInt32(bs, 4);
|
||||
return ((ulong)hi << 32) | (ulong)lo;
|
||||
}
|
||||
|
||||
internal static ulong LE_To_UInt64(byte[] bs, int off)
|
||||
{
|
||||
uint lo = LE_To_UInt32(bs, off);
|
||||
uint hi = LE_To_UInt32(bs, off + 4);
|
||||
return ((ulong)hi << 32) | (ulong)lo;
|
||||
}
|
||||
|
||||
internal static void UInt64_To_LE(ulong n, byte[] bs)
|
||||
{
|
||||
UInt32_To_LE((uint)(n), bs);
|
||||
UInt32_To_LE((uint)(n >> 32), bs, 4);
|
||||
}
|
||||
|
||||
internal static void UInt64_To_LE(ulong n, byte[] bs, int off)
|
||||
{
|
||||
UInt32_To_LE((uint)(n), bs, off);
|
||||
UInt32_To_LE((uint)(n >> 32), bs, off + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
using System;
|
||||
using Org.BouncyCastle.Crypto.Utilities;
|
||||
|
||||
namespace Org.BouncyCastle.Crypto.Digests
|
||||
{
|
||||
public class Sha1Digest
|
||||
: GeneralDigest
|
||||
{
|
||||
private const int DigestLength = 20;
|
||||
|
||||
private uint H1, H2, H3, H4, H5;
|
||||
|
||||
private uint[] X = new uint[80];
|
||||
private int xOff;
|
||||
|
||||
public Sha1Digest()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor. This will copy the state of the provided
|
||||
* message digest.
|
||||
*/
|
||||
public Sha1Digest(Sha1Digest t)
|
||||
: base(t)
|
||||
{
|
||||
H1 = t.H1;
|
||||
H2 = t.H2;
|
||||
H3 = t.H3;
|
||||
H4 = t.H4;
|
||||
H5 = t.H5;
|
||||
|
||||
Array.Copy(t.X, 0, X, 0, t.X.Length);
|
||||
xOff = t.xOff;
|
||||
}
|
||||
|
||||
public override string AlgorithmName
|
||||
{
|
||||
get { return "SHA-1"; }
|
||||
}
|
||||
|
||||
public override int GetDigestSize()
|
||||
{
|
||||
return DigestLength;
|
||||
}
|
||||
|
||||
internal override void ProcessWord(
|
||||
byte[] input,
|
||||
int inOff)
|
||||
{
|
||||
X[xOff] = Pack.BE_To_UInt32(input, inOff);
|
||||
|
||||
if (++xOff == 16)
|
||||
{
|
||||
ProcessBlock();
|
||||
}
|
||||
}
|
||||
|
||||
internal override void ProcessLength(long bitLength)
|
||||
{
|
||||
if (xOff > 14)
|
||||
{
|
||||
ProcessBlock();
|
||||
}
|
||||
|
||||
X[14] = (uint)((ulong)bitLength >> 32);
|
||||
X[15] = (uint)((ulong)bitLength);
|
||||
}
|
||||
|
||||
public override int DoFinal(
|
||||
byte[] output,
|
||||
int outOff)
|
||||
{
|
||||
Finish();
|
||||
|
||||
Pack.UInt32_To_BE(H1, output, outOff);
|
||||
Pack.UInt32_To_BE(H2, output, outOff + 4);
|
||||
Pack.UInt32_To_BE(H3, output, outOff + 8);
|
||||
Pack.UInt32_To_BE(H4, output, outOff + 12);
|
||||
Pack.UInt32_To_BE(H5, output, outOff + 16);
|
||||
|
||||
Reset();
|
||||
|
||||
return DigestLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the chaining variables
|
||||
*/
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
H1 = 0x67452301;
|
||||
H2 = 0xefcdab89;
|
||||
H3 = 0x98badcfe;
|
||||
H4 = 0x10325476;
|
||||
H5 = 0xc3d2e1f0;
|
||||
|
||||
xOff = 0;
|
||||
Array.Clear(X, 0, X.Length);
|
||||
}
|
||||
|
||||
//
|
||||
// Additive constants
|
||||
//
|
||||
private const uint Y1 = 0x5a827999;
|
||||
private const uint Y2 = 0x6ed9eba1;
|
||||
private const uint Y3 = 0x8f1bbcdc;
|
||||
private const uint Y4 = 0xca62c1d6;
|
||||
|
||||
private static uint F(uint u, uint v, uint w)
|
||||
{
|
||||
return (u & v) | (~u & w);
|
||||
}
|
||||
|
||||
private static uint H(uint u, uint v, uint w)
|
||||
{
|
||||
return u ^ v ^ w;
|
||||
}
|
||||
|
||||
private static uint G(uint u, uint v, uint w)
|
||||
{
|
||||
return (u & v) | (u & w) | (v & w);
|
||||
}
|
||||
|
||||
internal override void ProcessBlock()
|
||||
{
|
||||
//
|
||||
// expand 16 word block into 80 word block.
|
||||
//
|
||||
for (int i = 16; i < 80; i++)
|
||||
{
|
||||
uint t = X[i - 3] ^ X[i - 8] ^ X[i - 14] ^ X[i - 16];
|
||||
X[i] = t << 1 | t >> 31;
|
||||
}
|
||||
|
||||
//
|
||||
// set up working variables.
|
||||
//
|
||||
uint A = H1;
|
||||
uint B = H2;
|
||||
uint C = H3;
|
||||
uint D = H4;
|
||||
uint E = H5;
|
||||
|
||||
//
|
||||
// round 1
|
||||
//
|
||||
int idx = 0;
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
// E = rotateLeft(A, 5) + F(B, C, D) + E + X[idx++] + Y1
|
||||
// B = rotateLeft(B, 30)
|
||||
E += (A << 5 | (A >> 27)) + F(B, C, D) + X[idx++] + Y1;
|
||||
B = B << 30 | (B >> 2);
|
||||
|
||||
D += (E << 5 | (E >> 27)) + F(A, B, C) + X[idx++] + Y1;
|
||||
A = A << 30 | (A >> 2);
|
||||
|
||||
C += (D << 5 | (D >> 27)) + F(E, A, B) + X[idx++] + Y1;
|
||||
E = E << 30 | (E >> 2);
|
||||
|
||||
B += (C << 5 | (C >> 27)) + F(D, E, A) + X[idx++] + Y1;
|
||||
D = D << 30 | (D >> 2);
|
||||
|
||||
A += (B << 5 | (B >> 27)) + F(C, D, E) + X[idx++] + Y1;
|
||||
C = C << 30 | (C >> 2);
|
||||
}
|
||||
|
||||
//
|
||||
// round 2
|
||||
//
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
// E = rotateLeft(A, 5) + H(B, C, D) + E + X[idx++] + Y2
|
||||
// B = rotateLeft(B, 30)
|
||||
E += (A << 5 | (A >> 27)) + H(B, C, D) + X[idx++] + Y2;
|
||||
B = B << 30 | (B >> 2);
|
||||
|
||||
D += (E << 5 | (E >> 27)) + H(A, B, C) + X[idx++] + Y2;
|
||||
A = A << 30 | (A >> 2);
|
||||
|
||||
C += (D << 5 | (D >> 27)) + H(E, A, B) + X[idx++] + Y2;
|
||||
E = E << 30 | (E >> 2);
|
||||
|
||||
B += (C << 5 | (C >> 27)) + H(D, E, A) + X[idx++] + Y2;
|
||||
D = D << 30 | (D >> 2);
|
||||
|
||||
A += (B << 5 | (B >> 27)) + H(C, D, E) + X[idx++] + Y2;
|
||||
C = C << 30 | (C >> 2);
|
||||
}
|
||||
|
||||
//
|
||||
// round 3
|
||||
//
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
// E = rotateLeft(A, 5) + G(B, C, D) + E + X[idx++] + Y3
|
||||
// B = rotateLeft(B, 30)
|
||||
E += (A << 5 | (A >> 27)) + G(B, C, D) + X[idx++] + Y3;
|
||||
B = B << 30 | (B >> 2);
|
||||
|
||||
D += (E << 5 | (E >> 27)) + G(A, B, C) + X[idx++] + Y3;
|
||||
A = A << 30 | (A >> 2);
|
||||
|
||||
C += (D << 5 | (D >> 27)) + G(E, A, B) + X[idx++] + Y3;
|
||||
E = E << 30 | (E >> 2);
|
||||
|
||||
B += (C << 5 | (C >> 27)) + G(D, E, A) + X[idx++] + Y3;
|
||||
D = D << 30 | (D >> 2);
|
||||
|
||||
A += (B << 5 | (B >> 27)) + G(C, D, E) + X[idx++] + Y3;
|
||||
C = C << 30 | (C >> 2);
|
||||
}
|
||||
|
||||
//
|
||||
// round 4
|
||||
//
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
// E = rotateLeft(A, 5) + H(B, C, D) + E + X[idx++] + Y4
|
||||
// B = rotateLeft(B, 30)
|
||||
E += (A << 5 | (A >> 27)) + H(B, C, D) + X[idx++] + Y4;
|
||||
B = B << 30 | (B >> 2);
|
||||
|
||||
D += (E << 5 | (E >> 27)) + H(A, B, C) + X[idx++] + Y4;
|
||||
A = A << 30 | (A >> 2);
|
||||
|
||||
C += (D << 5 | (D >> 27)) + H(E, A, B) + X[idx++] + Y4;
|
||||
E = E << 30 | (E >> 2);
|
||||
|
||||
B += (C << 5 | (C >> 27)) + H(D, E, A) + X[idx++] + Y4;
|
||||
D = D << 30 | (D >> 2);
|
||||
|
||||
A += (B << 5 | (B >> 27)) + H(C, D, E) + X[idx++] + Y4;
|
||||
C = C << 30 | (C >> 2);
|
||||
}
|
||||
|
||||
H1 += A;
|
||||
H2 += B;
|
||||
H3 += C;
|
||||
H4 += D;
|
||||
H5 += E;
|
||||
|
||||
//
|
||||
// reset start of the buffer.
|
||||
//
|
||||
xOff = 0;
|
||||
Array.Clear(X, 0, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SharpCompress.Archive;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Reader
|
||||
{
|
||||
internal interface IReaderExtractionListener:IExtractionListener
|
||||
{
|
||||
// void EnsureEntriesLoaded();
|
||||
void FireEntryExtractionBegin(Entry entry);
|
||||
void FireEntryExtractionEnd(Entry entry);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
|
||||
namespace SharpCompress.Reader.Rar
|
||||
{
|
||||
public class RarReaderEntry : RarEntry
|
||||
{
|
||||
internal RarReaderEntry(bool solid, RarFilePart part)
|
||||
{
|
||||
Part = part;
|
||||
IsSolid = solid;
|
||||
}
|
||||
|
||||
internal RarFilePart Part { get; private set; }
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return Part.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
|
||||
internal override FileHeader FileHeader
|
||||
{
|
||||
get { return Part.FileHeader; }
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get { return CompressionType.Rar; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The compressed file size
|
||||
/// </summary>
|
||||
public override long CompressedSize
|
||||
{
|
||||
get { return Part.FileHeader.CompressedSize; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The uncompressed file size
|
||||
/// </summary>
|
||||
public override long Size
|
||||
{
|
||||
get { return Part.FileHeader.UncompressedSize; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,338 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7FA7D133-1417-4F85-9998-4C618AC8FEDA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress</RootNamespace>
|
||||
<AssemblyName>SharpCompress</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile136</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<BaseIntermediateOutputPath>obj\Portable\</BaseIntermediateOutputPath>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\Portable\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\Portable\</OutputPath>
|
||||
<DefineConstants>TRACE;PORTABLE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\ArchiveFactory.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchive.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\GZip\GZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchive.cs" />
|
||||
<Compile Include="Archive\IArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveExtractionListener.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntryFactory.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveVolumeFactory.cs" />
|
||||
<Compile Include="Archive\Rar\SeekableFilePart.cs" />
|
||||
<Compile Include="Archive\Rar\StreamRarArchiveVolume.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchive.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchive.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchive.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Common\ArchiveException.cs" />
|
||||
<Compile Include="Common\ArchiveExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\ArchiveType.cs" />
|
||||
<Compile Include="Common\CompressedBytesReadEventArgs.cs" />
|
||||
<Compile Include="Common\CompressionInfo.cs" />
|
||||
<Compile Include="Common\CompressionType.cs" />
|
||||
<Compile Include="Common\CryptographicException.cs" />
|
||||
<Compile Include="Common\Entry.cs" />
|
||||
<Compile Include="Common\EntryStream.cs" />
|
||||
<Compile Include="Common\ExtractionException.cs" />
|
||||
<Compile Include="Common\ExtractOptions.cs" />
|
||||
<Compile Include="Common\FilePart.cs" />
|
||||
<Compile Include="Common\FilePartExtractionBeginEventArgs.cs" />
|
||||
<Compile Include="Common\FlagUtility.cs" />
|
||||
<Compile Include="Common\GZip\GZipEntry.cs" />
|
||||
<Compile Include="Common\GZip\GZipFilePart.cs" />
|
||||
<Compile Include="Common\GZip\GZipVolume.cs" />
|
||||
<Compile Include="Common\IEntry.cs" />
|
||||
<Compile Include="Common\IExtractionListener.cs" />
|
||||
<Compile Include="Common\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="Common\IVolume.cs" />
|
||||
<Compile Include="Common\MultipartStreamRequiredException.cs" />
|
||||
<Compile Include="Common\MultiVolumeExtractionException.cs" />
|
||||
<Compile Include="Common\Options.cs" />
|
||||
<Compile Include="Common\PasswordProtectedException.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\AVHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\CommentHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\EndArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileNameDecoder.cs" />
|
||||
<Compile Include="Common\Rar\Headers\Flags.cs" />
|
||||
<Compile Include="Common\Rar\Headers\MarkHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\NewSubHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ProtectHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Rar\Headers\SignHeader.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoBinaryReader.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoWrapper.cs" />
|
||||
<Compile Include="Common\Rar\RarEntry.cs" />
|
||||
<Compile Include="Common\Rar\RarFilePart.cs" />
|
||||
<Compile Include="Common\Rar\RarRijndael.Portable.cs" />
|
||||
<Compile Include="Common\Rar\RarVolume.cs" />
|
||||
<Compile Include="Common\ReaderExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveDatabase.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveReader.cs" />
|
||||
<Compile Include="Common\SevenZip\CBindPair.cs" />
|
||||
<Compile Include="Common\SevenZip\CCoderInfo.cs" />
|
||||
<Compile Include="Common\SevenZip\CFileItem.cs" />
|
||||
<Compile Include="Common\SevenZip\CFolder.cs" />
|
||||
<Compile Include="Common\SevenZip\CMethodId.cs" />
|
||||
<Compile Include="Common\SevenZip\CStreamSwitch.cs" />
|
||||
<Compile Include="Common\SevenZip\DataReader.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipEntry.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipFilePart.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipVolume.cs" />
|
||||
<Compile Include="Common\Tar\Headers\TarHeader.cs" />
|
||||
<Compile Include="Common\Tar\TarEntry.cs" />
|
||||
<Compile Include="Common\Tar\TarFilePart.cs" />
|
||||
<Compile Include="Common\Tar\TarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Tar\TarReadOnlySubStream.cs" />
|
||||
<Compile Include="Common\Tar\TarVolume.cs" />
|
||||
<Compile Include="Common\Volume.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeaderExtraFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesCryptoStream.Portable.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEndHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\HeaderFlags.cs" />
|
||||
<Compile Include="Common\Zip\Headers\IgnoreHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\SplitHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipFileEntry.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeaderType.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalCryptoStream.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalEncryptionData.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesEncryptionData.Portable.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesKeySize.cs" />
|
||||
<Compile Include="Common\Zip\ZipCompressionMethod.cs" />
|
||||
<Compile Include="Common\Zip\ZipEntry.cs" />
|
||||
<Compile Include="Common\Zip\ZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\ZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\ZipVolume.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Stream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2InputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2OutputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CRC.cs" />
|
||||
<Compile Include="Compressor\CompressionMode.cs" />
|
||||
<Compile Include="Compressor\Deflate\Crc32.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateManager.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\FlushType.cs" />
|
||||
<Compile Include="Compressor\Deflate\GZipStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\Inflate.cs" />
|
||||
<Compile Include="Compressor\Deflate\InfTree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Tree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Zlib.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibBaseStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibCodec.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibConstants.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibStream.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJ2Filter.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJFilter.cs" />
|
||||
<Compile Include="Compressor\Filters\Filter.cs" />
|
||||
<Compile Include="Compressor\LZMA\Bcj2DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\BitVector.cs" />
|
||||
<Compile Include="Compressor\LZMA\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\ICoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\Log.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoderProperties.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzBinTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzInWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaBase.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaDecoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzOutWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBit.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBitTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\Registry.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcBuilderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcCheckStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\IPasswordProvider.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\Utils.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\FreqData.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\ModelPPM.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\PPMContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarMemBlock.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SEE2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\State.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\StateRef.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SubAllocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Allocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Coder.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\MemoryNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Model.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\ModelRestorationMethod.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmState.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\See2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdProperties.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdStream.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\AudioVariables.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\BitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\CodeType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Compress.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Decode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\DistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\FilterType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LowDistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\MultDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\RepDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\MultiVolumeReadOnlyStream.cs" />
|
||||
<Compile Include="Compressor\Rar\PPM\BlockTypes.cs" />
|
||||
<Compile Include="Compressor\Rar\RarCRC.cs" />
|
||||
<Compile Include="Compressor\Rar\RarStream.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack15.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack20.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackFilter.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackUtility.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\BitInput.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\RarVM.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCmdFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCommands.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMOpType.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedCommand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedOperand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedProgram.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilters.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilterSignature.cs" />
|
||||
<Compile Include="Crypto\BufferedBlockCipher.cs" />
|
||||
<Compile Include="Crypto\BufferedCipherBase.cs" />
|
||||
<Compile Include="Crypto\CryptoException.cs" />
|
||||
<Compile Include="Crypto\DataLengthException.cs" />
|
||||
<Compile Include="Crypto\GeneralDigest.cs" />
|
||||
<Compile Include="Crypto\HMac.cs" />
|
||||
<Compile Include="Crypto\IBlockCipher.cs" />
|
||||
<Compile Include="Crypto\IBufferedCipher.cs" />
|
||||
<Compile Include="Crypto\ICipherParameters.cs" />
|
||||
<Compile Include="Crypto\IDigest.cs" />
|
||||
<Compile Include="Crypto\IMac.cs" />
|
||||
<Compile Include="Crypto\KeyParameter.cs" />
|
||||
<Compile Include="Crypto\BigInteger.cs" />
|
||||
<Compile Include="Crypto\Pack.cs" />
|
||||
<Compile Include="Crypto\PBKDF2.cs" />
|
||||
<Compile Include="Crypto\RijndaelEngine.cs" />
|
||||
<Compile Include="Crypto\Sha1Digest.cs" />
|
||||
<Compile Include="IO\CountingWritableSubStream.cs" />
|
||||
<Compile Include="IO\ListeningStream.cs" />
|
||||
<Compile Include="IO\MarkingBinaryReader.cs" />
|
||||
<Compile Include="IO\NonDisposingStream.cs" />
|
||||
<Compile Include="IO\ReadOnlySubStream.cs" />
|
||||
<Compile Include="IO\RewindableStream.cs" />
|
||||
<Compile Include="IO\StreamingMode.cs" />
|
||||
<Compile Include="LazyReadOnlyCollection.cs" />
|
||||
<Compile Include="Reader\AbstractReader.cs" />
|
||||
<Compile Include="Reader\GZip\GZipReader.cs" />
|
||||
<Compile Include="Reader\IReader.cs" />
|
||||
<Compile Include="Reader\IReader.Extensions.cs" />
|
||||
<Compile Include="Reader\IReaderExtractionListener.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Reader\Rar\MultiVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\Rar\NonSeekableStreamFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\RarReader.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderEntry.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderVolume.cs" />
|
||||
<Compile Include="Reader\Rar\SingleVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\ReaderFactory.cs" />
|
||||
<Compile Include="Reader\Tar\TarReader.cs" />
|
||||
<Compile Include="Reader\Zip\ZipReader.cs" />
|
||||
<Compile Include="ReadOnlyCollection.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="Writer\AbstractWriter.cs" />
|
||||
<Compile Include="Writer\GZip\GZipWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.Extensions.cs" />
|
||||
<Compile Include="Writer\Tar\TarWriter.cs" />
|
||||
<Compile Include="Writer\WriterFactory.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCentralDirectoryEntry.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCompressionInfo.cs" />
|
||||
<Compile Include="Writer\Zip\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SharpCompress.pfx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,406 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress</RootNamespace>
|
||||
<AssemblyName>SharpCompress.PortableTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;DISABLE_TRACE;UNSIGNED</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<DocumentationFile>..\bin\SharpCompress.PortableTest.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DocumentationFile>..\bin\SharpCompress.PortableTest.xml</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Archive\IArchiveExtractionListener.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\SeekableFilePart.cs" />
|
||||
<Compile Include="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\ArchiveFactory.cs" />
|
||||
<Compile Include="Archive\GZip\GZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchive.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntryFactory.cs" />
|
||||
<Compile Include="Archive\IArchive.cs" />
|
||||
<Compile Include="Archive\Rar\StreamRarArchiveVolume.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchive.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchive.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchive.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchiveEntry.cs" />
|
||||
<Compile Include="Common\ArchiveException.cs" />
|
||||
<Compile Include="Common\ArchiveExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\CompressedBytesReadEventArgs.cs" />
|
||||
<Compile Include="Common\CompressionInfo.cs" />
|
||||
<Compile Include="Common\CompressionType.cs" />
|
||||
<Compile Include="Common\FilePartExtractionBeginEventArgs.cs" />
|
||||
<Compile Include="Common\IExtractionListener.cs" />
|
||||
<Compile Include="Common\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\MultiVolumeExtractionException.cs" />
|
||||
<Compile Include="Common\PasswordProtectedException.cs" />
|
||||
<Compile Include="Common\CryptographicException.cs" />
|
||||
<Compile Include="Common\FlagUtility.cs" />
|
||||
<Compile Include="Common\GZip\GZipEntry.cs" />
|
||||
<Compile Include="Common\GZip\GZipFilePart.cs" />
|
||||
<Compile Include="Common\GZip\GZipVolume.cs" />
|
||||
<Compile Include="Common\ExtractOptions.cs" />
|
||||
<Compile Include="Common\FilePart.cs" />
|
||||
<Compile Include="Common\Entry.cs" />
|
||||
<Compile Include="Common\IEntry.cs" />
|
||||
<Compile Include="Common\IVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoWrapper.cs" />
|
||||
<Compile Include="Common\Rar\RarRijndael.Portable.cs" />
|
||||
<Compile Include="Common\ReaderExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\SevenZip\CBindPair.cs" />
|
||||
<Compile Include="Common\SevenZip\CCoderInfo.cs" />
|
||||
<Compile Include="Common\SevenZip\CFileItem.cs" />
|
||||
<Compile Include="Common\SevenZip\CFolder.cs" />
|
||||
<Compile Include="Common\SevenZip\CStreamSwitch.cs" />
|
||||
<Compile Include="Common\SevenZip\DataReader.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipEntry.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipFilePart.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipVolume.cs" />
|
||||
<Compile Include="Common\Tar\Headers\TarHeader.cs" />
|
||||
<Compile Include="Common\Tar\TarReadOnlySubStream.cs" />
|
||||
<Compile Include="Common\Tar\TarVolume.cs" />
|
||||
<Compile Include="Common\Tar\TarEntry.cs" />
|
||||
<Compile Include="Common\Tar\TarFilePart.cs" />
|
||||
<Compile Include="Common\Tar\TarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\HeaderFlags.cs" />
|
||||
<Compile Include="Common\Zip\Headers\IgnoreHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeaderExtraFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\SplitHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipFileEntry.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeaderType.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesCryptoStream.Portable.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesEncryptionData.Portable.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesKeySize.cs" />
|
||||
<Compile Include="Common\Zip\ZipVolume.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Stream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2InputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2OutputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CRC.cs" />
|
||||
<Compile Include="Compressor\CompressionMode.cs" />
|
||||
<Compile Include="Compressor\Deflate\FlushType.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalCryptoStream.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalEncryptionData.cs" />
|
||||
<Compile Include="Compressor\Deflate\GZipStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\Filters\BCJ2Filter.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJFilter.cs" />
|
||||
<Compile Include="Compressor\Filters\Filter.cs" />
|
||||
<Compile Include="Compressor\LZMA\BitVector.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LZ\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\CRC.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveDatabase.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveReader.cs" />
|
||||
<Compile Include="Common\SevenZip\CMethodId.cs" />
|
||||
<Compile Include="Compressor\LZMA\AesDecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Bcj2DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Registry.cs" />
|
||||
<Compile Include="Compressor\LZMA\ICoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\Log.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LzmaBase.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaDecoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoderProperties.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzBinTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzInWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzOutWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBit.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBitTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcBuilderStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcCheckStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\IPasswordProvider.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\Utils.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\PPMd\H\FreqData.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\ModelPPM.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\PPMContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarMemBlock.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SEE2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\State.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\StateRef.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SubAllocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Allocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Coder.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\MemoryNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Model.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\ModelRestorationMethod.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmState.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\See2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdProperties.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarStream.cs" />
|
||||
<Compile Include="Crypto\BigInteger.cs" />
|
||||
<Compile Include="Crypto\BufferedBlockCipher.cs" />
|
||||
<Compile Include="Crypto\BufferedCipherBase.cs" />
|
||||
<Compile Include="Crypto\CryptoException.cs" />
|
||||
<Compile Include="Crypto\DataLengthException.cs" />
|
||||
<Compile Include="Crypto\GeneralDigest.cs" />
|
||||
<Compile Include="Crypto\HMac.cs" />
|
||||
<Compile Include="Crypto\IBlockCipher.cs" />
|
||||
<Compile Include="Crypto\IBufferedCipher.cs" />
|
||||
<Compile Include="Crypto\ICipherParameters.cs" />
|
||||
<Compile Include="Crypto\IDigest.cs" />
|
||||
<Compile Include="Crypto\IMac.cs" />
|
||||
<Compile Include="Crypto\KeyParameter.cs" />
|
||||
<Compile Include="Crypto\Pack.cs" />
|
||||
<Compile Include="Crypto\PBKDF2.cs" />
|
||||
<Compile Include="Crypto\RijndaelEngine.cs" />
|
||||
<Compile Include="Crypto\Sha1Digest.cs" />
|
||||
<Compile Include="IO\CountingWritableSubStream.cs" />
|
||||
<Compile Include="Common\EntryStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IO\ListeningStream.cs" />
|
||||
<Compile Include="IO\NonDisposingStream.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoBinaryReader.cs" />
|
||||
<Compile Include="IO\RewindableStream.cs" />
|
||||
<Compile Include="Reader\GZip\GZipReader.cs" />
|
||||
<Compile Include="Reader\IReaderExtractionListener.cs" />
|
||||
<Compile Include="Reader\ReaderFactory.cs" />
|
||||
<Compile Include="Reader\AbstractReader.cs" />
|
||||
<Compile Include="Common\Volume.cs" />
|
||||
<Compile Include="Compressor\Deflate\CRC32.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateManager.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\Inflate.cs" />
|
||||
<Compile Include="Compressor\Deflate\InfTree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Tree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Zlib.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibBaseStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibCodec.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibConstants.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibStream.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileNameDecoder.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="IO\ReadOnlySubStream.cs" />
|
||||
<Compile Include="IO\StreamingMode.cs" />
|
||||
<Compile Include="Common\MultipartStreamRequiredException.cs" />
|
||||
<Compile Include="LazyReadOnlyCollection.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntry.cs" />
|
||||
<Compile Include="Common\ExtractionException.cs" />
|
||||
<Compile Include="Common\Rar\RarEntry.cs" />
|
||||
<Compile Include="Common\Options.cs" />
|
||||
<Compile Include="Reader\IReader.cs" />
|
||||
<Compile Include="Reader\Rar\MultiVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\Rar\RarReader.cs" />
|
||||
<Compile Include="Reader\IReader.Extensions.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderEntry.cs" />
|
||||
<Compile Include="Reader\Rar\SingleVolumeRarReader.cs" />
|
||||
<Compile Include="Common\ArchiveType.cs" />
|
||||
<Compile Include="Reader\Tar\TarReader.cs" />
|
||||
<Compile Include="ReadOnlyCollection.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarFilePart.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarArchiveVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarFilePart.cs" />
|
||||
<Compile Include="Common\Rar\Headers\AVHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\CommentHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\EndArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\SignHeader.cs" />
|
||||
<Compile Include="Common\Rar\RarVolume.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackUtility.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.cs" />
|
||||
<Compile Include="Compressor\Rar\MultiVolumeReadOnlyStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarCRC.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeader.cs" />
|
||||
<Compile Include="IO\MarkingBinaryReader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\NewSubHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ProtectHeader.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Rar\Headers\Flags.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\AudioVariables.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\BitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\CodeType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Compress.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Decode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\DistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\FilterType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LowDistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\MultDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\RepDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\PPM\BlockTypes.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack15.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack20.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackFilter.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\BitInput.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\RarVM.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCmdFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCommands.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMOpType.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedCommand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedOperand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedProgram.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilters.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilterSignature.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="Common\Rar\Headers\MarkHeader.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveVolumeFactory.cs" />
|
||||
<Compile Include="Reader\Rar\NonSeekableStreamFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderVolume.cs" />
|
||||
<Compile Include="Common\Zip\ZipCompressionMethod.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEndHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipHeaderFactory.cs" />
|
||||
<Compile Include="Reader\Zip\ZipReader.cs" />
|
||||
<Compile Include="Common\Zip\ZipEntry.cs" />
|
||||
<Compile Include="Writer\AbstractWriter.cs" />
|
||||
<Compile Include="Writer\GZip\GZipWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.Extensions.cs" />
|
||||
<Compile Include="Writer\IWriter.cs" />
|
||||
<Compile Include="Writer\Tar\TarWriter.cs" />
|
||||
<Compile Include="Writer\WriterFactory.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCentralDirectoryEntry.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCompressionInfo.cs" />
|
||||
<Compile Include="Writer\Zip\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SharpCompress.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,394 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{27D535CB-2FD3-4621-8C9A-46161FC77A5D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress</RootNamespace>
|
||||
<AssemblyName>SharpCompress.Unsigned</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<BaseIntermediateOutputPath>obj\Full\</BaseIntermediateOutputPath>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;DISABLE_TRACE;UNSIGNED</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Archive\IWritableArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarFilePart.cs" />
|
||||
<Compile Include="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\ArchiveFactory.cs" />
|
||||
<Compile Include="Archive\GZip\GZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchive.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntryFactory.cs" />
|
||||
<Compile Include="Archive\IArchive.cs" />
|
||||
<Compile Include="Archive\Rar\StreamRarArchiveVolume.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchive.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchive.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchive.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchiveEntry.cs" />
|
||||
<Compile Include="Common\ArchiveException.cs" />
|
||||
<Compile Include="Common\ArchiveExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\CompressedBytesReadEventArgs.cs" />
|
||||
<Compile Include="Common\CompressionInfo.cs" />
|
||||
<Compile Include="Common\CompressionType.cs" />
|
||||
<Compile Include="Common\FilePartExtractionBeginEventArgs.cs" />
|
||||
<Compile Include="Archive\IArchiveExtractionListener.cs" />
|
||||
<Compile Include="Common\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\MultiVolumeExtractionException.cs" />
|
||||
<Compile Include="Common\PasswordProtectedException.cs" />
|
||||
<Compile Include="Common\CryptographicException.cs" />
|
||||
<Compile Include="Common\FlagUtility.cs" />
|
||||
<Compile Include="Common\GZip\GZipEntry.cs" />
|
||||
<Compile Include="Common\GZip\GZipFilePart.cs" />
|
||||
<Compile Include="Common\GZip\GZipVolume.cs" />
|
||||
<Compile Include="Common\ExtractOptions.cs" />
|
||||
<Compile Include="Common\FilePart.cs" />
|
||||
<Compile Include="Common\Entry.cs" />
|
||||
<Compile Include="Common\IEntry.cs" />
|
||||
<Compile Include="Common\IVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoWrapper.cs" />
|
||||
<Compile Include="Common\Rar\RarRijndael.cs" />
|
||||
<Compile Include="Common\ReaderExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\SevenZip\CBindPair.cs" />
|
||||
<Compile Include="Common\SevenZip\CCoderInfo.cs" />
|
||||
<Compile Include="Common\SevenZip\CFileItem.cs" />
|
||||
<Compile Include="Common\SevenZip\CFolder.cs" />
|
||||
<Compile Include="Common\SevenZip\CStreamSwitch.cs" />
|
||||
<Compile Include="Common\SevenZip\DataReader.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipEntry.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipFilePart.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipVolume.cs" />
|
||||
<Compile Include="Common\Tar\Headers\TarHeader.cs" />
|
||||
<Compile Include="Common\Tar\TarReadOnlySubStream.cs" />
|
||||
<Compile Include="Common\Tar\TarVolume.cs" />
|
||||
<Compile Include="Common\Tar\TarEntry.cs" />
|
||||
<Compile Include="Common\Tar\TarFilePart.cs" />
|
||||
<Compile Include="Common\Tar\TarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\HeaderFlags.cs" />
|
||||
<Compile Include="Common\Zip\Headers\IgnoreHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeaderExtraFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\SplitHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipFileEntry.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeaderType.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesCryptoStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Common\Zip\WinzipAesEncryptionData.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesKeySize.cs" />
|
||||
<Compile Include="Common\Zip\ZipVolume.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Stream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2InputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2OutputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CRC.cs" />
|
||||
<Compile Include="Compressor\CompressionMode.cs" />
|
||||
<Compile Include="Compressor\Deflate\FlushType.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalCryptoStream.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalEncryptionData.cs" />
|
||||
<Compile Include="Compressor\Deflate\GZipStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\Filters\BCJ2Filter.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJFilter.cs" />
|
||||
<Compile Include="Compressor\Filters\Filter.cs" />
|
||||
<Compile Include="Compressor\LZMA\BitVector.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LZ\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\CRC.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveDatabase.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveReader.cs" />
|
||||
<Compile Include="Common\SevenZip\CMethodId.cs" />
|
||||
<Compile Include="Compressor\LZMA\AesDecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Bcj2DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Registry.cs" />
|
||||
<Compile Include="Compressor\LZMA\ICoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\Log.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LzmaBase.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaDecoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoderProperties.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzBinTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzInWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzOutWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBit.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBitTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcBuilderStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcCheckStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\IPasswordProvider.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\Utils.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\PPMd\H\FreqData.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\ModelPPM.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\PPMContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarMemBlock.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SEE2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\State.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\StateRef.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SubAllocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Allocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Coder.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\MemoryNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Model.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\ModelRestorationMethod.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmState.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\See2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdProperties.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarStream.cs" />
|
||||
<Compile Include="IO\CountingWritableSubStream.cs" />
|
||||
<Compile Include="Common\EntryStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IO\ListeningStream.cs" />
|
||||
<Compile Include="IO\NonDisposingStream.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoBinaryReader.cs" />
|
||||
<Compile Include="IO\RewindableStream.cs" />
|
||||
<Compile Include="Reader\GZip\GZipReader.cs" />
|
||||
<Compile Include="Reader\IReaderExtractionListener.cs" />
|
||||
<Compile Include="Reader\ReaderFactory.cs" />
|
||||
<Compile Include="Reader\AbstractReader.cs" />
|
||||
<Compile Include="Common\Volume.cs" />
|
||||
<Compile Include="Compressor\Deflate\CRC32.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateManager.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\Inflate.cs" />
|
||||
<Compile Include="Compressor\Deflate\InfTree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Tree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Zlib.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibBaseStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibCodec.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibConstants.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibStream.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileNameDecoder.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="IO\ReadOnlySubStream.cs" />
|
||||
<Compile Include="IO\StreamingMode.cs" />
|
||||
<Compile Include="Common\IExtractionListener.cs" />
|
||||
<Compile Include="Common\MultipartStreamRequiredException.cs" />
|
||||
<Compile Include="LazyReadOnlyCollection.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntry.cs" />
|
||||
<Compile Include="Common\ExtractionException.cs" />
|
||||
<Compile Include="Common\Rar\RarEntry.cs" />
|
||||
<Compile Include="Common\Options.cs" />
|
||||
<Compile Include="Reader\IReader.cs" />
|
||||
<Compile Include="Reader\Rar\MultiVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\Rar\RarReader.cs" />
|
||||
<Compile Include="Reader\IReader.Extensions.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderEntry.cs" />
|
||||
<Compile Include="Archive\Rar\SeekableFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\SingleVolumeRarReader.cs" />
|
||||
<Compile Include="Common\ArchiveType.cs" />
|
||||
<Compile Include="Reader\Tar\TarReader.cs" />
|
||||
<Compile Include="ReadOnlyCollection.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarArchiveVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarFilePart.cs" />
|
||||
<Compile Include="Common\Rar\Headers\AVHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\CommentHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\EndArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\SignHeader.cs" />
|
||||
<Compile Include="Common\Rar\RarVolume.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackUtility.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.cs" />
|
||||
<Compile Include="Compressor\Rar\MultiVolumeReadOnlyStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarCRC.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeader.cs" />
|
||||
<Compile Include="IO\MarkingBinaryReader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\NewSubHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ProtectHeader.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Rar\Headers\Flags.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\AudioVariables.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\BitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\CodeType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Compress.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Decode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\DistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\FilterType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LowDistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\MultDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\RepDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\PPM\BlockTypes.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack15.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack20.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackFilter.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\BitInput.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\RarVM.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCmdFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCommands.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMOpType.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedCommand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedOperand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedProgram.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilters.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilterSignature.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="Common\Rar\Headers\MarkHeader.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveVolumeFactory.cs" />
|
||||
<Compile Include="Reader\Rar\NonSeekableStreamFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderVolume.cs" />
|
||||
<Compile Include="Common\Zip\ZipCompressionMethod.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEndHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipHeaderFactory.cs" />
|
||||
<Compile Include="Reader\Zip\ZipReader.cs" />
|
||||
<Compile Include="Common\Zip\ZipEntry.cs" />
|
||||
<Compile Include="Writer\AbstractWriter.cs" />
|
||||
<Compile Include="Writer\GZip\GZipWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.Extensions.cs" />
|
||||
<Compile Include="Writer\IWriter.cs" />
|
||||
<Compile Include="Writer\Tar\TarWriter.cs" />
|
||||
<Compile Include="Writer\WriterFactory.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCentralDirectoryEntry.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCompressionInfo.cs" />
|
||||
<Compile Include="Writer\Zip\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SharpCompress.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,338 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress</RootNamespace>
|
||||
<AssemblyName>SharpCompress</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<BaseIntermediateOutputPath>obj\WindowsStore\</BaseIntermediateOutputPath>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<TargetFrameworkVersion />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\WindowsStore\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\WindowsStore\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\ArchiveFactory.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchive.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\GZip\GZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchive.cs" />
|
||||
<Compile Include="Archive\IArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveExtractionListener.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntryFactory.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveVolumeFactory.cs" />
|
||||
<Compile Include="Archive\Rar\SeekableFilePart.cs" />
|
||||
<Compile Include="Archive\Rar\StreamRarArchiveVolume.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchive.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchive.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchive.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Common\ArchiveException.cs" />
|
||||
<Compile Include="Common\ArchiveExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\ArchiveType.cs" />
|
||||
<Compile Include="Common\CompressedBytesReadEventArgs.cs" />
|
||||
<Compile Include="Common\CompressionInfo.cs" />
|
||||
<Compile Include="Common\CompressionType.cs" />
|
||||
<Compile Include="Common\CryptographicException.cs" />
|
||||
<Compile Include="Common\Entry.cs" />
|
||||
<Compile Include="Common\EntryStream.cs" />
|
||||
<Compile Include="Common\ExtractionException.cs" />
|
||||
<Compile Include="Common\ExtractOptions.cs" />
|
||||
<Compile Include="Common\FilePart.cs" />
|
||||
<Compile Include="Common\FilePartExtractionBeginEventArgs.cs" />
|
||||
<Compile Include="Common\FlagUtility.cs" />
|
||||
<Compile Include="Common\GZip\GZipEntry.cs" />
|
||||
<Compile Include="Common\GZip\GZipFilePart.cs" />
|
||||
<Compile Include="Common\GZip\GZipVolume.cs" />
|
||||
<Compile Include="Common\IEntry.cs" />
|
||||
<Compile Include="Common\IExtractionListener.cs" />
|
||||
<Compile Include="Common\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="Common\IVolume.cs" />
|
||||
<Compile Include="Common\MultipartStreamRequiredException.cs" />
|
||||
<Compile Include="Common\MultiVolumeExtractionException.cs" />
|
||||
<Compile Include="Common\Options.cs" />
|
||||
<Compile Include="Common\PasswordProtectedException.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\AVHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\CommentHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\EndArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileNameDecoder.cs" />
|
||||
<Compile Include="Common\Rar\Headers\Flags.cs" />
|
||||
<Compile Include="Common\Rar\Headers\MarkHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\NewSubHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ProtectHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Rar\Headers\SignHeader.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoBinaryReader.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoWrapper.cs" />
|
||||
<Compile Include="Common\Rar\RarEntry.cs" />
|
||||
<Compile Include="Common\Rar\RarFilePart.cs" />
|
||||
<Compile Include="Common\Rar\RarRijndael.Portable.cs" />
|
||||
<Compile Include="Common\Rar\RarVolume.cs" />
|
||||
<Compile Include="Common\ReaderExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveDatabase.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveReader.cs" />
|
||||
<Compile Include="Common\SevenZip\CBindPair.cs" />
|
||||
<Compile Include="Common\SevenZip\CCoderInfo.cs" />
|
||||
<Compile Include="Common\SevenZip\CFileItem.cs" />
|
||||
<Compile Include="Common\SevenZip\CFolder.cs" />
|
||||
<Compile Include="Common\SevenZip\CMethodId.cs" />
|
||||
<Compile Include="Common\SevenZip\CStreamSwitch.cs" />
|
||||
<Compile Include="Common\SevenZip\DataReader.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipEntry.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipFilePart.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipVolume.cs" />
|
||||
<Compile Include="Common\Tar\Headers\TarHeader.cs" />
|
||||
<Compile Include="Common\Tar\TarEntry.cs" />
|
||||
<Compile Include="Common\Tar\TarFilePart.cs" />
|
||||
<Compile Include="Common\Tar\TarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Tar\TarReadOnlySubStream.cs" />
|
||||
<Compile Include="Common\Tar\TarVolume.cs" />
|
||||
<Compile Include="Common\Volume.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEndHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\HeaderFlags.cs" />
|
||||
<Compile Include="Common\Zip\Headers\IgnoreHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeaderExtraFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\SplitHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipFileEntry.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeaderType.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalCryptoStream.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalEncryptionData.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesCryptoStream.Portable.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesEncryptionData.Portable.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesKeySize.cs" />
|
||||
<Compile Include="Common\Zip\ZipCompressionMethod.cs" />
|
||||
<Compile Include="Common\Zip\ZipEntry.cs" />
|
||||
<Compile Include="Common\Zip\ZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\ZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\ZipVolume.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Stream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2InputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2OutputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CRC.cs" />
|
||||
<Compile Include="Compressor\CompressionMode.cs" />
|
||||
<Compile Include="Compressor\Deflate\CRC32.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateManager.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\FlushType.cs" />
|
||||
<Compile Include="Compressor\Deflate\GZipStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\Inflate.cs" />
|
||||
<Compile Include="Compressor\Deflate\InfTree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Tree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Zlib.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibBaseStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibCodec.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibConstants.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibStream.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJ2Filter.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJFilter.cs" />
|
||||
<Compile Include="Compressor\Filters\Filter.cs" />
|
||||
<Compile Include="Compressor\LZMA\Bcj2DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\BitVector.cs" />
|
||||
<Compile Include="Compressor\LZMA\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\ICoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\Log.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaBase.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaDecoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoderProperties.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzBinTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzInWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzOutWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBit.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBitTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\Registry.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcBuilderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcCheckStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\IPasswordProvider.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\Utils.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\FreqData.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\ModelPPM.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\PPMContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarMemBlock.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SEE2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\State.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\StateRef.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SubAllocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Allocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Coder.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\MemoryNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Model.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\ModelRestorationMethod.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmState.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\See2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdProperties.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdStream.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\AudioVariables.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\BitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\CodeType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Compress.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Decode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\DistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\FilterType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LowDistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\MultDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\RepDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\MultiVolumeReadOnlyStream.cs" />
|
||||
<Compile Include="Compressor\Rar\PPM\BlockTypes.cs" />
|
||||
<Compile Include="Compressor\Rar\RarCRC.cs" />
|
||||
<Compile Include="Compressor\Rar\RarStream.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack15.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack20.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackFilter.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackUtility.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\BitInput.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\RarVM.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCmdFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCommands.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMOpType.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedCommand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedOperand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedProgram.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilters.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilterSignature.cs" />
|
||||
<Compile Include="Crypto\BigInteger.cs" />
|
||||
<Compile Include="Crypto\BufferedBlockCipher.cs" />
|
||||
<Compile Include="Crypto\BufferedCipherBase.cs" />
|
||||
<Compile Include="Crypto\CryptoException.cs" />
|
||||
<Compile Include="Crypto\DataLengthException.cs" />
|
||||
<Compile Include="Crypto\GeneralDigest.cs" />
|
||||
<Compile Include="Crypto\HMac.cs" />
|
||||
<Compile Include="Crypto\IBlockCipher.cs" />
|
||||
<Compile Include="Crypto\IBufferedCipher.cs" />
|
||||
<Compile Include="Crypto\ICipherParameters.cs" />
|
||||
<Compile Include="Crypto\IDigest.cs" />
|
||||
<Compile Include="Crypto\IMac.cs" />
|
||||
<Compile Include="Crypto\KeyParameter.cs" />
|
||||
<Compile Include="Crypto\PBKDF2.cs" />
|
||||
<Compile Include="Crypto\RijndaelEngine.cs" />
|
||||
<Compile Include="Crypto\Pack.cs" />
|
||||
<Compile Include="Crypto\Sha1Digest.cs" />
|
||||
<Compile Include="IO\AppendingStream.cs" />
|
||||
<Compile Include="IO\CountingWritableSubStream.cs" />
|
||||
<Compile Include="IO\ListeningStream.cs" />
|
||||
<Compile Include="IO\MarkingBinaryReader.cs" />
|
||||
<Compile Include="IO\NonDisposingStream.cs" />
|
||||
<Compile Include="IO\ReadOnlySubStream.cs" />
|
||||
<Compile Include="IO\RewindableStream.cs" />
|
||||
<Compile Include="IO\StreamingMode.cs" />
|
||||
<Compile Include="LazyReadOnlyCollection.cs" />
|
||||
<Compile Include="Reader\AbstractReader.cs" />
|
||||
<Compile Include="Reader\GZip\GZipReader.cs" />
|
||||
<Compile Include="Reader\IReader.cs" />
|
||||
<Compile Include="Reader\IReader.Extensions.cs" />
|
||||
<Compile Include="Reader\IReaderExtractionListener.cs" />
|
||||
<Compile Include="Reader\Rar\MultiVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\Rar\NonSeekableStreamFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\RarReader.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderEntry.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderVolume.cs" />
|
||||
<Compile Include="Reader\Rar\SingleVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\ReaderFactory.cs" />
|
||||
<Compile Include="Reader\Tar\TarReader.cs" />
|
||||
<Compile Include="Reader\Zip\ZipReader.cs" />
|
||||
<Compile Include="ReadOnlyCollection.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="Writer\AbstractWriter.cs" />
|
||||
<Compile Include="Writer\GZip\GZipWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.Extensions.cs" />
|
||||
<Compile Include="Writer\Tar\TarWriter.cs" />
|
||||
<Compile Include="Writer\WriterFactory.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCentralDirectoryEntry.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCompressionInfo.cs" />
|
||||
<Compile Include="Writer\Zip\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SharpCompress.pfx" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,394 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{10A689CF-76A2-4A4F-96E4-553C33398438}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SharpCompress</RootNamespace>
|
||||
<AssemblyName>SharpCompress</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<BaseIntermediateOutputPath>obj\Full\</BaseIntermediateOutputPath>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\sharpcompress\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\Full\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;DISABLE_TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\Full\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SharpCompress.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Archive\IWritableArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarFilePart.cs" />
|
||||
<Compile Include="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\IWritableArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\ArchiveFactory.cs" />
|
||||
<Compile Include="Archive\GZip\GZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchive.cs" />
|
||||
<Compile Include="Archive\GZip\GZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntryFactory.cs" />
|
||||
<Compile Include="Archive\IArchive.cs" />
|
||||
<Compile Include="Archive\Rar\StreamRarArchiveVolume.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchive.cs" />
|
||||
<Compile Include="Archive\SevenZip\SevenZipArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchive.cs" />
|
||||
<Compile Include="Archive\Tar\TarArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Tar\TarWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipWritableArchiveEntry.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchive.cs" />
|
||||
<Compile Include="Archive\Zip\ZipArchiveEntry.cs" />
|
||||
<Compile Include="Common\ArchiveException.cs" />
|
||||
<Compile Include="Common\ArchiveExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\CompressedBytesReadEventArgs.cs" />
|
||||
<Compile Include="Common\CompressionInfo.cs" />
|
||||
<Compile Include="Common\CompressionType.cs" />
|
||||
<Compile Include="Common\FilePartExtractionBeginEventArgs.cs" />
|
||||
<Compile Include="Archive\IArchiveExtractionListener.cs" />
|
||||
<Compile Include="Common\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\MultiVolumeExtractionException.cs" />
|
||||
<Compile Include="Common\PasswordProtectedException.cs" />
|
||||
<Compile Include="Common\CryptographicException.cs" />
|
||||
<Compile Include="Common\FlagUtility.cs" />
|
||||
<Compile Include="Common\GZip\GZipEntry.cs" />
|
||||
<Compile Include="Common\GZip\GZipFilePart.cs" />
|
||||
<Compile Include="Common\GZip\GZipVolume.cs" />
|
||||
<Compile Include="Common\ExtractOptions.cs" />
|
||||
<Compile Include="Common\FilePart.cs" />
|
||||
<Compile Include="Common\Entry.cs" />
|
||||
<Compile Include="Common\IEntry.cs" />
|
||||
<Compile Include="Common\IVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoWrapper.cs" />
|
||||
<Compile Include="Common\Rar\RarRijndael.cs" />
|
||||
<Compile Include="Common\ReaderExtractionEventArgs.cs" />
|
||||
<Compile Include="Common\SevenZip\CBindPair.cs" />
|
||||
<Compile Include="Common\SevenZip\CCoderInfo.cs" />
|
||||
<Compile Include="Common\SevenZip\CFileItem.cs" />
|
||||
<Compile Include="Common\SevenZip\CFolder.cs" />
|
||||
<Compile Include="Common\SevenZip\CStreamSwitch.cs" />
|
||||
<Compile Include="Common\SevenZip\DataReader.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipEntry.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipFilePart.cs" />
|
||||
<Compile Include="Common\SevenZip\SevenZipVolume.cs" />
|
||||
<Compile Include="Common\Tar\Headers\TarHeader.cs" />
|
||||
<Compile Include="Common\Tar\TarReadOnlySubStream.cs" />
|
||||
<Compile Include="Common\Tar\TarVolume.cs" />
|
||||
<Compile Include="Common\Tar\TarEntry.cs" />
|
||||
<Compile Include="Common\Tar\TarFilePart.cs" />
|
||||
<Compile Include="Common\Tar\TarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\HeaderFlags.cs" />
|
||||
<Compile Include="Common\Zip\Headers\IgnoreHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeaderExtraFactory.cs" />
|
||||
<Compile Include="Common\Zip\Headers\SplitHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipFileEntry.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeaderType.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\SeekableZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\StreamingZipHeaderFactory.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesCryptoStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Common\Zip\WinzipAesEncryptionData.cs" />
|
||||
<Compile Include="Common\Zip\WinzipAesKeySize.cs" />
|
||||
<Compile Include="Common\Zip\ZipVolume.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Constants.cs" />
|
||||
<Compile Include="Compressor\BZip2\BZip2Stream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2InputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CBZip2OutputStream.cs" />
|
||||
<Compile Include="Compressor\BZip2\CRC.cs" />
|
||||
<Compile Include="Compressor\CompressionMode.cs" />
|
||||
<Compile Include="Compressor\Deflate\FlushType.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalCryptoStream.cs" />
|
||||
<Compile Include="Common\Zip\PkwareTraditionalEncryptionData.cs" />
|
||||
<Compile Include="Compressor\Deflate\GZipStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\Filters\BCJ2Filter.cs" />
|
||||
<Compile Include="Compressor\Filters\BCJFilter.cs" />
|
||||
<Compile Include="Compressor\Filters\Filter.cs" />
|
||||
<Compile Include="Compressor\LZMA\BitVector.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LZ\CRC.cs" />
|
||||
<Compile Include="Compressor\LZMA\CRC.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveDatabase.cs" />
|
||||
<Compile Include="Common\SevenZip\ArchiveReader.cs" />
|
||||
<Compile Include="Common\SevenZip\CMethodId.cs" />
|
||||
<Compile Include="Compressor\LZMA\AesDecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Bcj2DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\DecoderStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\Registry.cs" />
|
||||
<Compile Include="Compressor\LZMA\ICoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\Log.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\LzmaBase.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaDecoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaEncoderProperties.cs" />
|
||||
<Compile Include="Compressor\LZMA\LzmaStream.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzBinTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzInWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\LZ\LzOutWindow.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBit.cs" />
|
||||
<Compile Include="Compressor\LZMA\RangeCoder\RangeCoderBitTree.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcBuilderStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\CrcCheckStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\IPasswordProvider.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\LZMA\Utilites\Utils.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Compressor\PPMd\H\FreqData.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\ModelPPM.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\PPMContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RangeCoder.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarMemBlock.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\RarNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SEE2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\State.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\StateRef.cs" />
|
||||
<Compile Include="Compressor\PPMd\H\SubAllocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Allocator.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Coder.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\MemoryNode.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Model.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\ModelRestorationMethod.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\Pointer.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmContext.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\PpmState.cs" />
|
||||
<Compile Include="Compressor\PPMd\I1\See2Context.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdProperties.cs" />
|
||||
<Compile Include="Compressor\PPMd\PpmdStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarStream.cs" />
|
||||
<Compile Include="IO\CountingWritableSubStream.cs" />
|
||||
<Compile Include="Common\EntryStream.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IO\ListeningStream.cs" />
|
||||
<Compile Include="IO\NonDisposingStream.cs" />
|
||||
<Compile Include="Common\Rar\RarCryptoBinaryReader.cs" />
|
||||
<Compile Include="IO\RewindableStream.cs" />
|
||||
<Compile Include="Reader\GZip\GZipReader.cs" />
|
||||
<Compile Include="Reader\IReaderExtractionListener.cs" />
|
||||
<Compile Include="Reader\ReaderFactory.cs" />
|
||||
<Compile Include="Reader\AbstractReader.cs" />
|
||||
<Compile Include="Common\Volume.cs" />
|
||||
<Compile Include="Compressor\Deflate\CRC32.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateManager.cs" />
|
||||
<Compile Include="Compressor\Deflate\DeflateStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\Inflate.cs" />
|
||||
<Compile Include="Compressor\Deflate\InfTree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Tree.cs" />
|
||||
<Compile Include="Compressor\Deflate\Zlib.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibBaseStream.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibCodec.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibConstants.cs" />
|
||||
<Compile Include="Compressor\Deflate\ZlibStream.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileNameDecoder.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="IO\ReadOnlySubStream.cs" />
|
||||
<Compile Include="IO\StreamingMode.cs" />
|
||||
<Compile Include="Common\IExtractionListener.cs" />
|
||||
<Compile Include="Common\MultipartStreamRequiredException.cs" />
|
||||
<Compile Include="LazyReadOnlyCollection.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.Extensions.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveEntry.cs" />
|
||||
<Compile Include="Common\ExtractionException.cs" />
|
||||
<Compile Include="Common\Rar\RarEntry.cs" />
|
||||
<Compile Include="Common\Options.cs" />
|
||||
<Compile Include="Reader\IReader.cs" />
|
||||
<Compile Include="Reader\Rar\MultiVolumeRarReader.cs" />
|
||||
<Compile Include="Reader\Rar\RarReader.cs" />
|
||||
<Compile Include="Reader\IReader.Extensions.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderEntry.cs" />
|
||||
<Compile Include="Archive\Rar\SeekableFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\SingleVolumeRarReader.cs" />
|
||||
<Compile Include="Common\ArchiveType.cs" />
|
||||
<Compile Include="Reader\Tar\TarReader.cs" />
|
||||
<Compile Include="ReadOnlyCollection.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
<Compile Include="Archive\Rar\FileInfoRarArchiveVolume.cs" />
|
||||
<Compile Include="Common\Rar\RarFilePart.cs" />
|
||||
<Compile Include="Common\Rar\Headers\AVHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\CommentHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\EndArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\SignHeader.cs" />
|
||||
<Compile Include="Common\Rar\RarVolume.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackUtility.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchive.cs" />
|
||||
<Compile Include="Compressor\Rar\MultiVolumeReadOnlyStream.cs" />
|
||||
<Compile Include="Compressor\Rar\RarCRC.cs" />
|
||||
<Compile Include="Common\Rar\Headers\FileHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ArchiveHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeader.cs" />
|
||||
<Compile Include="IO\MarkingBinaryReader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\NewSubHeader.cs" />
|
||||
<Compile Include="Common\Rar\Headers\ProtectHeader.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Common\Rar\Headers\RarHeaderFactory.cs" />
|
||||
<Compile Include="Common\Rar\Headers\Flags.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\AudioVariables.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\BitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\CodeType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Compress.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\Decode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\DistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\FilterType.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LitDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\LowDistDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\MultDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\Decode\RepDecode.cs" />
|
||||
<Compile Include="Compressor\Rar\PPM\BlockTypes.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack15.cs" />
|
||||
<Compile Include="Compressor\Rar\Unpack20.cs" />
|
||||
<Compile Include="Compressor\Rar\UnpackFilter.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\BitInput.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\RarVM.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCmdFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMCommands.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMFlags.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMOpType.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedCommand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedOperand.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMPreparedProgram.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilters.cs" />
|
||||
<Compile Include="Compressor\Rar\VM\VMStandardFilterSignature.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="Common\Rar\Headers\MarkHeader.cs" />
|
||||
<Compile Include="Archive\Rar\RarArchiveVolumeFactory.cs" />
|
||||
<Compile Include="Reader\Rar\NonSeekableStreamFilePart.cs" />
|
||||
<Compile Include="Reader\Rar\RarReaderVolume.cs" />
|
||||
<Compile Include="Common\Zip\ZipCompressionMethod.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEndHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\DirectoryEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\Headers\LocalEntryHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipFilePart.cs" />
|
||||
<Compile Include="Common\Zip\Headers\ZipHeader.cs" />
|
||||
<Compile Include="Common\Zip\ZipHeaderFactory.cs" />
|
||||
<Compile Include="Reader\Zip\ZipReader.cs" />
|
||||
<Compile Include="Common\Zip\ZipEntry.cs" />
|
||||
<Compile Include="Writer\AbstractWriter.cs" />
|
||||
<Compile Include="Writer\GZip\GZipWriter.cs" />
|
||||
<Compile Include="Writer\IWriter.Extensions.cs" />
|
||||
<Compile Include="Writer\IWriter.cs" />
|
||||
<Compile Include="Writer\Tar\TarWriter.cs" />
|
||||
<Compile Include="Writer\WriterFactory.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCentralDirectoryEntry.cs" />
|
||||
<Compile Include="Writer\Zip\ZipCompressionInfo.cs" />
|
||||
<Compile Include="Writer\Zip\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SharpCompress.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,482 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Archive;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress
|
||||
{
|
||||
internal static class Utility
|
||||
{
|
||||
public static ReadOnlyCollection<T> ToReadOnly<T>(this IEnumerable<T> items)
|
||||
{
|
||||
return new ReadOnlyCollection<T>(items.ToList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an unsigned bitwise right shift with the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">Number to operate on</param>
|
||||
/// <param name="bits">Ammount of bits to shift</param>
|
||||
/// <returns>The resulting number from the shift operation</returns>
|
||||
public static int URShift(int number, int bits)
|
||||
{
|
||||
if (number >= 0)
|
||||
return number >> bits;
|
||||
else
|
||||
return (number >> bits) + (2 << ~bits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an unsigned bitwise right shift with the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">Number to operate on</param>
|
||||
/// <param name="bits">Ammount of bits to shift</param>
|
||||
/// <returns>The resulting number from the shift operation</returns>
|
||||
public static int URShift(int number, long bits)
|
||||
{
|
||||
return URShift(number, (int)bits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an unsigned bitwise right shift with the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">Number to operate on</param>
|
||||
/// <param name="bits">Ammount of bits to shift</param>
|
||||
/// <returns>The resulting number from the shift operation</returns>
|
||||
public static long URShift(long number, int bits)
|
||||
{
|
||||
if (number >= 0)
|
||||
return number >> bits;
|
||||
else
|
||||
return (number >> bits) + (2L << ~bits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs an unsigned bitwise right shift with the specified number
|
||||
/// </summary>
|
||||
/// <param name="number">Number to operate on</param>
|
||||
/// <param name="bits">Ammount of bits to shift</param>
|
||||
/// <returns>The resulting number from the shift operation</returns>
|
||||
public static long URShift(long number, long bits)
|
||||
{
|
||||
return URShift(number, (int)bits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills the array with an specific value from an specific index to an specific index.
|
||||
/// </summary>
|
||||
/// <param name="array">The array to be filled.</param>
|
||||
/// <param name="fromindex">The first index to be filled.</param>
|
||||
/// <param name="toindex">The last index to be filled.</param>
|
||||
/// <param name="val">The value to fill the array with.</param>
|
||||
public static void Fill<T>(T[] array, int fromindex, int toindex, T val) where T : struct
|
||||
{
|
||||
if (array.Length == 0)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
if (fromindex > toindex)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
if ((fromindex < 0) || ((System.Array)array).Length < toindex)
|
||||
{
|
||||
throw new IndexOutOfRangeException();
|
||||
}
|
||||
for (int index = (fromindex > 0) ? fromindex-- : fromindex; index < toindex; index++)
|
||||
{
|
||||
array[index] = val;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills the array with an specific value.
|
||||
/// </summary>
|
||||
/// <param name="array">The array to be filled.</param>
|
||||
/// <param name="val">The value to fill the array with.</param>
|
||||
public static void Fill<T>(T[] array, T val) where T : struct
|
||||
{
|
||||
Fill(array, 0, array.Length, val);
|
||||
}
|
||||
|
||||
public static void SetSize(this List<byte> list, int count)
|
||||
{
|
||||
if (count > list.Count)
|
||||
{
|
||||
for (int i = list.Count; i < count; i++)
|
||||
{
|
||||
list.Add(0x0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] temp = new byte[count];
|
||||
list.CopyTo(temp, 0);
|
||||
list.Clear();
|
||||
list.AddRange(temp);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Read a int value from the byte array at the given position (Big Endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array to read from
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <returns> the value
|
||||
/// </returns>
|
||||
public static int readIntBigEndian(byte[] array, int pos)
|
||||
{
|
||||
int temp = 0;
|
||||
temp |= array[pos] & 0xff;
|
||||
temp <<= 8;
|
||||
temp |= array[pos + 1] & 0xff;
|
||||
temp <<= 8;
|
||||
temp |= array[pos + 2] & 0xff;
|
||||
temp <<= 8;
|
||||
temp |= array[pos + 3] & 0xff;
|
||||
return temp;
|
||||
}
|
||||
|
||||
/// <summary> Read a short value from the byte array at the given position (little
|
||||
/// Endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array to read from
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <returns> the value
|
||||
/// </returns>
|
||||
public static short readShortLittleEndian(byte[] array, int pos)
|
||||
{
|
||||
return BitConverter.ToInt16(array, pos);
|
||||
}
|
||||
|
||||
/// <summary> Read an int value from the byte array at the given position (little
|
||||
/// Endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array to read from
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <returns> the value
|
||||
/// </returns>
|
||||
public static int readIntLittleEndian(byte[] array, int pos)
|
||||
{
|
||||
return BitConverter.ToInt32(array, pos);
|
||||
}
|
||||
|
||||
/// <summary> Write an int value into the byte array at the given position (Big endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <param name="value">the value to write
|
||||
/// </param>
|
||||
public static void writeIntBigEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
array[pos] = (byte)((Utility.URShift(value, 24)) & 0xff);
|
||||
array[pos + 1] = (byte)((Utility.URShift(value, 16)) & 0xff);
|
||||
array[pos + 2] = (byte)((Utility.URShift(value, 8)) & 0xff);
|
||||
array[pos + 3] = (byte)((value) & 0xff);
|
||||
}
|
||||
|
||||
/// <summary> Write a short value into the byte array at the given position (little
|
||||
/// endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <param name="value">the value to write
|
||||
/// </param>
|
||||
public static void WriteLittleEndian(byte[] array, int pos, short value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Array.Reverse(newBytes);
|
||||
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
|
||||
/// <summary> Increment a short value at the specified position by the specified amount
|
||||
/// (little endian).
|
||||
/// </summary>
|
||||
public static void incShortLittleEndian(byte[] array, int pos, short incrementValue)
|
||||
{
|
||||
short existingValue = BitConverter.ToInt16(array, pos);
|
||||
existingValue += incrementValue;
|
||||
WriteLittleEndian(array, pos, existingValue);
|
||||
//int c = Utility.URShift(((array[pos] & 0xff) + (dv & 0xff)), 8);
|
||||
//array[pos] = (byte)(array[pos] + (dv & 0xff));
|
||||
//if ((c > 0) || ((dv & 0xff00) != 0))
|
||||
//{
|
||||
// array[pos + 1] = (byte)(array[pos + 1] + ((Utility.URShift(dv, 8)) & 0xff) + c);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary> Write an int value into the byte array at the given position (little
|
||||
/// endian)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="array">the array
|
||||
/// </param>
|
||||
/// <param name="pos">the offset
|
||||
/// </param>
|
||||
/// <param name="value">the value to write
|
||||
/// </param>
|
||||
public static void WriteLittleEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
Array.Reverse(newBytes);
|
||||
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
|
||||
public static void Initialize<T>(this T[] array, Func<T> func)
|
||||
{
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i] = func();
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddRange<T>(this ICollection<T> destination, IEnumerable<T> source)
|
||||
{
|
||||
foreach (T item in source)
|
||||
{
|
||||
destination.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ForEach<T>(this IEnumerable<T> items, Action<T> action)
|
||||
{
|
||||
foreach (T item in items)
|
||||
{
|
||||
action(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<T> AsEnumerable<T>(this T item)
|
||||
{
|
||||
yield return item;
|
||||
}
|
||||
|
||||
public static void CheckNotNull(this object obj, string name)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
throw new ArgumentNullException(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CheckNotNullOrEmpty(this string obj, string name)
|
||||
{
|
||||
obj.CheckNotNull(name);
|
||||
if (obj.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("String is empty.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Skip(this Stream source, long advanceAmount)
|
||||
{
|
||||
byte[] buffer = new byte[32 * 1024];
|
||||
int read = 0;
|
||||
int readCount = 0;
|
||||
do
|
||||
{
|
||||
readCount = buffer.Length;
|
||||
if (readCount > advanceAmount)
|
||||
{
|
||||
readCount = (int)advanceAmount;
|
||||
}
|
||||
read = source.Read(buffer, 0, readCount);
|
||||
if (read < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
advanceAmount -= read;
|
||||
if (advanceAmount == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
public static void SkipAll(this Stream source)
|
||||
{
|
||||
byte[] buffer = new byte[32 * 1024];
|
||||
do
|
||||
{
|
||||
} while (source.Read(buffer, 0, buffer.Length) == buffer.Length);
|
||||
}
|
||||
|
||||
|
||||
public static byte[] UInt32ToBigEndianBytes(uint x)
|
||||
{
|
||||
return new byte[]
|
||||
{
|
||||
(byte) ((x >> 24) & 0xff),
|
||||
(byte) ((x >> 16) & 0xff),
|
||||
(byte) ((x >> 8) & 0xff),
|
||||
(byte) (x & 0xff)
|
||||
};
|
||||
}
|
||||
|
||||
public static DateTime DosDateToDateTime(UInt16 iDate, UInt16 iTime)
|
||||
{
|
||||
int year = iDate / 512 + 1980;
|
||||
int month = iDate % 512 / 32;
|
||||
int day = iDate % 512 % 32;
|
||||
int hour = iTime / 2048;
|
||||
int minute = iTime % 2048 / 32;
|
||||
int second = iTime % 2048 % 32 * 2;
|
||||
|
||||
if (iDate == UInt16.MaxValue || month == 0 || day == 0)
|
||||
{
|
||||
year = 1980;
|
||||
month = 1;
|
||||
day = 1;
|
||||
}
|
||||
|
||||
if (iTime == UInt16.MaxValue)
|
||||
{
|
||||
hour = minute = second = 0;
|
||||
}
|
||||
|
||||
DateTime dt;
|
||||
try
|
||||
{
|
||||
dt = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Local);
|
||||
}
|
||||
catch
|
||||
{
|
||||
dt = new DateTime();
|
||||
}
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static uint DateTimeToDosTime(this DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var localDateTime = dateTime.Value.ToLocalTime();
|
||||
|
||||
return (uint)(
|
||||
(localDateTime.Second / 2) | (localDateTime.Minute << 5) | (localDateTime.Hour << 11) |
|
||||
(localDateTime.Day << 16) | (localDateTime.Month << 21) |
|
||||
((localDateTime.Year - 1980) << 25));
|
||||
}
|
||||
|
||||
|
||||
public static DateTime DosDateToDateTime(UInt32 iTime)
|
||||
{
|
||||
return DosDateToDateTime((UInt16)(iTime / 65536),
|
||||
(UInt16)(iTime % 65536));
|
||||
}
|
||||
|
||||
public static DateTime DosDateToDateTime(Int32 iTime)
|
||||
{
|
||||
return DosDateToDateTime((UInt32)iTime);
|
||||
}
|
||||
|
||||
public static long TransferTo(this Stream source, Stream destination)
|
||||
{
|
||||
byte[] array = new byte[81920];
|
||||
int count;
|
||||
long total = 0;
|
||||
while ((count = source.Read(array, 0, array.Length)) != 0)
|
||||
{
|
||||
total += count;
|
||||
destination.Write(array, 0, count);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public static bool ReadFully(this Stream stream, byte[] buffer)
|
||||
{
|
||||
int total = 0;
|
||||
int read;
|
||||
while ((read = stream.Read(buffer, total, buffer.Length - total)) > 0)
|
||||
{
|
||||
total += read;
|
||||
if (total >= buffer.Length)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return (total >= buffer.Length);
|
||||
}
|
||||
|
||||
public static string TrimNulls(this string source)
|
||||
{
|
||||
return source.Replace('\0', ' ').Trim();
|
||||
}
|
||||
|
||||
public static bool BinaryEquals(this byte[] source, byte[] target)
|
||||
{
|
||||
if (source.Length != target.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < source.Length; ++i)
|
||||
{
|
||||
if (source[i] != target[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if PORTABLE || NETFX_CORE
|
||||
public static void CopyTo(this byte[] array, byte[] destination, int index)
|
||||
{
|
||||
Array.Copy(array, 0, destination, index, array.Length);
|
||||
}
|
||||
|
||||
public static long HostToNetworkOrder(long host)
|
||||
{
|
||||
return (int)((long)HostToNetworkOrder((int)host)
|
||||
& unchecked((long)(unchecked((ulong)-1))) << 32
|
||||
| ((long)HostToNetworkOrder((int)((int)host >> 32)) & unchecked((long)(unchecked((ulong)-1)))));
|
||||
}
|
||||
public static int HostToNetworkOrder(int host)
|
||||
{
|
||||
return (int)((int)(HostToNetworkOrder((short)host) & -1) << 16 | (HostToNetworkOrder((short)(host >> 16)) & -1));
|
||||
}
|
||||
public static short HostToNetworkOrder(short host)
|
||||
{
|
||||
return (short)((int)(host & 255) << 8 | ((int)host >> 8 & 255));
|
||||
}
|
||||
public static long NetworkToHostOrder(long network)
|
||||
{
|
||||
return HostToNetworkOrder(network);
|
||||
}
|
||||
public static int NetworkToHostOrder(int network)
|
||||
{
|
||||
return HostToNetworkOrder(network);
|
||||
}
|
||||
public static short NetworkToHostOrder(short network)
|
||||
{
|
||||
return HostToNetworkOrder(network);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Reflection;
|
||||
#if !PORTABLE
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCopyright("Copyright © Adam Hathcock")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: AssemblyVersion("0.11.2.0")]
|
||||
[assembly: AssemblyFileVersion("0.11.2.0")]
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Writer.GZip;
|
||||
using SharpCompress.Writer.Tar;
|
||||
using SharpCompress.Writer.Zip;
|
||||
|
||||
namespace SharpCompress.Writer
|
||||
{
|
||||
public static class WriterFactory
|
||||
{
|
||||
public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionType compressionType)
|
||||
{
|
||||
return Open(stream, archiveType, new CompressionInfo
|
||||
{
|
||||
Type = compressionType
|
||||
});
|
||||
}
|
||||
|
||||
public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionInfo compressionInfo)
|
||||
{
|
||||
switch (archiveType)
|
||||
{
|
||||
case ArchiveType.GZip:
|
||||
{
|
||||
if (compressionInfo.Type != CompressionType.GZip)
|
||||
{
|
||||
throw new InvalidFormatException("GZip archives only support GZip compression type.");
|
||||
}
|
||||
return new GZipWriter(stream);
|
||||
}
|
||||
case ArchiveType.Zip:
|
||||
{
|
||||
return new ZipWriter(stream, compressionInfo, null);
|
||||
}
|
||||
case ArchiveType.Tar:
|
||||
{
|
||||
return new TarWriter(stream, compressionInfo);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException("Archive Type does not have a Writer: " + archiveType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SharpCompress.Common.Zip;
|
||||
using SharpCompress.Common.Zip.Headers;
|
||||
|
||||
namespace SharpCompress.Writer.Zip
|
||||
{
|
||||
internal class ZipCentralDirectoryEntry
|
||||
{
|
||||
internal string FileName { get; set; }
|
||||
internal DateTime? ModificationTime { get; set; }
|
||||
internal string Comment { get; set; }
|
||||
internal uint Crc { get; set; }
|
||||
internal uint HeaderOffset { get; set; }
|
||||
internal uint Compressed { get; set; }
|
||||
internal uint Decompressed { get; set; }
|
||||
|
||||
|
||||
internal uint Write(Stream outputStream, ZipCompressionMethod compression)
|
||||
{
|
||||
byte[] encodedFilename = Encoding.UTF8.GetBytes(FileName);
|
||||
byte[] encodedComment = Encoding.UTF8.GetBytes(Comment);
|
||||
|
||||
outputStream.Write(new byte[] {80, 75, 1, 2, 0x3F, 0, 0x0A, 0}, 0, 8);
|
||||
HeaderFlags flags = HeaderFlags.UTF8;
|
||||
if (!outputStream.CanSeek)
|
||||
{
|
||||
flags |= HeaderFlags.UsePostDataDescriptor;
|
||||
if (compression == ZipCompressionMethod.LZMA)
|
||||
{
|
||||
flags |= HeaderFlags.Bit1; // eos marker
|
||||
}
|
||||
}
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) flags), 0, 2);
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) compression), 0, 2); // zipping method
|
||||
outputStream.Write(BitConverter.GetBytes(ModificationTime.DateTimeToDosTime()), 0, 4);
|
||||
// zipping date and time
|
||||
outputStream.Write(BitConverter.GetBytes(Crc), 0, 4); // file CRC
|
||||
outputStream.Write(BitConverter.GetBytes(Compressed), 0, 4); // compressed file size
|
||||
outputStream.Write(BitConverter.GetBytes(Decompressed), 0, 4); // uncompressed file size
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) encodedFilename.Length), 0, 2); // Filename in zip
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) 0), 0, 2); // extra length
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) encodedComment.Length), 0, 2);
|
||||
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) 0), 0, 2); // disk=0
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) 0), 0, 2); // file type: binary
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) 0), 0, 2); // Internal file attributes
|
||||
outputStream.Write(BitConverter.GetBytes((ushort) 0x8100), 0, 2);
|
||||
// External file attributes (normal/readable)
|
||||
outputStream.Write(BitConverter.GetBytes(HeaderOffset), 0, 4); // Offset of header
|
||||
|
||||
outputStream.Write(encodedFilename, 0, encodedFilename.Length);
|
||||
outputStream.Write(encodedComment, 0, encodedComment.Length);
|
||||
|
||||
return (uint) (8 + 2 + 2 + 4 + 4 + 4 + 4 + 2 + 2 + 2
|
||||
+ 2 + 2 + 2 + 2 + 4 + encodedFilename.Length + encodedComment.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Zip;
|
||||
using SharpCompress.Compressor.Deflate;
|
||||
|
||||
namespace SharpCompress.Writer.Zip
|
||||
{
|
||||
internal class ZipCompressionInfo
|
||||
{
|
||||
internal CompressionLevel DeflateCompressionLevel { get; private set; }
|
||||
internal ZipCompressionMethod Compression { get; private set; }
|
||||
|
||||
public ZipCompressionInfo(CompressionInfo compressionInfo)
|
||||
{
|
||||
switch (compressionInfo.Type)
|
||||
{
|
||||
case CompressionType.None:
|
||||
{
|
||||
this.Compression = ZipCompressionMethod.None;
|
||||
}
|
||||
break;
|
||||
case CompressionType.Deflate:
|
||||
{
|
||||
this.DeflateCompressionLevel = compressionInfo.DeflateCompressionLevel;
|
||||
this.Compression = ZipCompressionMethod.Deflate;
|
||||
}
|
||||
break;
|
||||
case CompressionType.BZip2:
|
||||
{
|
||||
this.Compression = ZipCompressionMethod.BZip2;
|
||||
}
|
||||
break;
|
||||
case CompressionType.LZMA:
|
||||
{
|
||||
this.Compression = ZipCompressionMethod.LZMA;
|
||||
}
|
||||
break;
|
||||
case CompressionType.PPMd:
|
||||
{
|
||||
this.Compression = ZipCompressionMethod.PPMd;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidFormatException("Invalid compression method: " + compressionInfo.Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,295 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Zip;
|
||||
using SharpCompress.Common.Zip.Headers;
|
||||
using SharpCompress.Compressor;
|
||||
using SharpCompress.Compressor.BZip2;
|
||||
using SharpCompress.Compressor.Deflate;
|
||||
using SharpCompress.Compressor.LZMA;
|
||||
using SharpCompress.Compressor.PPMd;
|
||||
using SharpCompress.IO;
|
||||
using DeflateStream = SharpCompress.Compressor.Deflate.DeflateStream;
|
||||
|
||||
namespace SharpCompress.Writer.Zip
|
||||
{
|
||||
public class ZipWriter : AbstractWriter
|
||||
{
|
||||
private readonly ZipCompressionInfo zipCompressionInfo;
|
||||
private readonly PpmdProperties ppmdProperties = new PpmdProperties(); // Caching properties to speed up PPMd
|
||||
private readonly List<ZipCentralDirectoryEntry> entries = new List<ZipCentralDirectoryEntry>();
|
||||
private readonly string zipComment;
|
||||
private long streamPosition;
|
||||
|
||||
public ZipWriter(Stream destination, CompressionInfo compressionInfo, string zipComment)
|
||||
: base(ArchiveType.Zip)
|
||||
{
|
||||
this.zipComment = zipComment ?? string.Empty;
|
||||
|
||||
this.zipCompressionInfo = new ZipCompressionInfo(compressionInfo);
|
||||
InitalizeStream(destination, false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (isDisposing)
|
||||
{
|
||||
uint size = 0;
|
||||
foreach (ZipCentralDirectoryEntry entry in entries)
|
||||
{
|
||||
size += entry.Write(OutputStream, zipCompressionInfo.Compression);
|
||||
}
|
||||
WriteEndRecord(size);
|
||||
}
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
public override void Write(string entryPath, Stream source, DateTime? modificationTime)
|
||||
{
|
||||
Write(entryPath, source, modificationTime, null);
|
||||
}
|
||||
|
||||
public void Write(string entryPath, Stream source, DateTime? modificationTime, string comment, CompressionInfo compressionInfo = null)
|
||||
{
|
||||
using (Stream output = WriteToStream(entryPath, modificationTime, comment, compressionInfo))
|
||||
{
|
||||
source.TransferTo(output);
|
||||
}
|
||||
}
|
||||
|
||||
public Stream WriteToStream(string entryPath, DateTime? modificationTime, string comment, CompressionInfo compressionInfo = null)
|
||||
{
|
||||
entryPath = NormalizeFilename(entryPath);
|
||||
modificationTime = modificationTime ?? DateTime.Now;
|
||||
comment = comment ?? "";
|
||||
var entry = new ZipCentralDirectoryEntry
|
||||
{
|
||||
Comment = comment,
|
||||
FileName = entryPath,
|
||||
ModificationTime = modificationTime,
|
||||
HeaderOffset = (uint) streamPosition,
|
||||
};
|
||||
|
||||
var headersize = (uint)WriteHeader(entryPath, modificationTime, compressionInfo);
|
||||
streamPosition += headersize;
|
||||
return new ZipWritingStream(this, OutputStream, entry);
|
||||
}
|
||||
|
||||
private string NormalizeFilename(string filename)
|
||||
{
|
||||
filename = filename.Replace('\\', '/');
|
||||
|
||||
int pos = filename.IndexOf(':');
|
||||
if (pos >= 0)
|
||||
filename = filename.Remove(0, pos + 1);
|
||||
|
||||
return filename.Trim('/');
|
||||
}
|
||||
|
||||
private int WriteHeader(string filename, DateTime? modificationTime, CompressionInfo compressionInfo = null)
|
||||
{
|
||||
var explicitZipCompressionInfo = compressionInfo != null ? new ZipCompressionInfo(compressionInfo) : this.zipCompressionInfo;
|
||||
byte[] encodedFilename = ArchiveEncoding.Default.GetBytes(filename);
|
||||
|
||||
OutputStream.Write(BitConverter.GetBytes(ZipHeaderFactory.ENTRY_HEADER_BYTES), 0, 4);
|
||||
if (explicitZipCompressionInfo.Compression == ZipCompressionMethod.Deflate)
|
||||
{
|
||||
OutputStream.Write(new byte[] {20, 0}, 0, 2); //older version which is more compatible
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputStream.Write(new byte[] {63, 0}, 0, 2); //version says we used PPMd or LZMA
|
||||
}
|
||||
HeaderFlags flags = ArchiveEncoding.Default == Encoding.UTF8 ? HeaderFlags.UTF8 : (HeaderFlags)0;
|
||||
if (!OutputStream.CanSeek)
|
||||
{
|
||||
flags |= HeaderFlags.UsePostDataDescriptor;
|
||||
if (explicitZipCompressionInfo.Compression == ZipCompressionMethod.LZMA)
|
||||
{
|
||||
flags |= HeaderFlags.Bit1; // eos marker
|
||||
}
|
||||
}
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) flags), 0, 2);
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort)explicitZipCompressionInfo.Compression), 0, 2); // zipping method
|
||||
OutputStream.Write(BitConverter.GetBytes(modificationTime.DateTimeToDosTime()), 0, 4);
|
||||
// zipping date and time
|
||||
OutputStream.Write(new byte[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 12);
|
||||
// unused CRC, un/compressed size, updated later
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) encodedFilename.Length), 0, 2); // filename length
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) 0), 0, 2); // extra length
|
||||
OutputStream.Write(encodedFilename, 0, encodedFilename.Length);
|
||||
|
||||
return 6 + 2 + 2 + 4 + 12 + 2 + 2 + encodedFilename.Length;
|
||||
}
|
||||
|
||||
private void WriteFooter(uint crc, uint compressed, uint uncompressed)
|
||||
{
|
||||
OutputStream.Write(BitConverter.GetBytes(crc), 0, 4);
|
||||
OutputStream.Write(BitConverter.GetBytes(compressed), 0, 4);
|
||||
OutputStream.Write(BitConverter.GetBytes(uncompressed), 0, 4);
|
||||
}
|
||||
|
||||
private void WriteEndRecord(uint size)
|
||||
{
|
||||
byte[] encodedComment = ArchiveEncoding.Default.GetBytes(zipComment);
|
||||
|
||||
OutputStream.Write(new byte[] {80, 75, 5, 6, 0, 0, 0, 0}, 0, 8);
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) entries.Count), 0, 2);
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) entries.Count), 0, 2);
|
||||
OutputStream.Write(BitConverter.GetBytes(size), 0, 4);
|
||||
OutputStream.Write(BitConverter.GetBytes((uint) streamPosition), 0, 4);
|
||||
OutputStream.Write(BitConverter.GetBytes((ushort) encodedComment.Length), 0, 2);
|
||||
OutputStream.Write(encodedComment, 0, encodedComment.Length);
|
||||
}
|
||||
|
||||
#region Nested type: ZipWritingStream
|
||||
|
||||
internal class ZipWritingStream : Stream
|
||||
{
|
||||
private readonly CRC32 crc = new CRC32();
|
||||
private readonly ZipCentralDirectoryEntry entry;
|
||||
private readonly Stream originalStream;
|
||||
private readonly Stream writeStream;
|
||||
private readonly ZipWriter writer;
|
||||
private CountingWritableSubStream counting;
|
||||
private uint decompressed;
|
||||
|
||||
internal ZipWritingStream(ZipWriter writer, Stream originalStream, ZipCentralDirectoryEntry entry)
|
||||
{
|
||||
this.writer = writer;
|
||||
this.originalStream = originalStream;
|
||||
writeStream = GetWriteStream(originalStream);
|
||||
this.writer = writer;
|
||||
this.entry = entry;
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotSupportedException(); }
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
private Stream GetWriteStream(Stream writeStream)
|
||||
{
|
||||
counting = new CountingWritableSubStream(writeStream);
|
||||
Stream output = counting;
|
||||
switch (writer.zipCompressionInfo.Compression)
|
||||
{
|
||||
case ZipCompressionMethod.None:
|
||||
{
|
||||
return output;
|
||||
}
|
||||
case ZipCompressionMethod.Deflate:
|
||||
{
|
||||
return new DeflateStream(counting, CompressionMode.Compress, writer.zipCompressionInfo.DeflateCompressionLevel,
|
||||
true);
|
||||
}
|
||||
case ZipCompressionMethod.BZip2:
|
||||
{
|
||||
return new BZip2Stream(counting, CompressionMode.Compress, true);
|
||||
}
|
||||
case ZipCompressionMethod.LZMA:
|
||||
{
|
||||
counting.WriteByte(9);
|
||||
counting.WriteByte(20);
|
||||
counting.WriteByte(5);
|
||||
counting.WriteByte(0);
|
||||
|
||||
LzmaStream lzmaStream = new LzmaStream(new LzmaEncoderProperties(!originalStream.CanSeek),
|
||||
false, counting);
|
||||
counting.Write(lzmaStream.Properties, 0, lzmaStream.Properties.Length);
|
||||
return lzmaStream;
|
||||
}
|
||||
case ZipCompressionMethod.PPMd:
|
||||
{
|
||||
counting.Write(writer.ppmdProperties.Properties, 0, 2);
|
||||
return new PpmdStream(writer.ppmdProperties, counting, true);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException("CompressionMethod: " + writer.zipCompressionInfo.Compression);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (disposing)
|
||||
{
|
||||
writeStream.Dispose();
|
||||
entry.Crc = (uint) crc.Crc32Result;
|
||||
entry.Compressed = counting.Count;
|
||||
entry.Decompressed = decompressed;
|
||||
if (originalStream.CanSeek)
|
||||
{
|
||||
originalStream.Position = entry.HeaderOffset + 6;
|
||||
originalStream.WriteByte(0);
|
||||
originalStream.Position = entry.HeaderOffset + 14;
|
||||
writer.WriteFooter(entry.Crc, counting.Count, decompressed);
|
||||
originalStream.Position = writer.streamPosition + entry.Compressed;
|
||||
writer.streamPosition += entry.Compressed;
|
||||
}
|
||||
else
|
||||
{
|
||||
originalStream.Write(BitConverter.GetBytes(ZipHeaderFactory.POST_DATA_DESCRIPTOR), 0, 4);
|
||||
writer.WriteFooter(entry.Crc, counting.Count, decompressed);
|
||||
writer.streamPosition += entry.Compressed + 16;
|
||||
}
|
||||
writer.entries.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
writeStream.Flush();
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
decompressed += (uint) count;
|
||||
crc.SlurpBlock(buffer, offset, count);
|
||||
writeStream.Write(buffer, offset, count);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeEditing/ContextActionTable/DisabledContextActions/=JetBrains_002EReSharper_002EIntentions_002ECSharp_002EContextActions_002ECatchToCatchExceptionAction/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteBasicCompletion/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/IntelliSenseCompletingCharactersSettingCSharp/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntellisenseEnabled/IntellisenseEnabledSettingCSharp/IntellisenseEnabled/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntellisenseEnabled/IntellisenseEnabledSettingXaml/IntellisenseEnabled/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/LookupWindow/ShowSummary/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/Localization/CSharpLocalizationOptions/DontAnalyseVerbatimStrings/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Ecpp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Eh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022ClassCanBeSealed_002EGlobal_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022ClassCanBeSealed_002ELocal_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022ConvertIfStatementToReturnStatement_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022ConvertIfStatementToSwitchStatement_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022ConvertToAutoPropertyWithPrivateSetter_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022InvertIf_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022LoopCanBePartlyConvertedToQuery_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022MemberCanBeInternal_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022MemberCanBeMadeStatic_002EGlobal_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022MemberCanBeMadeStatic_002ELocal_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022RedundantArgumentNameForLiteralExpression_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022RedundantToStringCallForValueType_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022SimilarAnonymousTypeNearby_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022SuggestBaseTypeForParameter_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022SuggestUseVarKeywordEverywhere_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022TryStatementsCanBeMerged_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022UnknownCssVendorExtension_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CConfigurableSeverity_0020Id_003D_0022Xaml_002EBindingWithoutContextReferenceNotResolvedHighlighting_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/CodeIssueFilter/IssueTypesToHide/=_003CStaticSeverity_0020Severity_003D_00222_0022_0020Title_003D_0022Structural_0020Search_0020Hints_0022_0020GroupId_003D_0022StructuralSearch_0022_0020_002F_003E/@EntryIndexedValue">DoHide</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IdentifierHighlightingEnabled/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FieldCanBeMadeReadOnly_002EGlobal/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=FieldCanBeMadeReadOnly_002ELocal/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ImpureMethodCallOnReadonlyValueField/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleAssignmentToReadonlyField/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantThisQualifier/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SpecifyACultureInStringConversionExplicitly/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEverywhere/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnassignedReadonlyField/@EntryIndexedValue">ERROR</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseObjectOrCollectionInitializer/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Adam_0020Clean/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="Adam Clean"><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_IMPLICIT</ForeachVariableStyle></CSUseVar><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSShortenReferences>True</CSShortenReferences><HtmlReformatCode>True</HtmlReformatCode><JsInsertSemicolon>True</JsInsertSemicolon><JsReformatCode>True</JsReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier></Profile></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=NaaS_0020Clean/@EntryIndexedValue"><?xml version="1.0" encoding="utf-16"?><Profile name="NaaS Clean"><CSReformatCode>True</CSReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReorderTypeMembers>True</CSReorderTypeMembers><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty></Profile></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">NaaS Clean</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Default: Full Cleanup</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_FIRST_ARG_BY_PAREN/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">SEPARATE</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_DO_EXPRESSION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_IF_EXPRESSION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_WHILE_EXPRESSION/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_ANONYMOUS_METHOD_BLOCK/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_INITIALIZER_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_LINQ_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_TYPE_CONSTRAINTS_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_CHAINED_METHOD_CALLS/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_FOR_STMT_HEADER_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_DECLARATION_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_TERNARY_EXPR_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/JavaScriptFormatOther/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Constructor/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Constructor/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Global/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Global/Options/=PropertyBody/@EntryIndexedValue">Automatic property</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Properties/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Properties/Options/=DebuggerStepsThrough/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=Properties/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=ReadProperties/@KeyIndexDefined">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=ReadProperties/Options/=DebuggerStepsThrough/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Generate/=ReadProperties/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EC/@EntryIndexedValue">EC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IIS/@EntryIndexedValue">IIS</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Interfaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Locals/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Other/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Parameters/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypeParameters/@EntryIndexedValue"><Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=Interfaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=LocalConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=Locals/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=Other/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=Parameters/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=TypeParameters/@EntryIndexedValue"><Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsCodeFormatterSettingsUpgrader/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
Binary file not shown.
131
USAGE.md
Normal file
131
USAGE.md
Normal file
@@ -0,0 +1,131 @@
|
||||
# SharpCompress Usage
|
||||
|
||||
## Stream Rules
|
||||
When dealing with Streams, the rule should be that you don't close a stream you didn't create. This, in effect, should mean you should always put a Stream in a using block to dispose it.
|
||||
|
||||
However, the .NET Framework often has classes that will dispose streams by default to make things "easy" like the following:
|
||||
|
||||
```C#
|
||||
using (var reader = new StreamReader(File.Open("foo")))
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
In this example, reader should get disposed. However, stream rules should say the the `FileStream` created by `File.Open` should remain open. However, the .NET Framework closes it for you by default unless you override the constructor. In general, you should be writing Stream code like this:
|
||||
|
||||
```C#
|
||||
using (var fileStream = File.Open("foo"))
|
||||
using (var reader = new StreamReader(fileStream))
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
To deal with the "correct" rules as well as the expectations of users, I've decided on this:
|
||||
|
||||
* When writing, leave streams open.
|
||||
* When reading, close streams
|
||||
|
||||
To be explicit though, consider always using the overloads that use `ReaderOptions` or `WriterOptions` and explicitly set `LeaveStreamOpen` the way you want.
|
||||
|
||||
## Samples
|
||||
|
||||
Also, look over the tests for more thorough [examples](https://github.com/adamhathcock/sharpcompress/tree/master/test/SharpCompress.Test)
|
||||
|
||||
### Create Zip Archive from all files in a directory to a file
|
||||
|
||||
```C#
|
||||
using (var archive = ZipArchive.Create())
|
||||
{
|
||||
archive.AddAllFromDirectory("D:\\temp");
|
||||
archive.SaveTo("C:\\temp.zip", CompressionType.Deflate);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Create Zip Archive from all files in a directory and save in memory
|
||||
|
||||
```C#
|
||||
|
||||
var memoryStream = new MemoryStream();
|
||||
using (var archive = ZipArchive.Create())
|
||||
{
|
||||
archive.AddAllFromDirectory("D:\\temp");
|
||||
archive.SaveTo(memoryStream, new WriterOptions(CompressionType.Deflate)
|
||||
{
|
||||
LeaveStreamOpen = true
|
||||
});
|
||||
}
|
||||
//reset memoryStream to be usable now
|
||||
memoryStream.Position = 0;
|
||||
```
|
||||
|
||||
### Extract all files from a Rar file to a directory using RarArchive
|
||||
|
||||
```C#
|
||||
using (var archive = RarArchive.Open("Test.rar"))
|
||||
{
|
||||
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory("D:\\temp", new ExtractionOptions()
|
||||
{
|
||||
ExtractFullPath = true,
|
||||
Overwrite = true
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Use ReaderFactory to autodetect archive type and Open the entry stream
|
||||
|
||||
```C#
|
||||
using (Stream stream = File.OpenRead("Tar.tar.bz2"))
|
||||
using (var reader = ReaderFactory.Open(stream))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
Console.WriteLine(reader.Entry.Key);
|
||||
reader.WriteEntryToDirectory(@"C:\temp", new ExtractionOptions()
|
||||
{
|
||||
ExtractFullPath = true,
|
||||
Overwrite = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Use ReaderFactory to autodetect archive type and Open the entry stream
|
||||
|
||||
```C#
|
||||
using (Stream stream = File.OpenRead("Tar.tar.bz2"))
|
||||
using (var reader = ReaderFactory.Open(stream))
|
||||
{
|
||||
while (reader.MoveToNextEntry())
|
||||
{
|
||||
if (!reader.Entry.IsDirectory)
|
||||
{
|
||||
using (var entryStream = reader.OpenEntryStream())
|
||||
{
|
||||
entryStream.CopyTo(...);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Use WriterFactory to write all files from a directory in a streaming manner.
|
||||
|
||||
```C#
|
||||
using (Stream stream = File.OpenWrite("C:\\temp.tgz"))
|
||||
using (var writer = WriterFactory.Open(stream, ArchiveType.Tar, new WriterOptions(CompressionType.GZip)
|
||||
{
|
||||
LeaveOpenStream = true
|
||||
}))
|
||||
{
|
||||
writer.WriteAll("D:\\temp", "*", SearchOption.AllDirectories);
|
||||
}
|
||||
```
|
||||
20
appveyor.yml
Normal file
20
appveyor.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
version: '{build}'
|
||||
image: Visual Studio 2017
|
||||
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
nuget:
|
||||
disable_publish_on_pr: true
|
||||
|
||||
build_script:
|
||||
- ps: .\build.ps1
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: src\SharpCompress\bin\Release\*.nupkg
|
||||
98
build.cake
Normal file
98
build.cake
Normal file
@@ -0,0 +1,98 @@
|
||||
var target = Argument("target", "Default");
|
||||
var tag = Argument("tag", "cake");
|
||||
|
||||
Task("Restore")
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetCoreRestore(".");
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
.IsDependentOn("Restore")
|
||||
.Does(() =>
|
||||
{
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
MSBuild("./sharpcompress.sln", c =>
|
||||
{
|
||||
c.SetConfiguration("Release")
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
.UseToolVersion(MSBuildToolVersion.VS2017);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var settings = new DotNetCoreBuildSettings
|
||||
{
|
||||
Framework = "netstandard1.0",
|
||||
Configuration = "Release"
|
||||
};
|
||||
|
||||
DotNetCoreBuild("./src/SharpCompress/SharpCompress.csproj", settings);
|
||||
|
||||
settings.Framework = "netstandard1.3";
|
||||
DotNetCoreBuild("./src/SharpCompress/SharpCompress.csproj", settings);
|
||||
|
||||
settings.Framework = "netstandard2.0";
|
||||
DotNetCoreBuild("./src/SharpCompress/SharpCompress.csproj", settings);
|
||||
}
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.IsDependentOn("Build")
|
||||
.Does(() =>
|
||||
{
|
||||
var files = GetFiles("tests/**/*.csproj");
|
||||
foreach(var file in files)
|
||||
{
|
||||
var settings = new DotNetCoreTestSettings
|
||||
{
|
||||
Configuration = "Release",
|
||||
Framework = "netcoreapp2.0"
|
||||
};
|
||||
|
||||
DotNetCoreTest(file.ToString(), settings);
|
||||
|
||||
|
||||
settings = new DotNetCoreTestSettings
|
||||
{
|
||||
Configuration = "Release",
|
||||
Framework = "netcoreapp1.1"
|
||||
};
|
||||
|
||||
DotNetCoreTest(file.ToString(), settings);
|
||||
}
|
||||
});
|
||||
|
||||
Task("Pack")
|
||||
.IsDependentOn("Build")
|
||||
.Does(() =>
|
||||
{
|
||||
if (IsRunningOnWindows())
|
||||
{
|
||||
MSBuild("src/SharpCompress/SharpCompress.csproj", c => c
|
||||
.SetConfiguration("Release")
|
||||
.SetVerbosity(Verbosity.Minimal)
|
||||
.UseToolVersion(MSBuildToolVersion.VS2017)
|
||||
.WithProperty("NoBuild", "true")
|
||||
.WithTarget("Pack"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Information("Skipping Pack as this is not Windows");
|
||||
}
|
||||
});
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("Restore")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Test")
|
||||
.IsDependentOn("Pack");
|
||||
|
||||
Task("RunTests")
|
||||
.IsDependentOn("Restore")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Test");
|
||||
|
||||
|
||||
RunTarget(target);
|
||||
228
build.ps1
Normal file
228
build.ps1
Normal file
@@ -0,0 +1,228 @@
|
||||
##########################################################################
|
||||
# This is the Cake bootstrapper script for PowerShell.
|
||||
# This file was downloaded from https://github.com/cake-build/resources
|
||||
# Feel free to change this file to fit your needs.
|
||||
##########################################################################
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This is a Powershell script to bootstrap a Cake build.
|
||||
|
||||
.DESCRIPTION
|
||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||
and execute your Cake build script with the parameters you provide.
|
||||
|
||||
.PARAMETER Script
|
||||
The build script to execute.
|
||||
.PARAMETER Target
|
||||
The build script target to run.
|
||||
.PARAMETER Configuration
|
||||
The build configuration to use.
|
||||
.PARAMETER Verbosity
|
||||
Specifies the amount of information to be displayed.
|
||||
.PARAMETER Experimental
|
||||
Tells Cake to use the latest Roslyn release.
|
||||
.PARAMETER WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.PARAMETER Mono
|
||||
Tells Cake to use the Mono scripting engine.
|
||||
.PARAMETER SkipToolPackageRestore
|
||||
Skips restoring of packages.
|
||||
.PARAMETER ScriptArgs
|
||||
Remaining arguments are added here.
|
||||
|
||||
.LINK
|
||||
http://cakebuild.net
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Script = "build.cake",
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Verbose",
|
||||
[switch]$Experimental,
|
||||
[Alias("DryRun","Noop")]
|
||||
[switch]$WhatIf,
|
||||
[switch]$Mono,
|
||||
[switch]$SkipToolPackageRestore,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
|
||||
function MD5HashFile([string] $filePath)
|
||||
{
|
||||
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
|
||||
{
|
||||
return $null
|
||||
}
|
||||
|
||||
[System.IO.Stream] $file = $null;
|
||||
[System.Security.Cryptography.MD5] $md5 = $null;
|
||||
try
|
||||
{
|
||||
$md5 = [System.Security.Cryptography.MD5]::Create()
|
||||
$file = [System.IO.File]::OpenRead($filePath)
|
||||
return [System.BitConverter]::ToString($md5.ComputeHash($file))
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ($file -ne $null)
|
||||
{
|
||||
$file.Dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Preparing to run build script..."
|
||||
|
||||
if(!$PSScriptRoot){
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
}
|
||||
|
||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||
$ADDINS_DIR = Join-Path $TOOLS_DIR "addins"
|
||||
$MODULES_DIR = Join-Path $TOOLS_DIR "modules"
|
||||
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
|
||||
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
|
||||
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
|
||||
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
|
||||
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
|
||||
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
|
||||
|
||||
# Should we use mono?
|
||||
$UseMono = "";
|
||||
if($Mono.IsPresent) {
|
||||
Write-Verbose -Message "Using the Mono based scripting engine."
|
||||
$UseMono = "-mono"
|
||||
}
|
||||
|
||||
# Should we use the new Roslyn?
|
||||
$UseExperimental = "";
|
||||
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
|
||||
Write-Verbose -Message "Using experimental version of Roslyn."
|
||||
$UseExperimental = "-experimental"
|
||||
}
|
||||
|
||||
# Is this a dry run?
|
||||
$UseDryRun = "";
|
||||
if($WhatIf.IsPresent) {
|
||||
$UseDryRun = "-dryrun"
|
||||
}
|
||||
|
||||
# Make sure tools folder exists
|
||||
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
||||
Write-Verbose -Message "Creating tools directory..."
|
||||
New-Item -Path $TOOLS_DIR -Type directory | out-null
|
||||
}
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if (!(Test-Path $PACKAGES_CONFIG)) {
|
||||
Write-Verbose -Message "Downloading packages.config..."
|
||||
try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
|
||||
Throw "Could not download packages.config."
|
||||
}
|
||||
}
|
||||
|
||||
# Try find NuGet.exe in path if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
|
||||
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
|
||||
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
|
||||
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
|
||||
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
|
||||
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
|
||||
}
|
||||
}
|
||||
|
||||
# Try download NuGet.exe if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Downloading NuGet.exe..."
|
||||
try {
|
||||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||
} catch {
|
||||
Throw "Could not download NuGet.exe."
|
||||
}
|
||||
}
|
||||
|
||||
# Save nuget.exe path to environment to be available to child processed
|
||||
$ENV:NUGET_EXE = $NUGET_EXE
|
||||
|
||||
# Restore tools from NuGet?
|
||||
if(-Not $SkipToolPackageRestore.IsPresent) {
|
||||
Push-Location
|
||||
Set-Location $TOOLS_DIR
|
||||
|
||||
# Check for changes in packages.config and remove installed tools if true.
|
||||
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
|
||||
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
|
||||
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
||||
Write-Verbose -Message "Missing or changed package.config hash..."
|
||||
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
|
||||
}
|
||||
|
||||
Write-Verbose -Message "Restoring tools from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring NuGet tools."
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
|
||||
}
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Restore addins from NuGet
|
||||
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
|
||||
Push-Location
|
||||
Set-Location $ADDINS_DIR
|
||||
|
||||
Write-Verbose -Message "Restoring addins from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring NuGet addins."
|
||||
}
|
||||
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Restore modules from NuGet
|
||||
if (Test-Path $MODULES_PACKAGES_CONFIG) {
|
||||
Push-Location
|
||||
Set-Location $MODULES_DIR
|
||||
|
||||
Write-Verbose -Message "Restoring modules from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring NuGet modules."
|
||||
}
|
||||
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if (!(Test-Path $CAKE_EXE)) {
|
||||
Throw "Could not find Cake.exe at $CAKE_EXE"
|
||||
}
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
||||
42
build.sh
Executable file
42
build.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
##########################################################################
|
||||
# This is the Cake bootstrapper script for Linux and OS X.
|
||||
# This file was downloaded from https://github.com/cake-build/resources
|
||||
# Feel free to change this file to fit your needs.
|
||||
##########################################################################
|
||||
|
||||
# Define directories.
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
CAKE_VERSION=0.23.0
|
||||
CAKE_DLL=$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION/Cake.dll
|
||||
|
||||
# Make sure the tools folder exist.
|
||||
if [ ! -d "$TOOLS_DIR" ]; then
|
||||
mkdir "$TOOLS_DIR"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# INSTALL CAKE
|
||||
###########################################################################
|
||||
|
||||
if [ ! -f "$CAKE_DLL" ]; then
|
||||
curl -Lsfo Cake.CoreCLR.zip "https://www.nuget.org/api/v2/package/Cake.CoreCLR/$CAKE_VERSION" && unzip -q Cake.CoreCLR.zip -d "$TOOLS_DIR/Cake.CoreCLR.$CAKE_VERSION" && rm -f Cake.CoreCLR.zip
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while installing Cake."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if [ ! -f "$CAKE_DLL" ]; then
|
||||
echo "Could not find Cake.exe at '$CAKE_DLL'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
|
||||
# Start Cake
|
||||
exec dotnet "$CAKE_DLL" "$@"
|
||||
@@ -1,212 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public abstract class AbstractArchive<TEntry, TVolume> : IArchive, IArchiveExtractionListener
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
private readonly LazyReadOnlyCollection<TVolume> lazyVolumes;
|
||||
private readonly LazyReadOnlyCollection<TEntry> lazyEntries;
|
||||
|
||||
public event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionBegin;
|
||||
public event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionEnd;
|
||||
|
||||
public event EventHandler<CompressedBytesReadEventArgs> CompressedBytesRead;
|
||||
public event EventHandler<FilePartExtractionBeginEventArgs> FilePartExtractionBegin;
|
||||
|
||||
protected string Password { get; private set; }
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
internal AbstractArchive(ArchiveType type, FileInfo fileInfo, Options options, string password)
|
||||
{
|
||||
Type = type;
|
||||
Password = password;
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
throw new ArgumentException("File does not exist: " + fileInfo.FullName);
|
||||
}
|
||||
options = (Options) FlagUtility.SetFlag(options, Options.KeepStreamsOpen, false);
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(LoadVolumes(fileInfo, options));
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(LoadEntries(Volumes));
|
||||
}
|
||||
|
||||
|
||||
protected abstract IEnumerable<TVolume> LoadVolumes(FileInfo file, Options options);
|
||||
#endif
|
||||
|
||||
internal AbstractArchive(ArchiveType type, IEnumerable<Stream> streams, Options options, string password)
|
||||
{
|
||||
Type = type;
|
||||
Password = password;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(LoadVolumes(streams.Select(CheckStreams), options));
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(LoadEntries(Volumes));
|
||||
}
|
||||
|
||||
internal AbstractArchive(ArchiveType type)
|
||||
{
|
||||
Type = type;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(Enumerable.Empty<TVolume>());
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(Enumerable.Empty<TEntry>());
|
||||
}
|
||||
public ArchiveType Type { get; private set; }
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionBegin(IArchiveEntry entry)
|
||||
{
|
||||
if (EntryExtractionBegin != null)
|
||||
{
|
||||
EntryExtractionBegin(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
}
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionEnd(IArchiveEntry entry)
|
||||
{
|
||||
if (EntryExtractionEnd != null)
|
||||
{
|
||||
EntryExtractionEnd(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
}
|
||||
|
||||
private static Stream CheckStreams(Stream stream)
|
||||
{
|
||||
if (!stream.CanSeek || !stream.CanRead)
|
||||
{
|
||||
throw new ArgumentException("Archive streams must be Readable and Seekable");
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an ReadOnlyCollection of all the RarArchiveEntries across the one or many parts of the RarArchive.
|
||||
/// </summary>
|
||||
public virtual ICollection<TEntry> Entries
|
||||
{
|
||||
get { return lazyEntries; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an ReadOnlyCollection of all the RarArchiveVolumes across the one or many parts of the RarArchive.
|
||||
/// </summary>
|
||||
public ICollection<TVolume> Volumes
|
||||
{
|
||||
get { return lazyVolumes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files compressed in the archive.
|
||||
/// </summary>
|
||||
public virtual long TotalSize
|
||||
{
|
||||
get { return Entries.Aggregate(0L, (total, cf) => total + cf.CompressedSize); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files as uncompressed in the archive.
|
||||
/// </summary>
|
||||
public virtual long TotalUncompressSize
|
||||
{
|
||||
get { return Entries.Aggregate(0L, (total, cf) => total + cf.Size); }
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<TVolume> LoadVolumes(IEnumerable<Stream> streams, Options options);
|
||||
protected abstract IEnumerable<TEntry> LoadEntries(IEnumerable<TVolume> volumes);
|
||||
|
||||
IEnumerable<IArchiveEntry> IArchive.Entries
|
||||
{
|
||||
get { return Entries.Cast<IArchiveEntry>(); }
|
||||
}
|
||||
|
||||
IEnumerable<IVolume> IArchive.Volumes
|
||||
{
|
||||
get { return lazyVolumes.Cast<IVolume>(); }
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
lazyVolumes.ForEach(v => v.Dispose());
|
||||
lazyEntries.GetLoaded().Cast<Entry>().ForEach(x => x.Close());
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IArchiveExtractionListener.EnsureEntriesLoaded()
|
||||
{
|
||||
lazyEntries.EnsureFullyLoaded();
|
||||
lazyVolumes.EnsureFullyLoaded();
|
||||
}
|
||||
|
||||
void IExtractionListener.FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes)
|
||||
{
|
||||
if (CompressedBytesRead != null)
|
||||
{
|
||||
CompressedBytesRead(this, new CompressedBytesReadEventArgs()
|
||||
{
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void IExtractionListener.FireFilePartExtractionBegin(string name, long size, long compressedSize)
|
||||
{
|
||||
if (FilePartExtractionBegin != null)
|
||||
{
|
||||
FilePartExtractionBegin(this, new FilePartExtractionBeginEventArgs()
|
||||
{
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to extract all entries in an archive in order.
|
||||
/// This is primarily for SOLID Rar Archives or 7Zip Archives as they need to be
|
||||
/// extracted sequentially for the best performance.
|
||||
///
|
||||
/// This method will load all entry information from the archive.
|
||||
///
|
||||
/// WARNING: this will reuse the underlying stream for the archive. Errors may
|
||||
/// occur if this is used at the same time as other extraction methods on this instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IReader ExtractAllEntries()
|
||||
{
|
||||
((IArchiveExtractionListener)this).EnsureEntriesLoaded();
|
||||
return CreateReaderForSolidExtraction();
|
||||
}
|
||||
|
||||
protected abstract IReader CreateReaderForSolidExtraction();
|
||||
|
||||
/// <summary>
|
||||
/// Archive is SOLID (this means the Archive saved bytes by reusing information which helps for archives containing many small files).
|
||||
/// </summary>
|
||||
public virtual bool IsSolid
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The archive can find all the parts of the archive needed to fully extract the archive. This forces the parsing of the entire archive.
|
||||
/// </summary>
|
||||
public bool IsComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
((IArchiveExtractionListener)this).EnsureEntriesLoaded();
|
||||
return Entries.All(x => x.IsComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public abstract class AbstractArchive<TEntry, TVolume> : IArchive, IArchiveExtractionListener
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
private readonly LazyReadOnlyCollection<TVolume> lazyVolumes;
|
||||
private readonly LazyReadOnlyCollection<TEntry> lazyEntries;
|
||||
|
||||
public event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionBegin;
|
||||
public event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionEnd;
|
||||
|
||||
public event EventHandler<CompressedBytesReadEventArgs> CompressedBytesRead;
|
||||
public event EventHandler<FilePartExtractionBeginEventArgs> FilePartExtractionBegin;
|
||||
|
||||
protected ReaderOptions ReaderOptions { get; }
|
||||
|
||||
private bool disposed;
|
||||
|
||||
#if !NO_FILE
|
||||
internal AbstractArchive(ArchiveType type, FileInfo fileInfo, ReaderOptions readerOptions)
|
||||
{
|
||||
Type = type;
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
throw new ArgumentException("File does not exist: " + fileInfo.FullName);
|
||||
}
|
||||
ReaderOptions = readerOptions;
|
||||
readerOptions.LeaveStreamOpen = false;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(LoadVolumes(fileInfo));
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(LoadEntries(Volumes));
|
||||
}
|
||||
|
||||
|
||||
protected abstract IEnumerable<TVolume> LoadVolumes(FileInfo file);
|
||||
#endif
|
||||
|
||||
internal AbstractArchive(ArchiveType type, IEnumerable<Stream> streams, ReaderOptions readerOptions)
|
||||
{
|
||||
Type = type;
|
||||
ReaderOptions = readerOptions;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(LoadVolumes(streams.Select(CheckStreams)));
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(LoadEntries(Volumes));
|
||||
}
|
||||
|
||||
internal AbstractArchive(ArchiveType type)
|
||||
{
|
||||
Type = type;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(Enumerable.Empty<TVolume>());
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(Enumerable.Empty<TEntry>());
|
||||
}
|
||||
|
||||
public ArchiveType Type { get; }
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionBegin(IArchiveEntry entry)
|
||||
{
|
||||
EntryExtractionBegin?.Invoke(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
|
||||
void IArchiveExtractionListener.FireEntryExtractionEnd(IArchiveEntry entry)
|
||||
{
|
||||
EntryExtractionEnd?.Invoke(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
|
||||
private static Stream CheckStreams(Stream stream)
|
||||
{
|
||||
if (!stream.CanSeek || !stream.CanRead)
|
||||
{
|
||||
throw new ArgumentException("Archive streams must be Readable and Seekable");
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an ReadOnlyCollection of all the RarArchiveEntries across the one or many parts of the RarArchive.
|
||||
/// </summary>
|
||||
public virtual ICollection<TEntry> Entries { get { return lazyEntries; } }
|
||||
|
||||
/// <summary>
|
||||
/// Returns an ReadOnlyCollection of all the RarArchiveVolumes across the one or many parts of the RarArchive.
|
||||
/// </summary>
|
||||
public ICollection<TVolume> Volumes { get { return lazyVolumes; } }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files compressed in the archive.
|
||||
/// </summary>
|
||||
public virtual long TotalSize { get { return Entries.Aggregate(0L, (total, cf) => total + cf.CompressedSize); } }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files as uncompressed in the archive.
|
||||
/// </summary>
|
||||
public virtual long TotalUncompressSize { get { return Entries.Aggregate(0L, (total, cf) => total + cf.Size); } }
|
||||
|
||||
protected abstract IEnumerable<TVolume> LoadVolumes(IEnumerable<Stream> streams);
|
||||
protected abstract IEnumerable<TEntry> LoadEntries(IEnumerable<TVolume> volumes);
|
||||
|
||||
IEnumerable<IArchiveEntry> IArchive.Entries { get { return Entries.Cast<IArchiveEntry>(); } }
|
||||
|
||||
IEnumerable<IVolume> IArchive.Volumes { get { return lazyVolumes.Cast<IVolume>(); } }
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
lazyVolumes.ForEach(v => v.Dispose());
|
||||
lazyEntries.GetLoaded().Cast<Entry>().ForEach(x => x.Close());
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IArchiveExtractionListener.EnsureEntriesLoaded()
|
||||
{
|
||||
lazyEntries.EnsureFullyLoaded();
|
||||
lazyVolumes.EnsureFullyLoaded();
|
||||
}
|
||||
|
||||
void IExtractionListener.FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes)
|
||||
{
|
||||
CompressedBytesRead?.Invoke(this, new CompressedBytesReadEventArgs
|
||||
{
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
|
||||
void IExtractionListener.FireFilePartExtractionBegin(string name, long size, long compressedSize)
|
||||
{
|
||||
FilePartExtractionBegin?.Invoke(this, new FilePartExtractionBeginEventArgs
|
||||
{
|
||||
CompressedSize = compressedSize,
|
||||
Size = size,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to extract all entries in an archive in order.
|
||||
/// This is primarily for SOLID Rar Archives or 7Zip Archives as they need to be
|
||||
/// extracted sequentially for the best performance.
|
||||
///
|
||||
/// This method will load all entry information from the archive.
|
||||
///
|
||||
/// WARNING: this will reuse the underlying stream for the archive. Errors may
|
||||
/// occur if this is used at the same time as other extraction methods on this instance.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IReader ExtractAllEntries()
|
||||
{
|
||||
((IArchiveExtractionListener)this).EnsureEntriesLoaded();
|
||||
return CreateReaderForSolidExtraction();
|
||||
}
|
||||
|
||||
protected abstract IReader CreateReaderForSolidExtraction();
|
||||
|
||||
/// <summary>
|
||||
/// Archive is SOLID (this means the Archive saved bytes by reusing information which helps for archives containing many small files).
|
||||
/// </summary>
|
||||
public virtual bool IsSolid { get { return false; } }
|
||||
|
||||
/// <summary>
|
||||
/// The archive can find all the parts of the archive needed to fully extract the archive. This forces the parsing of the entire archive.
|
||||
/// </summary>
|
||||
public bool IsComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
((IArchiveExtractionListener)this).EnsureEntriesLoaded();
|
||||
return Entries.All(x => x.IsComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,149 +1,147 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public abstract class AbstractWritableArchive<TEntry, TVolume> : AbstractArchive<TEntry, TVolume>, IWritableArchive
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
private readonly List<TEntry> newEntries = new List<TEntry>();
|
||||
private readonly List<TEntry> removedEntries = new List<TEntry>();
|
||||
|
||||
private readonly List<TEntry> modifiedEntries = new List<TEntry>();
|
||||
private bool hasModifications;
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type, Stream stream, Options options)
|
||||
: base(type, stream.AsEnumerable(), options, null)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
internal AbstractWritableArchive(ArchiveType type, FileInfo fileInfo, Options options)
|
||||
: base(type, fileInfo, options, null)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public override ICollection<TEntry> Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hasModifications)
|
||||
{
|
||||
return modifiedEntries;
|
||||
}
|
||||
return base.Entries;
|
||||
}
|
||||
}
|
||||
|
||||
private void RebuildModifiedCollection()
|
||||
{
|
||||
hasModifications = true;
|
||||
newEntries.RemoveAll(v => removedEntries.Contains(v));
|
||||
modifiedEntries.Clear();
|
||||
modifiedEntries.AddRange(OldEntries.Concat(newEntries));
|
||||
}
|
||||
|
||||
private IEnumerable<TEntry> OldEntries
|
||||
{
|
||||
get { return base.Entries.Where(x => !removedEntries.Contains(x)); }
|
||||
}
|
||||
|
||||
public void RemoveEntry(TEntry entry)
|
||||
{
|
||||
if (!removedEntries.Contains(entry))
|
||||
{
|
||||
removedEntries.Add(entry);
|
||||
RebuildModifiedCollection();
|
||||
}
|
||||
}
|
||||
void IWritableArchive.RemoveEntry(IArchiveEntry entry)
|
||||
{
|
||||
RemoveEntry((TEntry)entry);
|
||||
}
|
||||
|
||||
public TEntry AddEntry(string key, Stream source,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
return AddEntry(key, source, false, size, modified);
|
||||
}
|
||||
|
||||
|
||||
IArchiveEntry IWritableArchive.AddEntry(string key, Stream source, bool closeStream, long size, DateTime? modified)
|
||||
{
|
||||
return AddEntry(key, source, closeStream, size, modified);
|
||||
}
|
||||
|
||||
public TEntry AddEntry(string key, Stream source, bool closeStream,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
if (key.StartsWith("/")
|
||||
|| key.StartsWith("\\"))
|
||||
{
|
||||
key = key.Substring(1);
|
||||
}
|
||||
if (DoesKeyMatchExisting(key))
|
||||
{
|
||||
throw new ArchiveException("Cannot add entry with duplicate key: " + key);
|
||||
}
|
||||
var entry = CreateEntry(key, source, size, modified, closeStream);
|
||||
newEntries.Add(entry);
|
||||
RebuildModifiedCollection();
|
||||
return entry;
|
||||
}
|
||||
|
||||
private bool DoesKeyMatchExisting(string key)
|
||||
{
|
||||
foreach (var path in Entries.Select(x => x.Key))
|
||||
{
|
||||
var p = path.Replace('/','\\');
|
||||
if (p.StartsWith("\\"))
|
||||
{
|
||||
p = p.Substring(1);
|
||||
}
|
||||
return string.Equals(p, key, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SaveTo(Stream stream, CompressionInfo compressionType)
|
||||
{
|
||||
//reset streams of new entries
|
||||
newEntries.Cast<IWritableArchiveEntry>().ForEach(x => x.Stream.Seek(0, SeekOrigin.Begin));
|
||||
SaveTo(stream, compressionType, OldEntries, newEntries);
|
||||
}
|
||||
|
||||
protected TEntry CreateEntry(string key, Stream source, long size, DateTime? modified,
|
||||
bool closeStream)
|
||||
{
|
||||
if (!source.CanRead || !source.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Streams must be readable and seekable to use the Writing Archive API");
|
||||
}
|
||||
return CreateEntryInternal(key, source, size, modified, closeStream);
|
||||
}
|
||||
|
||||
protected abstract TEntry CreateEntryInternal(string key, Stream source, long size, DateTime? modified,
|
||||
bool closeStream);
|
||||
|
||||
protected abstract void SaveTo(Stream stream, CompressionInfo compressionType,
|
||||
IEnumerable<TEntry> oldEntries, IEnumerable<TEntry> newEntries);
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
newEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
removedEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
modifiedEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
using SharpCompress.Writers;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public abstract class AbstractWritableArchive<TEntry, TVolume> : AbstractArchive<TEntry, TVolume>, IWritableArchive
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
private readonly List<TEntry> newEntries = new List<TEntry>();
|
||||
private readonly List<TEntry> removedEntries = new List<TEntry>();
|
||||
|
||||
private readonly List<TEntry> modifiedEntries = new List<TEntry>();
|
||||
private bool hasModifications;
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type, Stream stream, ReaderOptions readerFactoryOptions)
|
||||
: base(type, stream.AsEnumerable(), readerFactoryOptions)
|
||||
{
|
||||
}
|
||||
|
||||
#if !NO_FILE
|
||||
internal AbstractWritableArchive(ArchiveType type, FileInfo fileInfo, ReaderOptions readerFactoryOptions)
|
||||
: base(type, fileInfo, readerFactoryOptions)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public override ICollection<TEntry> Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hasModifications)
|
||||
{
|
||||
return modifiedEntries;
|
||||
}
|
||||
return base.Entries;
|
||||
}
|
||||
}
|
||||
|
||||
private void RebuildModifiedCollection()
|
||||
{
|
||||
hasModifications = true;
|
||||
newEntries.RemoveAll(v => removedEntries.Contains(v));
|
||||
modifiedEntries.Clear();
|
||||
modifiedEntries.AddRange(OldEntries.Concat(newEntries));
|
||||
}
|
||||
|
||||
private IEnumerable<TEntry> OldEntries { get { return base.Entries.Where(x => !removedEntries.Contains(x)); } }
|
||||
|
||||
public void RemoveEntry(TEntry entry)
|
||||
{
|
||||
if (!removedEntries.Contains(entry))
|
||||
{
|
||||
removedEntries.Add(entry);
|
||||
RebuildModifiedCollection();
|
||||
}
|
||||
}
|
||||
|
||||
void IWritableArchive.RemoveEntry(IArchiveEntry entry)
|
||||
{
|
||||
RemoveEntry((TEntry)entry);
|
||||
}
|
||||
|
||||
public TEntry AddEntry(string key, Stream source,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
return AddEntry(key, source, false, size, modified);
|
||||
}
|
||||
|
||||
IArchiveEntry IWritableArchive.AddEntry(string key, Stream source, bool closeStream, long size, DateTime? modified)
|
||||
{
|
||||
return AddEntry(key, source, closeStream, size, modified);
|
||||
}
|
||||
|
||||
public TEntry AddEntry(string key, Stream source, bool closeStream,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
if (key.StartsWith("/")
|
||||
|| key.StartsWith("\\"))
|
||||
{
|
||||
key = key.Substring(1);
|
||||
}
|
||||
if (DoesKeyMatchExisting(key))
|
||||
{
|
||||
throw new ArchiveException("Cannot add entry with duplicate key: " + key);
|
||||
}
|
||||
var entry = CreateEntry(key, source, size, modified, closeStream);
|
||||
newEntries.Add(entry);
|
||||
RebuildModifiedCollection();
|
||||
return entry;
|
||||
}
|
||||
|
||||
private bool DoesKeyMatchExisting(string key)
|
||||
{
|
||||
foreach (var path in Entries.Select(x => x.Key))
|
||||
{
|
||||
var p = path.Replace('/', '\\');
|
||||
if (p.StartsWith("\\"))
|
||||
{
|
||||
p = p.Substring(1);
|
||||
}
|
||||
return string.Equals(p, key, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SaveTo(Stream stream, WriterOptions options)
|
||||
{
|
||||
//reset streams of new entries
|
||||
newEntries.Cast<IWritableArchiveEntry>().ForEach(x => x.Stream.Seek(0, SeekOrigin.Begin));
|
||||
SaveTo(stream, options, OldEntries, newEntries);
|
||||
}
|
||||
|
||||
protected TEntry CreateEntry(string key, Stream source, long size, DateTime? modified,
|
||||
bool closeStream)
|
||||
{
|
||||
if (!source.CanRead || !source.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Streams must be readable and seekable to use the Writing Archive API");
|
||||
}
|
||||
return CreateEntryInternal(key, source, size, modified, closeStream);
|
||||
}
|
||||
|
||||
protected abstract TEntry CreateEntryInternal(string key, Stream source, long size, DateTime? modified,
|
||||
bool closeStream);
|
||||
|
||||
protected abstract void SaveTo(Stream stream, WriterOptions options, IEnumerable<TEntry> oldEntries, IEnumerable<TEntry> newEntries);
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
newEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
removedEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
modifiedEntries.Cast<Entry>().ForEach(x => x.Close());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +1,158 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Archive.GZip;
|
||||
using SharpCompress.Archive.Rar;
|
||||
using SharpCompress.Archive.SevenZip;
|
||||
using SharpCompress.Archive.Tar;
|
||||
using SharpCompress.Archive.Zip;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public class ArchiveFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens an Archive for random access
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
public static IArchive Open(Stream stream, Options options = Options.KeepStreamsOpen)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
if (!stream.CanRead || !stream.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream should be readable and seekable");
|
||||
}
|
||||
|
||||
if (ZipArchive.IsZipFile(stream, null))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return ZipArchive.Open(stream, options, null);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (TarArchive.IsTarFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return TarArchive.Open(stream, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (SevenZipArchive.IsSevenZipFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return SevenZipArchive.Open(stream, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (GZipArchive.IsGZipFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return GZipArchive.Open(stream, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if(RarArchive.IsRarFile(stream, Options.LookForHeader | Options.KeepStreamsOpen))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return RarArchive.Open(stream, options);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip");
|
||||
}
|
||||
|
||||
public static IWritableArchive Create(ArchiveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ArchiveType.Zip:
|
||||
{
|
||||
return ZipArchive.Create();
|
||||
}
|
||||
case ArchiveType.Tar:
|
||||
{
|
||||
return TarArchive.Create();
|
||||
}
|
||||
case ArchiveType.GZip:
|
||||
{
|
||||
return GZipArchive.Create();
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException("Cannot create Archives of type: " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public static IArchive Open(string filePath)
|
||||
{
|
||||
return Open(filePath, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
public static IArchive Open(FileInfo fileInfo)
|
||||
{
|
||||
return Open(fileInfo, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="options"></param>
|
||||
public static IArchive Open(string filePath, Options options)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
public static IArchive Open(FileInfo fileInfo, Options options)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
using (var stream = fileInfo.OpenRead())
|
||||
{
|
||||
if (ZipArchive.IsZipFile(stream, null))
|
||||
{
|
||||
stream.Dispose();
|
||||
return ZipArchive.Open(fileInfo, options, null);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (TarArchive.IsTarFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return TarArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (SevenZipArchive.IsSevenZipFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return SevenZipArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (GZipArchive.IsGZipFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return GZipArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if(RarArchive.IsRarFile(stream, Options.LookForHeader | Options.KeepStreamsOpen))
|
||||
{
|
||||
stream.Dispose();
|
||||
return RarArchive.Open(fileInfo, options);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(string sourceArchive, string destinationDirectory,
|
||||
ExtractOptions options = ExtractOptions.Overwrite)
|
||||
{
|
||||
using (IArchive archive = Open(sourceArchive))
|
||||
{
|
||||
foreach (IArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
entry.WriteToDirectory(destinationDirectory, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
using System;
|
||||
using System.IO;
|
||||
using SharpCompress.Archives.GZip;
|
||||
using SharpCompress.Archives.Rar;
|
||||
using SharpCompress.Archives.SevenZip;
|
||||
using SharpCompress.Archives.Tar;
|
||||
using SharpCompress.Archives.Zip;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Compressors.LZMA;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public class ArchiveFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens an Archive for random access
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="readerOptions"></param>
|
||||
/// <returns></returns>
|
||||
public static IArchive Open(Stream stream, ReaderOptions readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
if (!stream.CanRead || !stream.CanSeek)
|
||||
{
|
||||
throw new ArgumentException("Stream should be readable and seekable");
|
||||
}
|
||||
readerOptions = readerOptions ?? new ReaderOptions();
|
||||
if (ZipArchive.IsZipFile(stream, null))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return ZipArchive.Open(stream, readerOptions);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (SevenZipArchive.IsSevenZipFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return SevenZipArchive.Open(stream, readerOptions);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (GZipArchive.IsGZipFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return GZipArchive.Open(stream, readerOptions);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (RarArchive.IsRarFile(stream, readerOptions))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return RarArchive.Open(stream, readerOptions);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (TarArchive.IsTarFile(stream))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return TarArchive.Open(stream, readerOptions);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip, LZip");
|
||||
}
|
||||
|
||||
public static IWritableArchive Create(ArchiveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ArchiveType.Zip:
|
||||
{
|
||||
return ZipArchive.Create();
|
||||
}
|
||||
case ArchiveType.Tar:
|
||||
{
|
||||
return TarArchive.Create();
|
||||
}
|
||||
case ArchiveType.GZip:
|
||||
{
|
||||
return GZipArchive.Create();
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new NotSupportedException("Cannot create Archives of type: " + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !NO_FILE
|
||||
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="options"></param>
|
||||
public static IArchive Open(string filePath, ReaderOptions options = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), options ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
public static IArchive Open(FileInfo fileInfo, ReaderOptions options = null)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
options = options ?? new ReaderOptions();
|
||||
using (var stream = fileInfo.OpenRead())
|
||||
{
|
||||
if (ZipArchive.IsZipFile(stream, null))
|
||||
{
|
||||
stream.Dispose();
|
||||
return ZipArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (SevenZipArchive.IsSevenZipFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return SevenZipArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (GZipArchive.IsGZipFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return GZipArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (RarArchive.IsRarFile(stream, options))
|
||||
{
|
||||
stream.Dispose();
|
||||
return RarArchive.Open(fileInfo, options);
|
||||
}
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
if (TarArchive.IsTarFile(stream))
|
||||
{
|
||||
stream.Dispose();
|
||||
return TarArchive.Open(fileInfo, options);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(string sourceArchive, string destinationDirectory,
|
||||
ExtractionOptions options = null)
|
||||
{
|
||||
using (IArchive archive = Open(sourceArchive))
|
||||
{
|
||||
foreach (IArchiveEntry entry in archive.Entries)
|
||||
{
|
||||
entry.WriteToDirectory(destinationDirectory, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,218 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.GZip;
|
||||
using SharpCompress.Reader;
|
||||
using SharpCompress.Reader.GZip;
|
||||
using SharpCompress.Writer.GZip;
|
||||
|
||||
namespace SharpCompress.Archive.GZip
|
||||
{
|
||||
public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public static GZipArchive Open(string filePath)
|
||||
{
|
||||
return Open(filePath, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
public static GZipArchive Open(FileInfo fileInfo)
|
||||
{
|
||||
return Open(fileInfo, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="options"></param>
|
||||
public static GZipArchive Open(string filePath, Options options)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
public static GZipArchive Open(FileInfo fileInfo, Options options)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
return new GZipArchive(fileInfo, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
public static GZipArchive Open(Stream stream)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return Open(stream, Options.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
public static GZipArchive Open(Stream stream, Options options)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return new GZipArchive(stream, options);
|
||||
}
|
||||
|
||||
public static GZipArchive Create()
|
||||
{
|
||||
return new GZipArchive();
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
internal GZipArchive(FileInfo fileInfo, Options options)
|
||||
: base(ArchiveType.GZip, fileInfo, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipVolume> LoadVolumes(FileInfo file, Options options)
|
||||
{
|
||||
return new GZipVolume(file, options).AsEnumerable();
|
||||
}
|
||||
|
||||
public static bool IsGZipFile(string filePath)
|
||||
{
|
||||
return IsGZipFile(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public static bool IsGZipFile(FileInfo fileInfo)
|
||||
{
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (Stream stream = fileInfo.OpenRead())
|
||||
{
|
||||
return IsGZipFile(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveTo(string filePath)
|
||||
{
|
||||
SaveTo(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public void SaveTo(FileInfo fileInfo)
|
||||
{
|
||||
using (var stream = fileInfo.Open(FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
SaveTo(stream);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsGZipFile(Stream stream)
|
||||
{
|
||||
// read the header on the first read
|
||||
byte[] header = new byte[10];
|
||||
int n = stream.Read(header, 0, header.Length);
|
||||
|
||||
// workitem 8501: handle edge case (decompress empty stream)
|
||||
if (n == 0)
|
||||
return false;
|
||||
|
||||
if (n != 10)
|
||||
return false;
|
||||
|
||||
if (header[0] != 0x1F || header[1] != 0x8B || header[2] != 8)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
internal GZipArchive(Stream stream, Options options)
|
||||
: base(ArchiveType.GZip, stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
internal GZipArchive()
|
||||
: base(ArchiveType.GZip)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveTo(Stream stream)
|
||||
{
|
||||
SaveTo(stream, CompressionType.GZip);
|
||||
}
|
||||
|
||||
protected override GZipArchiveEntry CreateEntryInternal(string filePath, Stream source, long size, DateTime? modified,
|
||||
bool closeStream)
|
||||
{
|
||||
if (Entries.Any())
|
||||
{
|
||||
throw new InvalidOperationException("Only one entry is allowed in a GZip Archive");
|
||||
}
|
||||
return new GZipWritableArchiveEntry(this, source, filePath, size, modified, closeStream);
|
||||
}
|
||||
|
||||
protected override void SaveTo(Stream stream, CompressionInfo compressionInfo,
|
||||
IEnumerable<GZipArchiveEntry> oldEntries,
|
||||
IEnumerable<GZipArchiveEntry> newEntries)
|
||||
{
|
||||
if (Entries.Count > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Only one entry is allowed in a GZip Archive");
|
||||
}
|
||||
using (var writer = new GZipWriter(stream))
|
||||
{
|
||||
foreach (var entry in oldEntries.Concat(newEntries)
|
||||
.Where(x => !x.IsDirectory))
|
||||
{
|
||||
using (var entryStream = entry.OpenEntryStream())
|
||||
{
|
||||
writer.Write(entry.Key, entryStream, entry.LastModifiedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipVolume> LoadVolumes(IEnumerable<Stream> streams, Options options)
|
||||
{
|
||||
return new GZipVolume(streams.First(), options).AsEnumerable();
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipArchiveEntry> LoadEntries(IEnumerable<GZipVolume> volumes)
|
||||
{
|
||||
Stream stream = volumes.Single().Stream;
|
||||
yield return new GZipArchiveEntry(this, new GZipFilePart(stream));
|
||||
}
|
||||
|
||||
protected override IReader CreateReaderForSolidExtraction()
|
||||
{
|
||||
var stream = Volumes.Single().Stream;
|
||||
stream.Position = 0;
|
||||
return GZipReader.Open(stream);
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.GZip;
|
||||
using SharpCompress.Readers;
|
||||
using SharpCompress.Readers.GZip;
|
||||
using SharpCompress.Writers;
|
||||
using SharpCompress.Writers.GZip;
|
||||
|
||||
namespace SharpCompress.Archives.GZip
|
||||
{
|
||||
public class GZipArchive : AbstractWritableArchive<GZipArchiveEntry, GZipVolume>
|
||||
{
|
||||
#if !NO_FILE
|
||||
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(string filePath, ReaderOptions readerOptions = null)
|
||||
{
|
||||
filePath.CheckNotNullOrEmpty("filePath");
|
||||
return Open(new FileInfo(filePath), readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(FileInfo fileInfo, ReaderOptions readerOptions = null)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
return new GZipArchive(fileInfo, readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="readerOptions"></param>
|
||||
public static GZipArchive Open(Stream stream, ReaderOptions readerOptions = null)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return new GZipArchive(stream, readerOptions ?? new ReaderOptions());
|
||||
}
|
||||
|
||||
public static GZipArchive Create()
|
||||
{
|
||||
return new GZipArchive();
|
||||
}
|
||||
|
||||
#if !NO_FILE
|
||||
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
internal GZipArchive(FileInfo fileInfo, ReaderOptions options)
|
||||
: base(ArchiveType.GZip, fileInfo, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipVolume> LoadVolumes(FileInfo file)
|
||||
{
|
||||
return new GZipVolume(file, ReaderOptions).AsEnumerable();
|
||||
}
|
||||
|
||||
public static bool IsGZipFile(string filePath)
|
||||
{
|
||||
return IsGZipFile(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public static bool IsGZipFile(FileInfo fileInfo)
|
||||
{
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (Stream stream = fileInfo.OpenRead())
|
||||
{
|
||||
return IsGZipFile(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveTo(string filePath)
|
||||
{
|
||||
SaveTo(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public void SaveTo(FileInfo fileInfo)
|
||||
{
|
||||
using (var stream = fileInfo.Open(FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
SaveTo(stream, new WriterOptions(CompressionType.GZip));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsGZipFile(Stream stream)
|
||||
{
|
||||
// read the header on the first read
|
||||
byte[] header = new byte[10];
|
||||
|
||||
// workitem 8501: handle edge case (decompress empty stream)
|
||||
if (!stream.ReadFully(header))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (header[0] != 0x1F || header[1] != 0x8B || header[2] != 8)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
internal GZipArchive(Stream stream, ReaderOptions options)
|
||||
: base(ArchiveType.GZip, stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
internal GZipArchive()
|
||||
: base(ArchiveType.GZip)
|
||||
{
|
||||
}
|
||||
|
||||
protected override GZipArchiveEntry CreateEntryInternal(string filePath, Stream source, long size, DateTime? modified,
|
||||
bool closeStream)
|
||||
{
|
||||
if (Entries.Any())
|
||||
{
|
||||
throw new InvalidOperationException("Only one entry is allowed in a GZip Archive");
|
||||
}
|
||||
return new GZipWritableArchiveEntry(this, source, filePath, size, modified, closeStream);
|
||||
}
|
||||
|
||||
protected override void SaveTo(Stream stream, WriterOptions options,
|
||||
IEnumerable<GZipArchiveEntry> oldEntries,
|
||||
IEnumerable<GZipArchiveEntry> newEntries)
|
||||
{
|
||||
if (Entries.Count > 1)
|
||||
{
|
||||
throw new InvalidOperationException("Only one entry is allowed in a GZip Archive");
|
||||
}
|
||||
using (var writer = new GZipWriter(stream, new GZipWriterOptions(options)))
|
||||
{
|
||||
foreach (var entry in oldEntries.Concat(newEntries)
|
||||
.Where(x => !x.IsDirectory))
|
||||
{
|
||||
using (var entryStream = entry.OpenEntryStream())
|
||||
{
|
||||
writer.Write(entry.Key, entryStream, entry.LastModifiedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipVolume> LoadVolumes(IEnumerable<Stream> streams)
|
||||
{
|
||||
return new GZipVolume(streams.First(), ReaderOptions).AsEnumerable();
|
||||
}
|
||||
|
||||
protected override IEnumerable<GZipArchiveEntry> LoadEntries(IEnumerable<GZipVolume> volumes)
|
||||
{
|
||||
Stream stream = volumes.Single().Stream;
|
||||
yield return new GZipArchiveEntry(this, new GZipFilePart(stream, ReaderOptions.ArchiveEncoding));
|
||||
}
|
||||
|
||||
protected override IReader CreateReaderForSolidExtraction()
|
||||
{
|
||||
var stream = Volumes.Single().Stream;
|
||||
stream.Position = 0;
|
||||
return GZipReader.Open(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,34 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common.GZip;
|
||||
|
||||
namespace SharpCompress.Archive.GZip
|
||||
{
|
||||
public class GZipArchiveEntry : GZipEntry, IArchiveEntry
|
||||
{
|
||||
|
||||
internal GZipArchiveEntry(GZipArchive archive, GZipFilePart part)
|
||||
: base(part)
|
||||
{
|
||||
Archive = archive;
|
||||
}
|
||||
|
||||
public virtual Stream OpenEntryStream()
|
||||
{
|
||||
return Parts.Single().GetCompressedStream();
|
||||
}
|
||||
|
||||
#region IArchiveEntry Members
|
||||
public IArchive Archive { get; private set; }
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common.GZip;
|
||||
|
||||
namespace SharpCompress.Archives.GZip
|
||||
{
|
||||
public class GZipArchiveEntry : GZipEntry, IArchiveEntry
|
||||
{
|
||||
internal GZipArchiveEntry(GZipArchive archive, GZipFilePart part)
|
||||
: base(part)
|
||||
{
|
||||
Archive = archive;
|
||||
}
|
||||
|
||||
public virtual Stream OpenEntryStream()
|
||||
{
|
||||
//this is to reset the stream to be read multiple times
|
||||
var part = Parts.Single() as GZipFilePart;
|
||||
if (part.GetRawStream().Position != part.EntryStartPosition)
|
||||
{
|
||||
part.GetRawStream().Position = part.EntryStartPosition;
|
||||
}
|
||||
return Parts.Single().GetCompressedStream();
|
||||
}
|
||||
|
||||
#region IArchiveEntry Members
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete => true;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
66
src/SharpCompress/Archives/GZip/GZipWritableArchiveEntry.cs
Normal file
66
src/SharpCompress/Archives/GZip/GZipWritableArchiveEntry.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Archives.GZip
|
||||
{
|
||||
internal class GZipWritableArchiveEntry : GZipArchiveEntry, IWritableArchiveEntry
|
||||
{
|
||||
private readonly bool closeStream;
|
||||
private readonly Stream stream;
|
||||
|
||||
internal GZipWritableArchiveEntry(GZipArchive archive, Stream stream,
|
||||
string path, long size, DateTime? lastModified, bool closeStream)
|
||||
: base(archive, null)
|
||||
{
|
||||
this.stream = stream;
|
||||
Key = path;
|
||||
Size = size;
|
||||
LastModifiedTime = lastModified;
|
||||
this.closeStream = closeStream;
|
||||
}
|
||||
|
||||
public override long Crc => 0;
|
||||
|
||||
public override string Key { get; }
|
||||
|
||||
public override long CompressedSize => 0;
|
||||
|
||||
public override long Size { get; }
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
public override DateTime? CreatedTime => null;
|
||||
|
||||
public override DateTime? LastAccessedTime => null;
|
||||
|
||||
public override DateTime? ArchivedTime => null;
|
||||
|
||||
public override bool IsEncrypted => false;
|
||||
|
||||
public override bool IsDirectory => false;
|
||||
|
||||
public override bool IsSplit => false;
|
||||
|
||||
internal override IEnumerable<FilePart> Parts => throw new NotImplementedException();
|
||||
|
||||
Stream IWritableArchiveEntry.Stream => stream;
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
//ensure new stream is at the start, this could be reset
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return new NonDisposingStream(stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public interface IArchive : IDisposable
|
||||
{
|
||||
event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionBegin;
|
||||
event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionEnd;
|
||||
|
||||
event EventHandler<CompressedBytesReadEventArgs> CompressedBytesRead;
|
||||
event EventHandler<FilePartExtractionBeginEventArgs> FilePartExtractionBegin;
|
||||
|
||||
IEnumerable<IArchiveEntry> Entries { get; }
|
||||
IEnumerable<IVolume> Volumes { get; }
|
||||
|
||||
ArchiveType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to extract all entries in an archive in order.
|
||||
/// This is primarily for SOLID Rar Archives or 7Zip Archives as they need to be
|
||||
/// extracted sequentially for the best performance.
|
||||
/// </summary>
|
||||
IReader ExtractAllEntries();
|
||||
|
||||
/// <summary>
|
||||
/// Archive is SOLID (this means the Archive saved bytes by reusing information which helps for archives containing many small files).
|
||||
/// Rar Archives can be SOLID while all 7Zip archives are considered SOLID.
|
||||
/// </summary>
|
||||
bool IsSolid { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This checks to see if all the known entries have IsComplete = true
|
||||
/// </summary>
|
||||
bool IsComplete { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files compressed in the archive.
|
||||
/// </summary>
|
||||
long TotalSize { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files as uncompressed in the archive.
|
||||
/// </summary>
|
||||
long TotalUncompressSize { get; }
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public interface IArchive : IDisposable
|
||||
{
|
||||
event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionBegin;
|
||||
event EventHandler<ArchiveExtractionEventArgs<IArchiveEntry>> EntryExtractionEnd;
|
||||
|
||||
event EventHandler<CompressedBytesReadEventArgs> CompressedBytesRead;
|
||||
event EventHandler<FilePartExtractionBeginEventArgs> FilePartExtractionBegin;
|
||||
|
||||
IEnumerable<IArchiveEntry> Entries { get; }
|
||||
IEnumerable<IVolume> Volumes { get; }
|
||||
|
||||
ArchiveType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Use this method to extract all entries in an archive in order.
|
||||
/// This is primarily for SOLID Rar Archives or 7Zip Archives as they need to be
|
||||
/// extracted sequentially for the best performance.
|
||||
/// </summary>
|
||||
IReader ExtractAllEntries();
|
||||
|
||||
/// <summary>
|
||||
/// Archive is SOLID (this means the Archive saved bytes by reusing information which helps for archives containing many small files).
|
||||
/// Rar Archives can be SOLID while all 7Zip archives are considered SOLID.
|
||||
/// </summary>
|
||||
bool IsSolid { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This checks to see if all the known entries have IsComplete = true
|
||||
/// </summary>
|
||||
bool IsComplete { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files compressed in the archive.
|
||||
/// </summary>
|
||||
long TotalSize { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files as uncompressed in the archive.
|
||||
/// </summary>
|
||||
long TotalUncompressSize { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,24 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public interface IArchiveEntry : IEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens the current entry as a stream that will decompress as it is read.
|
||||
/// Read the entire stream or use SkipEntry on EntryStream.
|
||||
/// </summary>
|
||||
Stream OpenEntryStream();
|
||||
|
||||
/// <summary>
|
||||
/// The archive can find all the parts of the archive needed to extract this entry.
|
||||
/// </summary>
|
||||
bool IsComplete { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The archive instance this entry belongs to
|
||||
/// </summary>
|
||||
IArchive Archive { get; }
|
||||
}
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public interface IArchiveEntry : IEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Opens the current entry as a stream that will decompress as it is read.
|
||||
/// Read the entire stream or use SkipEntry on EntryStream.
|
||||
/// </summary>
|
||||
Stream OpenEntryStream();
|
||||
|
||||
/// <summary>
|
||||
/// The archive can find all the parts of the archive needed to extract this entry.
|
||||
/// </summary>
|
||||
bool IsComplete { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The archive instance this entry belongs to
|
||||
/// </summary>
|
||||
IArchive Archive { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,123 +1,104 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public static class IArchiveEntryExtensions
|
||||
{
|
||||
public static void WriteTo(this IArchiveEntry archiveEntry, Stream streamToWriteTo)
|
||||
{
|
||||
if (archiveEntry.Archive.Type == ArchiveType.Rar && archiveEntry.Archive.IsSolid)
|
||||
{
|
||||
throw new InvalidFormatException("Cannot use Archive random access on SOLID Rar files.");
|
||||
}
|
||||
|
||||
if (archiveEntry.IsDirectory)
|
||||
{
|
||||
throw new ExtractionException("Entry is a file directory and cannot be extracted.");
|
||||
}
|
||||
|
||||
var streamListener = archiveEntry.Archive as IArchiveExtractionListener;
|
||||
streamListener.EnsureEntriesLoaded();
|
||||
streamListener.FireEntryExtractionBegin(archiveEntry);
|
||||
streamListener.FireFilePartExtractionBegin(archiveEntry.Key, archiveEntry.Size, archiveEntry.CompressedSize);
|
||||
var entryStream = archiveEntry.OpenEntryStream();
|
||||
if (entryStream == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using(entryStream)
|
||||
using (Stream s = new ListeningStream(streamListener, entryStream))
|
||||
{
|
||||
s.TransferTo(streamToWriteTo);
|
||||
}
|
||||
streamListener.FireEntryExtractionEnd(archiveEntry);
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(this IArchiveEntry entry, string destinationDirectory,
|
||||
ExtractOptions options = ExtractOptions.Overwrite)
|
||||
{
|
||||
string destinationFileName;
|
||||
string file = Path.GetFileName(entry.Key);
|
||||
|
||||
|
||||
if (options.HasFlag(ExtractOptions.ExtractFullPath))
|
||||
{
|
||||
string folder = Path.GetDirectoryName(entry.Key);
|
||||
string destdir = Path.Combine(destinationDirectory, folder);
|
||||
if (!Directory.Exists(destdir))
|
||||
{
|
||||
Directory.CreateDirectory(destdir);
|
||||
}
|
||||
destinationFileName = Path.Combine(destdir, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
destinationFileName = Path.Combine(destinationDirectory, file);
|
||||
}
|
||||
entry.WriteToFile(destinationFileName, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific file
|
||||
/// </summary>
|
||||
public static void WriteToFile(this IArchiveEntry entry, string destinationFileName,
|
||||
ExtractOptions options = ExtractOptions.Overwrite)
|
||||
{
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FileMode fm = FileMode.Create;
|
||||
|
||||
if (!options.HasFlag(ExtractOptions.Overwrite))
|
||||
{
|
||||
fm = FileMode.CreateNew;
|
||||
}
|
||||
using (FileStream fs = File.Open(destinationFileName, fm))
|
||||
{
|
||||
entry.WriteTo(fs);
|
||||
}
|
||||
|
||||
if (options.HasFlag(ExtractOptions.PreserveFileTime) || options.HasFlag(ExtractOptions.PreserveAttributes))
|
||||
{
|
||||
// update file time to original packed time
|
||||
FileInfo nf = new FileInfo(destinationFileName);
|
||||
if (nf.Exists)
|
||||
{
|
||||
if (options.HasFlag(ExtractOptions.PreserveFileTime))
|
||||
{
|
||||
if (entry.CreatedTime.HasValue)
|
||||
{
|
||||
nf.CreationTime = entry.CreatedTime.Value;
|
||||
}
|
||||
|
||||
if (entry.LastModifiedTime.HasValue)
|
||||
{
|
||||
nf.LastWriteTime = entry.LastModifiedTime.Value;
|
||||
}
|
||||
|
||||
if (entry.LastAccessedTime.HasValue)
|
||||
{
|
||||
nf.LastAccessTime = entry.CreatedTime.Value;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.HasFlag(ExtractOptions.PreserveAttributes))
|
||||
{
|
||||
if (entry.Attrib.HasValue)
|
||||
{
|
||||
nf.Attributes = (FileAttributes)System.Enum.ToObject(typeof(FileAttributes), entry.Attrib.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.IO;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public static class IArchiveEntryExtensions
|
||||
{
|
||||
public static void WriteTo(this IArchiveEntry archiveEntry, Stream streamToWriteTo)
|
||||
{
|
||||
if (archiveEntry.Archive.Type == ArchiveType.Rar && archiveEntry.Archive.IsSolid)
|
||||
{
|
||||
throw new InvalidFormatException("Cannot use Archive random access on SOLID Rar files.");
|
||||
}
|
||||
|
||||
if (archiveEntry.IsDirectory)
|
||||
{
|
||||
throw new ExtractionException("Entry is a file directory and cannot be extracted.");
|
||||
}
|
||||
|
||||
var streamListener = archiveEntry.Archive as IArchiveExtractionListener;
|
||||
streamListener.EnsureEntriesLoaded();
|
||||
streamListener.FireEntryExtractionBegin(archiveEntry);
|
||||
streamListener.FireFilePartExtractionBegin(archiveEntry.Key, archiveEntry.Size, archiveEntry.CompressedSize);
|
||||
var entryStream = archiveEntry.OpenEntryStream();
|
||||
if (entryStream == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (entryStream)
|
||||
{
|
||||
using (Stream s = new ListeningStream(streamListener, entryStream))
|
||||
{
|
||||
s.TransferTo(streamToWriteTo);
|
||||
}
|
||||
}
|
||||
streamListener.FireEntryExtractionEnd(archiveEntry);
|
||||
}
|
||||
|
||||
#if !NO_FILE
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(this IArchiveEntry entry, string destinationDirectory,
|
||||
ExtractionOptions options = null)
|
||||
{
|
||||
string destinationFileName;
|
||||
string file = Path.GetFileName(entry.Key);
|
||||
|
||||
options = options ?? new ExtractionOptions()
|
||||
{
|
||||
Overwrite = true
|
||||
};
|
||||
|
||||
|
||||
if (options.ExtractFullPath)
|
||||
{
|
||||
string folder = Path.GetDirectoryName(entry.Key);
|
||||
string destdir = Path.Combine(destinationDirectory, folder);
|
||||
if (!Directory.Exists(destdir))
|
||||
{
|
||||
Directory.CreateDirectory(destdir);
|
||||
}
|
||||
destinationFileName = Path.Combine(destdir, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
destinationFileName = Path.Combine(destinationDirectory, file);
|
||||
}
|
||||
if (!entry.IsDirectory)
|
||||
{
|
||||
entry.WriteToFile(destinationFileName, options);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific file
|
||||
/// </summary>
|
||||
public static void WriteToFile(this IArchiveEntry entry, string destinationFileName,
|
||||
ExtractionOptions options = null)
|
||||
{
|
||||
FileMode fm = FileMode.Create;
|
||||
options = options ?? new ExtractionOptions()
|
||||
{
|
||||
Overwrite = true
|
||||
};
|
||||
|
||||
|
||||
if (!options.Overwrite)
|
||||
{
|
||||
fm = FileMode.CreateNew;
|
||||
}
|
||||
using (FileStream fs = File.Open(destinationFileName, fm))
|
||||
{
|
||||
entry.WriteTo(fs);
|
||||
}
|
||||
|
||||
entry.PreserveExtractionOptions(destinationFileName, options);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,26 @@
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public static class IArchiveExtensions
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(this IArchive archive, string destinationDirectory,
|
||||
ExtractOptions options = ExtractOptions.Overwrite)
|
||||
{
|
||||
foreach (IArchiveEntry entry in archive.Entries.Where(x => !x.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(destinationDirectory, options);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if !NO_FILE
|
||||
using System.Linq;
|
||||
using SharpCompress.Readers;
|
||||
|
||||
#endif
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
public static class IArchiveExtensions
|
||||
{
|
||||
#if !NO_FILE
|
||||
|
||||
/// <summary>
|
||||
/// Extract to specific directory, retaining filename
|
||||
/// </summary>
|
||||
public static void WriteToDirectory(this IArchive archive, string destinationDirectory,
|
||||
ExtractionOptions options = null)
|
||||
{
|
||||
foreach (IArchiveEntry entry in archive.Entries.Where(x => !x.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(destinationDirectory, options);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
internal interface IArchiveExtractionListener : IExtractionListener
|
||||
{
|
||||
void EnsureEntriesLoaded();
|
||||
void FireEntryExtractionBegin(IArchiveEntry entry);
|
||||
void FireEntryExtractionEnd(IArchiveEntry entry);
|
||||
}
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archives
|
||||
{
|
||||
internal interface IArchiveExtractionListener : IExtractionListener
|
||||
{
|
||||
void EnsureEntriesLoaded();
|
||||
void FireEntryExtractionBegin(IArchiveEntry entry);
|
||||
void FireEntryExtractionEnd(IArchiveEntry entry);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user