mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Compare commits
287 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
1aa0498e5d | ||
|
|
1ce5e15fd2 | ||
|
|
b40131736a | ||
|
|
c2b15b9c09 | ||
|
|
6fee1f6dc3 | ||
|
|
27a4f78712 | ||
|
|
2b5ee6e8cb | ||
|
|
cd8ea28576 | ||
|
|
b2b6934499 | ||
|
|
0f12a073af | ||
|
|
18bd810228 | ||
|
|
13bbb202c7 | ||
|
|
6e0f4ecbc9 | ||
|
|
9a638e7aa5 | ||
|
|
7a11dc4385 | ||
|
|
66816ce390 | ||
|
|
5d8bd7b69b | ||
|
|
0132c85ec7 | ||
|
|
e5d10e3dba | ||
|
|
0ba87b6c62 | ||
|
|
da47306f04 | ||
|
|
1930126a59 | ||
|
|
baf9f391f1 | ||
|
|
979703dd1f | ||
|
|
ab9e8063dc | ||
|
|
68c09d7221 | ||
|
|
9bf5df72a6 | ||
|
|
91fc241358 | ||
|
|
35a8b444b8 | ||
|
|
2e928e86fd | ||
|
|
6648f33c4e | ||
|
|
2a70ec8100 | ||
|
|
05e0d591a5 | ||
|
|
1d30a1b51d | ||
|
|
315c138c05 | ||
|
|
b0c514d87c | ||
|
|
8e5cb77af2 | ||
|
|
8faebc78d0 | ||
|
|
afff386622 | ||
|
|
9eb43156e8 | ||
|
|
5dd9994d34 | ||
|
|
f18771904e | ||
|
|
ff1cdbfff2 | ||
|
|
332d71d40d | ||
|
|
d9c31dace8 | ||
|
|
33c83e3893 | ||
|
|
c7fc5f8819 | ||
|
|
8df6243807 | ||
|
|
8bf5c99386 | ||
|
|
83eae05e0c | ||
|
|
7c70a7aafd | ||
|
|
dae13c782f | ||
|
|
ae1e37cde6 | ||
|
|
94f4d35663 | ||
|
|
5144104fef | ||
|
|
f87e6672f2 | ||
|
|
312b53398c | ||
|
|
26ddc09c6a | ||
|
|
3113500229 | ||
|
|
ef72829f1c | ||
|
|
088644240a | ||
|
|
065ed29600 | ||
|
|
ee8c1f7904 | ||
|
|
5d6a83578c | ||
|
|
37d8d34601 | ||
|
|
492f64053b | ||
|
|
988fe5eac0 | ||
|
|
c48a47c9b2 | ||
|
|
abed9eb2c9 | ||
|
|
391663ac67 | ||
|
|
a8c055b990 | ||
|
|
7ee885e7d5 | ||
|
|
ed05bd721f | ||
|
|
e52c183f1a | ||
|
|
ed6ad6ac6d | ||
|
|
62f198b532 | ||
|
|
9770cfec9b | ||
|
|
e05f30308c | ||
|
|
6958347849 | ||
|
|
8e6ced6138 | ||
|
|
0c36ff6082 | ||
|
|
f78e839365 | ||
|
|
7e3f04e669 | ||
|
|
2d237bfbca | ||
|
|
e6e88dbde0 | ||
|
|
e558a78354 | ||
|
|
c2df06a746 | ||
|
|
41da844250 | ||
|
|
8fcb0cb7a2 | ||
|
|
2e533f9fb5 | ||
|
|
ca2778b658 | ||
|
|
3147ee0f14 | ||
|
|
f72558de9e | ||
|
|
6d69791db1 | ||
|
|
6e05a20136 | ||
|
|
d36ae445e2 | ||
|
|
022f7ed26b | ||
|
|
d1a64021e1 | ||
|
|
9225531f1e | ||
|
|
650dc6f8bb | ||
|
|
49d6f1f633 | ||
|
|
505f435f5d | ||
|
|
d9d63fba96 | ||
|
|
8c3d260d7c | ||
|
|
0fd00efada | ||
|
|
71e86cd7e4 | ||
|
|
c64a96398d | ||
|
|
efa9805fe4 | ||
|
|
2100d49cef | ||
|
|
66ffc82d41 | ||
|
|
e58ec599f0 | ||
|
|
4eda2043df | ||
|
|
afd65a7505 | ||
|
|
25148a9bf8 | ||
|
|
97bc1865dc | ||
|
|
865afbfbf0 | ||
|
|
c59e6a8c99 | ||
|
|
be9111630e | ||
|
|
d46de85ca2 | ||
|
|
c1562c5829 | ||
|
|
f862cc6947 | ||
|
|
cc3848aea5 | ||
|
|
46fc663e90 | ||
|
|
84ed6bc7f0 | ||
|
|
fe5895d373 | ||
|
|
770e2d6e75 | ||
|
|
84704e5ce2 | ||
|
|
059fe1f545 | ||
|
|
fe8c6aec5f | ||
|
|
3ab38fbfc2 | ||
|
|
b4bfde77d2 | ||
|
|
c4b005b3d4 | ||
|
|
c9d1f7b528 | ||
|
|
21aa57945d | ||
|
|
1d0c7b6445 | ||
|
|
f33d8f9a5e | ||
|
|
ee2d6216b7 | ||
|
|
a42414bdaa | ||
|
|
3e201053c6 | ||
|
|
46c03ce027 | ||
|
|
718dac1a31 | ||
|
|
137f2655a5 | ||
|
|
8109ae003d | ||
|
|
8325b919ce | ||
|
|
61c97faf6c | ||
|
|
2dc297394f |
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
|
||||
test/TestArchives/Original/*.txt eol=crlf
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -1,10 +1,16 @@
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
_ReSharper.SharpCompress/
|
||||
bin/
|
||||
*.suo
|
||||
*.user
|
||||
TestArchives/Scratch/
|
||||
TestArchives/Scratch2/
|
||||
TestResults/
|
||||
*.nupkg
|
||||
**/bin/*
|
||||
**/obj/*
|
||||
_ReSharper.SharpCompress/
|
||||
bin/
|
||||
*.suo
|
||||
*.user
|
||||
TestArchives/Scratch/
|
||||
TestArchives/Scratch2/
|
||||
TestResults/
|
||||
*.nupkg
|
||||
packages/*/
|
||||
project.lock.json
|
||||
test/TestArchives/Scratch
|
||||
.vs
|
||||
tools
|
||||
.vscode
|
||||
|
||||
33
FORMATS.md
Normal file
33
FORMATS.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Archive Formats
|
||||
|
||||
## Accessing Archives
|
||||
Archive classes allow random access to a seekable stream.
|
||||
Reader classes allow forward-only reading
|
||||
Writer classes allow forward-only Writing
|
||||
|
||||
## 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, BZip2, GZip, LZip | Both | TarArchive | TarReader | TarWriter (3) |
|
||||
| GZip (single file) | GZip | Both | GZipArchive | GZipReader | GZipWriter |
|
||||
| 7Zip (4) | LZMA, LZMA2, BZip2, PPMd, BCJ, BCJ2, Deflate | Decompress | SevenZipArchive | N/A | N/A |
|
||||
|
||||
1. SOLID Rars are only supported in the RarReader API.
|
||||
2. Zip format supports pkware and WinzipAES encryption. However, encrypted LZMA is not supported.
|
||||
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
|
||||
|
||||
## Compressors
|
||||
For those who want to directly compress/decompress bits
|
||||
|
||||
| Compressor | Compress/Decompress |
|
||||
| --- | --- |
|
||||
| BZip2Stream | Both |
|
||||
| GZipStream | Both |
|
||||
| DeflateStream | Both |
|
||||
| LZMAStream | Both |
|
||||
| PPMdStream | Both |
|
||||
| ADCStream | Decompress |
|
||||
| LZipStream | Decompress |
|
||||
21
LICENSE.txt
Normal file
21
LICENSE.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Adam Hathcock
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,22 +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.10</version>
|
||||
<title>SharpCompress - Pure C# Decompression/Compression</title>
|
||||
<authors>Adam Hathcock</authors>
|
||||
<owners>Adam Hathcock</owners>
|
||||
<licenseUrl>http://sharpcompress.codeplex.com/license</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 .net40 .net35 sl4</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="..\bin\SharpCompress.dll" target="lib\net40\SharpCompress.dll" />
|
||||
<file src="..\bin\SharpCompress.WindowsStore.dll" target="lib\netcore45\SharpCompress.WindowsStore.dll" />
|
||||
<file src="..\bin\SharpCompress.Portable.dll" target="lib\portable-net4+sl4+wp7+win8\SharpCompress.Portable.dll" />
|
||||
</files>
|
||||
</package>
|
||||
120
README.md
120
README.md
@@ -1,35 +1,123 @@
|
||||
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 is implemented.
|
||||
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.
|
||||
|
||||
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
|
||||
[](https://ci.appveyor.com/project/adamhathcock/sharpcompress/branch/master)
|
||||
|
||||
## Need Help?
|
||||
Post Issues on Github!
|
||||
|
||||
Check the [Supported Formats](FORMATS.md) and [Basic Usage.](USAGE.md)
|
||||
|
||||
## 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
|
||||
* Multi-volume Zip support.
|
||||
* RAR5 support
|
||||
|
||||
## Version Log
|
||||
|
||||
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.14.0
|
||||
|
||||
Some Help/Discussion:
|
||||
https://sharpcompress.codeplex.com/discussions
|
||||
* [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)
|
||||
|
||||
Some Help/Discussion: https://sharpcompress.codeplex.com/discussions
|
||||
|
||||
7Zip implementation based on: https://code.google.com/p/managed-lzma/
|
||||
|
||||
@@ -40,4 +128,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@@ -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,170 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Archive;
|
||||
using SharpCompress.Archive.Rar;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class RarArchiveTests : ArchiveTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Rar_None_ArchiveStreamRead()
|
||||
{
|
||||
ArchiveStreamRead("Rar.none.rar");
|
||||
}
|
||||
[TestMethod]
|
||||
public void Rar_ArchiveStreamRead()
|
||||
{
|
||||
ArchiveStreamRead("Rar.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_Jpg_ArchiveStreamRead()
|
||||
{
|
||||
ResetScratch();
|
||||
using (var stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "RarJpeg.jpg")))
|
||||
{
|
||||
using (var archive = RarArchive.Open(stream, Options.LookForHeader))
|
||||
{
|
||||
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(SCRATCH_FILES_PATH,
|
||||
ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_IsSolidArchiveCheck()
|
||||
{
|
||||
ResetScratch();
|
||||
using (var stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Rar.rar")))
|
||||
{
|
||||
using (var archive = RarArchive.Open(stream))
|
||||
{
|
||||
Assert.IsFalse(archive.IsSolidArchive());
|
||||
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(SCRATCH_FILES_PATH,
|
||||
ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidFormatException))]
|
||||
public void Rar_Solid_ArchiveStreamRead()
|
||||
{
|
||||
ArchiveStreamRead("Rar.solid.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_Solid_StreamRead_Extract_All()
|
||||
{
|
||||
ArchiveStreamReadExtractAll("Rar.solid.rar", CompressionType.Rar);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_Multi_ArchiveStreamRead()
|
||||
{
|
||||
var testArchives = new string[] { "Rar.multi.part01.rar",
|
||||
"Rar.multi.part02.rar",
|
||||
"Rar.multi.part03.rar",
|
||||
"Rar.multi.part04.rar",
|
||||
"Rar.multi.part05.rar",
|
||||
"Rar.multi.part06.rar"};
|
||||
|
||||
|
||||
ResetScratch();
|
||||
using (var archive = RarArchive.Open(testArchives.Select(s => Path.Combine(TEST_ARCHIVES_PATH, s))
|
||||
.Select(p => File.OpenRead(p))))
|
||||
{
|
||||
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RarNoneArchiveFileRead()
|
||||
{
|
||||
ArchiveFileRead("Rar.none.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_ArchiveFileRead()
|
||||
{
|
||||
ArchiveFileRead("Rar.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_ArchiveFileRead_HasDirectories()
|
||||
{
|
||||
ResetScratch();
|
||||
using (var stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "Rar.rar")))
|
||||
{
|
||||
using (var archive = RarArchive.Open(stream))
|
||||
{
|
||||
Assert.IsFalse(archive.IsSolidArchive());
|
||||
Assert.IsTrue(archive.Entries.Any(entry => entry.IsDirectory));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_Jpg_ArchiveFileRead()
|
||||
{
|
||||
ResetScratch();
|
||||
using (var archive = RarArchive.Open(Path.Combine(TEST_ARCHIVES_PATH, "RarJpeg.jpg"), Options.LookForHeader))
|
||||
{
|
||||
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
|
||||
{
|
||||
entry.WriteToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
|
||||
}
|
||||
}
|
||||
VerifyFiles();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(InvalidFormatException))]
|
||||
public void Rar_Solid_ArchiveFileRead()
|
||||
{
|
||||
ArchiveFileRead("Rar.solid.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_Multi_ArchiveFileRead()
|
||||
{
|
||||
ArchiveFileRead("Rar.multi.part01.rar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_IsFirstVolume_True()
|
||||
{
|
||||
using (var archive = RarArchive.Open(Path.Combine(TEST_ARCHIVES_PATH, "Rar.multi.part01.rar")))
|
||||
{
|
||||
Assert.IsTrue(archive.IsMultipartVolume());
|
||||
Assert.IsTrue(archive.IsFirstVolume());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Rar_IsFirstVolume_False()
|
||||
{
|
||||
using (var archive = RarArchive.Open(Path.Combine(TEST_ARCHIVES_PATH, "Rar.multi.part03.rar")))
|
||||
{
|
||||
Assert.IsTrue(archive.IsMultipartVolume());
|
||||
Assert.IsFalse(archive.IsFirstVolume());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,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>true</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>true</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.csproj">
|
||||
<Project>{10A689CF-76A2-4A4F-96E4-553C33398438}</Project>
|
||||
<Name>SharpCompress</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,91 +0,0 @@
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Archive;
|
||||
using SharpCompress.Archive.Tar;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class TarArchiveTests : ArchiveTests
|
||||
{
|
||||
public TarArchiveTests()
|
||||
{
|
||||
UseExtensionInsteadOfNameToVerify = true;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TarArchiveStreamRead()
|
||||
{
|
||||
ArchiveStreamRead("Tar.tar");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TarArchivePathRead()
|
||||
{
|
||||
ArchiveFileRead("Tar.tar");
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void TarArchivePathReadLongName()
|
||||
{
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "very long filename.tar");
|
||||
using (var archive = TarArchive.Open(unmodified))
|
||||
{
|
||||
Assert.AreEqual(2, archive.Entries.Count);
|
||||
Assert.AreEqual(archive.Entries.Last().FilePath, @"very long filename/very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename.jpg");
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_Create_New()
|
||||
{
|
||||
string scratchPath = Path.Combine(SCRATCH_FILES_PATH, "Tar.tar");
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
using (var archive = TarArchive.Create())
|
||||
{
|
||||
archive.AddAllFromDirectory(ORIGINAL_FILES_PATH);
|
||||
archive.SaveTo(scratchPath, CompressionType.None);
|
||||
}
|
||||
CompareArchivesByPath(unmodified, scratchPath);
|
||||
}
|
||||
[TestMethod]
|
||||
public void Tar_Random_Write_Add()
|
||||
{
|
||||
string jpg = Path.Combine(ORIGINAL_FILES_PATH, "jpg\\test.jpg");
|
||||
string scratchPath = Path.Combine(SCRATCH_FILES_PATH, "Tar.mod.tar");
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.mod.tar");
|
||||
string modified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
using (var archive = TarArchive.Open(unmodified))
|
||||
{
|
||||
archive.AddEntry("jpg\\test.jpg", jpg);
|
||||
archive.SaveTo(scratchPath, CompressionType.None);
|
||||
}
|
||||
CompareArchivesByPath(modified, scratchPath);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Tar_Random_Write_Remove()
|
||||
{
|
||||
string scratchPath = Path.Combine(SCRATCH_FILES_PATH, "Tar.mod.tar");
|
||||
string modified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.mod.tar");
|
||||
string unmodified = Path.Combine(TEST_ARCHIVES_PATH, "Tar.noEmptyDirs.tar");
|
||||
|
||||
base.ResetScratch();
|
||||
using (var archive = TarArchive.Open(unmodified))
|
||||
{
|
||||
var entry = archive.Entries.Where(x => x.FilePath.EndsWith("jpg")).Single();
|
||||
archive.RemoveEntry(entry);
|
||||
archive.SaveTo(scratchPath, CompressionType.None);
|
||||
}
|
||||
CompareArchivesByPath(modified, scratchPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Reader;
|
||||
|
||||
namespace SharpCompress.Test
|
||||
{
|
||||
public class TestBase
|
||||
{
|
||||
protected const string TEST_BASE_PATH = @"C:\Git\sharpcompress";
|
||||
protected static readonly string TEST_ARCHIVES_PATH = Path.Combine(TEST_BASE_PATH, "TestArchives", "Archives");
|
||||
protected static readonly string ORIGINAL_FILES_PATH = Path.Combine(TEST_BASE_PATH, "TestArchives", "Original");
|
||||
protected static readonly string MISC_TEST_FILES_PATH = Path.Combine(TEST_BASE_PATH, "TestArchives", "MiscTest");
|
||||
protected static readonly string SCRATCH_FILES_PATH = Path.Combine(TEST_BASE_PATH, "TestArchives", "Scratch");
|
||||
protected static readonly string SCRATCH2_FILES_PATH = Path.Combine(TEST_BASE_PATH, "TestArchives", "Scratch2");
|
||||
|
||||
protected static IEnumerable<string> GetRarArchives()
|
||||
{
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Rar.none.rar");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Rar.rar");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Rar.solid.rar");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Rar.multi.part01.rar");
|
||||
}
|
||||
protected static IEnumerable<string> GetZipArchives()
|
||||
{
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.bzip2.dd.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.bzip2.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd-.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.dd.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.deflate.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.lzma.dd.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.lzma.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.none.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.ppmd.dd.zip");
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Zip.ppmd.zip");
|
||||
}
|
||||
protected static IEnumerable<string> GetTarArchives()
|
||||
{
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar");
|
||||
}
|
||||
protected static IEnumerable<string> GetTarBz2Archives()
|
||||
{
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.bz2");
|
||||
}
|
||||
protected static IEnumerable<string> GetTarGzArchives()
|
||||
{
|
||||
yield return Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar.gz");
|
||||
}
|
||||
|
||||
public void ResetScratch()
|
||||
{
|
||||
if (Directory.Exists(SCRATCH_FILES_PATH))
|
||||
{
|
||||
Directory.Delete(SCRATCH_FILES_PATH, true);
|
||||
}
|
||||
Directory.CreateDirectory(SCRATCH_FILES_PATH);
|
||||
if (Directory.Exists(SCRATCH2_FILES_PATH))
|
||||
{
|
||||
Directory.Delete(SCRATCH2_FILES_PATH, true);
|
||||
}
|
||||
Directory.CreateDirectory(SCRATCH2_FILES_PATH);
|
||||
|
||||
}
|
||||
|
||||
public void VerifyFiles()
|
||||
{
|
||||
if (UseExtensionInsteadOfNameToVerify)
|
||||
{
|
||||
VerifyFilesByExtension();
|
||||
}
|
||||
else
|
||||
{
|
||||
VerifyFilesByName();
|
||||
}
|
||||
}
|
||||
|
||||
protected void VerifyFilesByName()
|
||||
{
|
||||
var extracted =
|
||||
Directory.EnumerateFiles(SCRATCH_FILES_PATH, "*.*", SearchOption.AllDirectories)
|
||||
.ToLookup(path => path.Substring(SCRATCH_FILES_PATH.Length));
|
||||
var original =
|
||||
Directory.EnumerateFiles(ORIGINAL_FILES_PATH, "*.*", SearchOption.AllDirectories)
|
||||
.ToLookup(path => path.Substring(ORIGINAL_FILES_PATH.Length));
|
||||
|
||||
Assert.AreEqual(extracted.Count, original.Count);
|
||||
|
||||
foreach (var orig in original)
|
||||
{
|
||||
Assert.IsTrue(extracted.Contains(orig.Key));
|
||||
|
||||
CompareFilesByPath(orig.Single(), extracted[orig.Key].Single());
|
||||
}
|
||||
}
|
||||
|
||||
protected bool UseExtensionInsteadOfNameToVerify { get; set; }
|
||||
|
||||
protected void VerifyFilesByExtension()
|
||||
{
|
||||
var extracted =
|
||||
Directory.EnumerateFiles(SCRATCH_FILES_PATH, "*.*", SearchOption.AllDirectories)
|
||||
.ToLookup(path => Path.GetExtension(path));
|
||||
var original =
|
||||
Directory.EnumerateFiles(ORIGINAL_FILES_PATH, "*.*", SearchOption.AllDirectories)
|
||||
.ToLookup(path => Path.GetExtension(path));
|
||||
|
||||
Assert.AreEqual(extracted.Count, original.Count);
|
||||
|
||||
foreach (var orig in original)
|
||||
{
|
||||
Assert.IsTrue(extracted.Contains(orig.Key));
|
||||
|
||||
CompareFilesByPath(orig.Single(), extracted[orig.Key].Single());
|
||||
}
|
||||
}
|
||||
|
||||
protected void CompareFilesByPath(string file1, string file2)
|
||||
{
|
||||
using (var file1Stream = File.OpenRead(file1))
|
||||
using (var file2Stream = File.OpenRead(file2))
|
||||
{
|
||||
Assert.AreEqual(file1Stream.Length, file2Stream.Length);
|
||||
int byte1 = 0;
|
||||
int byte2 = 0;
|
||||
for (int counter = 0; byte1 != -1; counter++)
|
||||
{
|
||||
byte1 = file1Stream.ReadByte();
|
||||
byte2 = file2Stream.ReadByte();
|
||||
if (byte1 != byte2)
|
||||
Assert.AreEqual(byte1, byte2, string.Format("Byte {0} differ between {1} and {2}",
|
||||
counter, file1, file2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void CompareArchivesByPath(string file1, string file2)
|
||||
{
|
||||
using (var archive1 = ReaderFactory.Open(File.OpenRead(file1), Options.None))
|
||||
using (var archive2 = ReaderFactory.Open(File.OpenRead(file2), Options.None))
|
||||
{
|
||||
while (archive1.MoveToNextEntry())
|
||||
{
|
||||
Assert.IsTrue(archive2.MoveToNextEntry());
|
||||
Assert.AreEqual(archive1.Entry.FilePath, archive2.Entry.FilePath);
|
||||
}
|
||||
Assert.IsFalse(archive2.MoveToNextEntry());
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly object testLock = new object();
|
||||
|
||||
[TestInitialize]
|
||||
public void TestSetup()
|
||||
{
|
||||
Monitor.Enter(testLock);
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
Monitor.Exit(testLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,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,105 +1,44 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress", "SharpCompress\SharpCompress.csproj", "{10A689CF-76A2-4A4F-96E4-553C33398438}"
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F18F1765-4A02-42FD-9BEF-F0E2FCBD9D17}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
global.json = global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Test", "SharpCompress.Test\SharpCompress.Test.csproj", "{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}"
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SharpCompress", "src\SharpCompress\SharpCompress.xproj", "{FD19DDD8-72B2-4024-8665-0D1F7A2AA998}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.Portable", "SharpCompress\SharpCompress.Portable.csproj", "{7FA7D133-1417-4F85-9998-4C618AC8FEDA}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3C5BE746-03E5-4895-9988-0B57F162F86C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCompress.WindowsStore", "SharpCompress\SharpCompress.WindowsStore.csproj", "{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0F0901FF-E8D9-426A-B5A2-17C7F47C1529}"
|
||||
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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing", "Testing", "{932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}"
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "SharpCompress.Test", "test\SharpCompress.Test\SharpCompress.Test.xproj", "{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998} = {FD19DDD8-72B2-4024-8665-0D1F7A2AA998}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Debug|x86.ActiveCfg = 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
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{10A689CF-76A2-4A4F-96E4-553C33398438}.Release|x86.ActiveCfg = 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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Debug|x86.ActiveCfg = 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
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD}.Release|x86.ActiveCfg = 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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Debug|x86.ActiveCfg = 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
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7FA7D133-1417-4F85-9998-4C618AC8FEDA}.Release|x86.ActiveCfg = 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}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|x64.Build.0 = Debug|x64
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Debug|x86.Build.0 = Debug|x86
|
||||
{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
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|ARM.Build.0 = Release|ARM
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|x64.ActiveCfg = Release|x64
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|x64.Build.0 = Release|x64
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|x86.ActiveCfg = Release|x86
|
||||
{1DF6D83C-31FF-47B6-82FE-C4603BE916B5}.Release|x86.Build.0 = Release|x86
|
||||
{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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Debug|x86.ActiveCfg = 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
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED}.Release|x86.ActiveCfg = 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}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Debug|x86.ActiveCfg = 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
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{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
|
||||
{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{EFDCAF57-FD4D-4E5D-A3D5-F26B875817ED} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{15679D7A-F22C-4943-87FF-BF5C76C4A6FD} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{E9C3C94B-FB27-4B4F-B225-57513C254D37} = {932BBFCC-76E3-45FF-90CA-6BE4FBF4A097}
|
||||
{FD19DDD8-72B2-4024-8665-0D1F7A2AA998} = {3C5BE746-03E5-4895-9988-0B57F162F86C}
|
||||
{3B80E585-A2F3-4666-8F69-C7FFDA0DD7E5} = {0F0901FF-E8D9-426A-B5A2-17C7F47C1529}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,6 +1,119 @@
|
||||
<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_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>
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public static class AbstractWritableArchiveExtensions
|
||||
{
|
||||
public static void SaveTo<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
Stream stream, CompressionType compressionType)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
writableArchive.SaveTo(stream, new CompressionInfo {Type = compressionType});
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
|
||||
public static void AddEntry<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
string entryPath, string filePath)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
var fileInfo = new FileInfo(filePath);
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
throw new FileNotFoundException("Could not AddEntry: " + filePath);
|
||||
}
|
||||
writableArchive.AddEntry(entryPath, new FileInfo(filePath).OpenRead(), true, fileInfo.Length,
|
||||
fileInfo.LastWriteTime);
|
||||
}
|
||||
|
||||
public static void SaveTo<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
string filePath, CompressionType compressionType)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
writableArchive.SaveTo(new FileInfo(filePath), new CompressionInfo {Type = compressionType});
|
||||
}
|
||||
|
||||
public static void SaveTo<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
FileInfo fileInfo, CompressionType compressionType)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
using (var stream = fileInfo.Open(FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
writableArchive.SaveTo(stream, new CompressionInfo {Type = compressionType});
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveTo<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
string filePath, CompressionInfo compressionInfo)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
writableArchive.SaveTo(new FileInfo(filePath), compressionInfo);
|
||||
}
|
||||
|
||||
public static void SaveTo<TEntry, TVolume>(this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
FileInfo fileInfo, CompressionInfo compressionInfo)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
using (var stream = fileInfo.Open(FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
writableArchive.SaveTo(stream, compressionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddAllFromDirectory<TEntry, TVolume>(
|
||||
this AbstractWritableArchive<TEntry, TVolume> writableArchive,
|
||||
string filePath, string searchPattern = "*.*", SearchOption searchOption = SearchOption.AllDirectories)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
foreach (var path in Directory.EnumerateFiles(filePath, searchPattern, searchOption))
|
||||
{
|
||||
var fileInfo = new FileInfo(path);
|
||||
writableArchive.AddEntry(path.Substring(filePath.Length), fileInfo.OpenRead(), true, fileInfo.Length,
|
||||
fileInfo.LastWriteTime);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
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>
|
||||
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;
|
||||
private readonly bool anyNotWritable;
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type)
|
||||
: base(type)
|
||||
{
|
||||
}
|
||||
|
||||
internal AbstractWritableArchive(ArchiveType type, IEnumerable<Stream> streams, Options options)
|
||||
: base(type, streams, options)
|
||||
{
|
||||
if (streams.Any(x => !x.CanWrite))
|
||||
{
|
||||
anyNotWritable = true;
|
||||
}
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
internal AbstractWritableArchive(ArchiveType type, FileInfo fileInfo, Options options)
|
||||
: base(type, fileInfo, options)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
private void CheckWritable()
|
||||
{
|
||||
if (anyNotWritable)
|
||||
{
|
||||
throw new ArchiveException("All Archive streams must be Writable to use Archive writing functionality.");
|
||||
}
|
||||
}
|
||||
|
||||
public override ICollection<TEntry> Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hasModifications)
|
||||
{
|
||||
return modifiedEntries;
|
||||
}
|
||||
return base.Entries;
|
||||
}
|
||||
}
|
||||
|
||||
private void RebuildModifiedCollection()
|
||||
{
|
||||
hasModifications = true;
|
||||
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)
|
||||
{
|
||||
CheckWritable();
|
||||
if (!removedEntries.Contains(entry))
|
||||
{
|
||||
removedEntries.Add(entry);
|
||||
RebuildModifiedCollection();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddEntry(string filePath, Stream source,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
CheckWritable();
|
||||
newEntries.Add(CreateEntry(filePath, source, size, modified, false));
|
||||
RebuildModifiedCollection();
|
||||
}
|
||||
|
||||
public void AddEntry(string filePath, Stream source, bool closeStream,
|
||||
long size = 0, DateTime? modified = null)
|
||||
{
|
||||
CheckWritable();
|
||||
newEntries.Add(CreateEntry(filePath, source, size, modified, closeStream));
|
||||
RebuildModifiedCollection();
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public void AddEntry(string filePath, FileInfo fileInfo)
|
||||
{
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
throw new ArgumentException("FileInfo does not exist.");
|
||||
}
|
||||
AddEntry(filePath, fileInfo.OpenRead(), true, fileInfo.Length, fileInfo.LastWriteTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
public void SaveTo(Stream stream, CompressionInfo compressionType)
|
||||
{
|
||||
SaveTo(stream, compressionType, OldEntries, newEntries);
|
||||
}
|
||||
|
||||
protected abstract TEntry CreateEntry(string filePath, Stream source, long size, DateTime? modified,
|
||||
bool closeStream);
|
||||
|
||||
protected abstract void SaveTo(Stream stream, CompressionInfo compressionType,
|
||||
IEnumerable<TEntry> oldEntries, IEnumerable<TEntry> newEntries);
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.GZip;
|
||||
|
||||
namespace SharpCompress.Archive.GZip
|
||||
{
|
||||
public class GZipArchiveEntry : GZipEntry, IArchiveEntry
|
||||
{
|
||||
private GZipArchive archive;
|
||||
|
||||
internal GZipArchiveEntry(GZipArchive archive, GZipFilePart part)
|
||||
: base(part)
|
||||
{
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
public virtual Stream OpenEntryStream()
|
||||
{
|
||||
return Parts.Single().GetCompressedStream();
|
||||
}
|
||||
|
||||
#region IArchiveEntry Members
|
||||
|
||||
public void WriteTo(Stream streamToWriteTo)
|
||||
{
|
||||
if (IsEncrypted)
|
||||
{
|
||||
throw new PasswordProtectedException("Entry is password protected and cannot be extracted.");
|
||||
}
|
||||
this.Extract(archive, streamToWriteTo);
|
||||
}
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,102 +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
|
||||
{
|
||||
private string path;
|
||||
private long size;
|
||||
private DateTime? lastModified;
|
||||
private bool closeStream;
|
||||
|
||||
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 uint Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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(); }
|
||||
}
|
||||
|
||||
internal Stream Stream { get; private set; }
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
return new NonDisposingStream(Stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
Stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
|
||||
namespace SharpCompress.Archive
|
||||
{
|
||||
public static class IArchiveEntryExtensions
|
||||
{
|
||||
#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.Empty;
|
||||
string file = Path.GetFileName(entry.FilePath);
|
||||
|
||||
|
||||
if (options.HasFlag(ExtractOptions.ExtractFullPath))
|
||||
{
|
||||
string folder = Path.GetDirectoryName(entry.FilePath);
|
||||
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))
|
||||
// using (Stream entryStream = entry.OpenEntryStream())
|
||||
{
|
||||
//entryStream.TransferTo(fs);
|
||||
entry.WriteTo(fs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
|
||||
namespace SharpCompress.Archive.Rar
|
||||
{
|
||||
internal class FileInfoRarFilePart : RarFilePart
|
||||
{
|
||||
private FileInfoRarArchiveVolume volume;
|
||||
|
||||
internal FileInfoRarFilePart(FileInfoRarArchiveVolume volume, MarkHeader mh, FileHeader fh, FileInfo fi)
|
||||
: base(mh, fh)
|
||||
{
|
||||
this.volume = volume;
|
||||
FileInfo = fi;
|
||||
}
|
||||
|
||||
internal FileInfo FileInfo { get; private set; }
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
var stream = volume.Stream;
|
||||
stream.Position = FileHeader.DataStartPosition;
|
||||
return stream;
|
||||
}
|
||||
|
||||
internal override string FilePartName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Rar File: " + FileInfo.FullName
|
||||
+ " File Entry: " + FileHeader.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.Compressor.Rar;
|
||||
using SharpCompress.IO;
|
||||
using SharpCompress.Reader;
|
||||
using SharpCompress.Reader.Rar;
|
||||
|
||||
namespace SharpCompress.Archive.Rar
|
||||
{
|
||||
public class RarArchive : AbstractArchive<RarArchiveEntry, RarVolume>
|
||||
{
|
||||
private readonly Unpack unpack = new Unpack();
|
||||
|
||||
internal Unpack Unpack
|
||||
{
|
||||
get { return unpack; }
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor with a FileInfo object to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="fileInfo"></param>
|
||||
/// <param name="options"></param>
|
||||
internal RarArchive(FileInfo fileInfo, Options options)
|
||||
: base(ArchiveType.Rar, fileInfo, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<RarVolume> LoadVolumes(FileInfo file, Options options)
|
||||
{
|
||||
return RarArchiveVolumeFactory.GetParts(file, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="streams"></param>
|
||||
/// <param name="options"></param>
|
||||
internal RarArchive(IEnumerable<Stream> streams, Options options)
|
||||
: base(ArchiveType.Rar, streams, options)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IEnumerable<RarArchiveEntry> LoadEntries(IEnumerable<RarVolume> volumes)
|
||||
{
|
||||
return RarArchiveEntryFactory.GetEntries(this, volumes);
|
||||
}
|
||||
|
||||
protected override IEnumerable<RarVolume> LoadVolumes(IEnumerable<Stream> streams, Options options)
|
||||
{
|
||||
return RarArchiveVolumeFactory.GetParts(streams, options);
|
||||
}
|
||||
|
||||
protected override IReader CreateReaderForSolidExtraction()
|
||||
{
|
||||
var stream = Volumes.First().Stream;
|
||||
stream.Position = 0;
|
||||
return RarReader.Open(stream);
|
||||
}
|
||||
|
||||
public override bool IsSolid
|
||||
{
|
||||
get { return Volumes.First().IsSolidArchive; }
|
||||
}
|
||||
|
||||
#region Creation
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// Constructor expects a filepath to an existing file.
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
public static RarArchive 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 RarArchive 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 RarArchive 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 RarArchive Open(FileInfo fileInfo, Options options)
|
||||
{
|
||||
fileInfo.CheckNotNull("fileInfo");
|
||||
return new RarArchive(fileInfo, options);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
public static RarArchive Open(Stream stream)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return Open(stream.AsEnumerable());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes a seekable Stream as a source
|
||||
/// </summary>
|
||||
/// <param name="stream"></param>
|
||||
/// <param name="options"></param>
|
||||
public static RarArchive Open(Stream stream, Options options)
|
||||
{
|
||||
stream.CheckNotNull("stream");
|
||||
return Open(stream.AsEnumerable(), options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="streams"></param>
|
||||
public static RarArchive Open(IEnumerable<Stream> streams)
|
||||
{
|
||||
streams.CheckNotNull("streams");
|
||||
return new RarArchive(streams, Options.KeepStreamsOpen);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Takes multiple seekable Streams for a multi-part archive
|
||||
/// </summary>
|
||||
/// <param name="streams"></param>
|
||||
/// <param name="options"></param>
|
||||
public static RarArchive Open(IEnumerable<Stream> streams, Options options)
|
||||
{
|
||||
streams.CheckNotNull("streams");
|
||||
return new RarArchive(streams, options);
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public static bool IsRarFile(string filePath)
|
||||
{
|
||||
return IsRarFile(new FileInfo(filePath));
|
||||
}
|
||||
|
||||
public static bool IsRarFile(FileInfo fileInfo)
|
||||
{
|
||||
if (!fileInfo.Exists)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (Stream stream = fileInfo.OpenRead())
|
||||
{
|
||||
return IsRarFile(stream);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsRarFile(Stream stream)
|
||||
{
|
||||
return IsRarFile(stream, Options.None);
|
||||
}
|
||||
|
||||
public static bool IsRarFile(Stream stream, Options options)
|
||||
{
|
||||
try
|
||||
{
|
||||
var headerFactory = new RarHeaderFactory(StreamingMode.Seekable, options);
|
||||
RarHeader header = headerFactory.ReadHeaders(stream).FirstOrDefault();
|
||||
if (header == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Enum.IsDefined(typeof (HeaderType), header.HeaderType);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
using SharpCompress.Compressor.Rar;
|
||||
|
||||
namespace SharpCompress.Archive.Rar
|
||||
{
|
||||
public class RarArchiveEntry : RarEntry, IArchiveEntry
|
||||
{
|
||||
private readonly ICollection<RarFilePart> parts;
|
||||
|
||||
internal RarArchiveEntry(RarArchive archive, IEnumerable<RarFilePart> parts)
|
||||
{
|
||||
this.parts = parts.ToList();
|
||||
Archive = archive;
|
||||
}
|
||||
|
||||
public override CompressionType CompressionType
|
||||
{
|
||||
get { return CompressionType.Rar; }
|
||||
}
|
||||
|
||||
private RarArchive Archive { get; set; }
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return parts.Cast<FilePart>(); }
|
||||
}
|
||||
|
||||
internal override FileHeader FileHeader
|
||||
{
|
||||
get { return parts.First().FileHeader; }
|
||||
}
|
||||
|
||||
public override uint Crc
|
||||
{
|
||||
get
|
||||
{
|
||||
CheckIncomplete();
|
||||
return parts.Select(fp => fp.FileHeader)
|
||||
.Where(fh => !fh.FileFlags.HasFlag(FileFlags.SPLIT_AFTER))
|
||||
.Single().FileCRC;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
CheckIncomplete();
|
||||
return parts.First().FileHeader.UncompressedSize;
|
||||
}
|
||||
}
|
||||
|
||||
public override long CompressedSize
|
||||
{
|
||||
get
|
||||
{
|
||||
CheckIncomplete();
|
||||
return parts.Aggregate(0L, (total, fp) => { return total + fp.FileHeader.CompressedSize; });
|
||||
}
|
||||
}
|
||||
|
||||
public Stream OpenEntryStream()
|
||||
{
|
||||
return new RarStream(Archive.Unpack, FileHeader,
|
||||
new MultiVolumeReadOnlyStream(Parts.Cast<RarFilePart>(), Archive));
|
||||
}
|
||||
|
||||
public void WriteTo(Stream streamToWriteTo)
|
||||
{
|
||||
CheckIncomplete();
|
||||
if (Archive.IsSolidArchive())
|
||||
{
|
||||
throw new InvalidFormatException("Cannot use Archive random access on SOLID Rar files.");
|
||||
}
|
||||
if (IsEncrypted)
|
||||
{
|
||||
throw new PasswordProtectedException("Entry is password protected and cannot be extracted.");
|
||||
}
|
||||
this.Extract(Archive, streamToWriteTo);
|
||||
}
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get { return parts.Select(fp => fp.FileHeader).Any(fh => !fh.FileFlags.HasFlag(FileFlags.SPLIT_AFTER)); }
|
||||
}
|
||||
|
||||
private void CheckIncomplete()
|
||||
{
|
||||
if (!IsComplete)
|
||||
{
|
||||
throw new IncompleteArchiveException("ArchiveEntry is incomplete and cannot perform this operation.");
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common.Rar;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
|
||||
namespace SharpCompress.Archive.Rar
|
||||
{
|
||||
internal class SeekableStreamFilePart : RarFilePart
|
||||
{
|
||||
internal SeekableStreamFilePart(MarkHeader mh, FileHeader fh, Stream stream)
|
||||
: base(mh, fh)
|
||||
{
|
||||
Stream = stream;
|
||||
}
|
||||
|
||||
internal Stream Stream { get; private set; }
|
||||
|
||||
internal override Stream GetCompressedStream()
|
||||
{
|
||||
Stream.Position = FileHeader.DataStartPosition;
|
||||
return Stream;
|
||||
}
|
||||
|
||||
internal override string FilePartName
|
||||
{
|
||||
get { return "Unknown Stream - File Entry: " + base.FileHeader.FileName; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.IO;
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Common.SevenZip;
|
||||
|
||||
namespace SharpCompress.Archive.SevenZip
|
||||
{
|
||||
public class SevenZipArchiveEntry : SevenZipEntry, IArchiveEntry
|
||||
{
|
||||
private SevenZipArchive archive;
|
||||
|
||||
internal SevenZipArchiveEntry(SevenZipArchive archive, SevenZipFilePart part)
|
||||
: base(part)
|
||||
{
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
public Stream OpenEntryStream()
|
||||
{
|
||||
return FilePart.GetCompressedStream();
|
||||
}
|
||||
|
||||
public void WriteTo(Stream stream)
|
||||
{
|
||||
if (IsEncrypted)
|
||||
{
|
||||
throw new PasswordProtectedException("Entry is password protected and cannot be extracted.");
|
||||
}
|
||||
this.Extract(archive, stream);
|
||||
}
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a 7Zip Anti item
|
||||
/// </summary>
|
||||
public bool IsAnti
|
||||
{
|
||||
get { return FilePart.Header.IsAnti; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +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
|
||||
{
|
||||
private string path;
|
||||
private long size;
|
||||
private DateTime? lastModified;
|
||||
private bool closeStream;
|
||||
|
||||
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 uint Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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(); }
|
||||
}
|
||||
|
||||
internal Stream Stream { get; private set; }
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
return new NonDisposingStream(Stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
Stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SharpCompress.Common.Zip;
|
||||
|
||||
namespace SharpCompress.Archive.Zip
|
||||
{
|
||||
public class ZipArchiveEntry : ZipEntry, IArchiveEntry
|
||||
{
|
||||
private ZipArchive archive;
|
||||
|
||||
internal ZipArchiveEntry(ZipArchive archive, SeekableZipFilePart part)
|
||||
: base(part)
|
||||
{
|
||||
this.archive = archive;
|
||||
}
|
||||
|
||||
public virtual Stream OpenEntryStream()
|
||||
{
|
||||
return Parts.Single().GetCompressedStream();
|
||||
}
|
||||
|
||||
#region IArchiveEntry Members
|
||||
|
||||
public void WriteTo(Stream streamToWriteTo)
|
||||
{
|
||||
this.Extract(archive, streamToWriteTo);
|
||||
}
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public string Comment
|
||||
{
|
||||
get { return (Parts.Single() as SeekableZipFilePart).Comment; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +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
|
||||
{
|
||||
private string path;
|
||||
private long size;
|
||||
private DateTime? lastModified;
|
||||
private bool closeStream;
|
||||
|
||||
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 uint Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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(); }
|
||||
}
|
||||
|
||||
internal Stream Stream { get; private set; }
|
||||
|
||||
public override Stream OpenEntryStream()
|
||||
{
|
||||
return new NonDisposingStream(Stream);
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
if (closeStream)
|
||||
{
|
||||
Stream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if PORTABLE
|
||||
[assembly: AssemblyTitle("SharpCompress.Portable")]
|
||||
[assembly: AssemblyProduct("SharpCompress.Portable")]
|
||||
#else
|
||||
|
||||
[assembly: AssemblyTitle("SharpCompress")]
|
||||
[assembly: AssemblyProduct("SharpCompress")]
|
||||
[assembly:
|
||||
InternalsVisibleTo(
|
||||
"SharpCompress.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010005d6ae1b0f6875393da83c920a5b9408f5191aaf4e8b3c2c476ad2a11f5041ecae84ce9298bc4c203637e2fd3a80ad5378a9fa8da1363e98cea45c73969198a4b64510927c910001491cebbadf597b22448ad103b0a4007e339faf8fe8665dcdb70d65b27ac05b1977c0655fad06b372b820ecbdccf10a0f214fee0986dfeded"
|
||||
)]
|
||||
[assembly:
|
||||
InternalsVisibleTo(
|
||||
"SharpCompress.Test.Portable, PublicKey=002400000480000094000000060200000024000052534131000400000100010005d6ae1b0f6875393da83c920a5b9408f5191aaf4e8b3c2c476ad2a11f5041ecae84ce9298bc4c203637e2fd3a80ad5378a9fa8da1363e98cea45c73969198a4b64510927c910001491cebbadf597b22448ad103b0a4007e339faf8fe8665dcdb70d65b27ac05b1977c0655fad06b372b820ecbdccf10a0f214fee0986dfeded"
|
||||
)]
|
||||
#endif
|
||||
@@ -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,20 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
[Flags]
|
||||
public enum ExtractOptions
|
||||
{
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// overwrite target if it exists
|
||||
/// </summary>
|
||||
Overwrite,
|
||||
|
||||
/// <summary>
|
||||
/// extract with internal directory structure
|
||||
/// </summary>
|
||||
ExtractFullPath,
|
||||
}
|
||||
}
|
||||
@@ -1,90 +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 uint Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +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
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// File that backs this volume, if it not stream based
|
||||
/// </summary>
|
||||
public override FileInfo VolumeFile
|
||||
{
|
||||
get { return fileInfo; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool IsFirstVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsMultiVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
public class GenericVolume : Volume
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
private FileInfo fileInfo;
|
||||
#endif
|
||||
|
||||
public GenericVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public GenericVolume(FileInfo fileInfo, Options options)
|
||||
: base(fileInfo.OpenRead(), options)
|
||||
{
|
||||
this.fileInfo = fileInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// File that backs this volume, if it not stream based
|
||||
/// </summary>
|
||||
public override FileInfo VolumeFile
|
||||
{
|
||||
get { return fileInfo; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override bool IsFirstVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool IsMultiVolume
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
using System.IO;
|
||||
#endif
|
||||
|
||||
namespace SharpCompress.Common
|
||||
{
|
||||
public interface IVolume : IDisposable
|
||||
{
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
/// <summary>
|
||||
/// File that backs this volume, if it not stream based
|
||||
/// </summary>
|
||||
FileInfo VolumeFile { get; }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -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,85 +0,0 @@
|
||||
using System;
|
||||
using SharpCompress.Common.Rar.Headers;
|
||||
|
||||
namespace SharpCompress.Common.Rar
|
||||
{
|
||||
public abstract class RarEntry : Entry
|
||||
{
|
||||
internal abstract FileHeader FileHeader { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The File's 32 bit CRC Hash
|
||||
/// </summary>
|
||||
public override uint Crc
|
||||
{
|
||||
get { return FileHeader.FileCRC; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The path of the file internal to the Rar Archive.
|
||||
/// </summary>
|
||||
public override string FilePath
|
||||
{
|
||||
get { return FileHeader.FileName; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entry last modified time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? LastModifiedTime
|
||||
{
|
||||
get { return FileHeader.FileLastModifiedTime; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entry create time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { return FileHeader.FileCreatedTime; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entry last accessed time in the archive, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { return FileHeader.FileLastAccessedTime; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The entry time whend archived, if recorded
|
||||
/// </summary>
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { return FileHeader.FileArchivedTime; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry is password protected and encrypted and cannot be extracted.
|
||||
/// </summary>
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return FileHeader.FileFlags.HasFlag(FileFlags.PASSWORD); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entry is password protected and encrypted and cannot be extracted.
|
||||
/// </summary>
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return FileHeader.FileFlags.HasFlag(FileFlags.DIRECTORY); }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return FileHeader.FileFlags.HasFlag(FileFlags.SPLIT_AFTER); }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Entry Path: {0} Compressed Size: {1} Uncompressed Size: {2} CRC: {3}",
|
||||
FilePath, CompressedSize, Size, Crc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,112 +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.UTF8.GetBytes(password);
|
||||
for (int i = 0; i < password.Length; i++)
|
||||
{
|
||||
rawPassword[i * 2] = passwordBytes[i];
|
||||
rawPassword[i * 2 + 1] = 0;
|
||||
}
|
||||
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()
|
||||
{
|
||||
rijndael.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +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 uint Crc
|
||||
{
|
||||
get { return FilePart.Header.Crc ?? 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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 { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override DateTime? CreatedTime
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override DateTime? LastAccessedTime
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override DateTime? ArchivedTime
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override bool IsEncrypted
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool IsDirectory
|
||||
{
|
||||
get { return FilePart.Header.IsDir; }
|
||||
}
|
||||
|
||||
public override bool IsSplit
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
internal override IEnumerable<FilePart> Parts
|
||||
{
|
||||
get { return FilePart.AsEnumerable<FilePart>(); }
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.SevenZip
|
||||
{
|
||||
public class SevenZipVolume : GenericVolume
|
||||
{
|
||||
public SevenZipVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public SevenZipVolume(FileInfo fileInfo, Options options)
|
||||
: base(fileInfo, options)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,108 +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 uint Crc
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.Tar
|
||||
{
|
||||
public class TarVolume : GenericVolume
|
||||
{
|
||||
public TarVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public TarVolume(FileInfo fileInfo, Options options)
|
||||
: base(fileInfo, options)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -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,120 +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 uint Crc
|
||||
{
|
||||
get { return filePart.Header.Crc; }
|
||||
}
|
||||
|
||||
public override string FilePath
|
||||
{
|
||||
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>(); }
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,21 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Common.Zip
|
||||
{
|
||||
public class ZipVolume : GenericVolume
|
||||
{
|
||||
public ZipVolume(Stream stream, Options options)
|
||||
: base(stream, options)
|
||||
{
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public ZipVolume(FileInfo fileInfo, Options options)
|
||||
: base(fileInfo, options)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public string Comment { get; internal set; }
|
||||
}
|
||||
}
|
||||
@@ -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,120 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.Compressor.LZMA.Utilites
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows reading the same stream from multiple threads by synchronizing read access.
|
||||
/// </summary>
|
||||
internal class SyncStreamView : Stream
|
||||
{
|
||||
private object mSync;
|
||||
private Stream mStream;
|
||||
private long mOrigin;
|
||||
private long mEnding;
|
||||
private long mOffset;
|
||||
private bool isDisposed;
|
||||
|
||||
public SyncStreamView(object sync, Stream stream, long origin, long length)
|
||||
{
|
||||
mSync = sync;
|
||||
mStream = stream;
|
||||
mOrigin = origin;
|
||||
mEnding = checked(origin + length);
|
||||
mOffset = 0;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (isDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
isDisposed = true;
|
||||
base.Dispose(disposing);
|
||||
mStream.Dispose();
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return mEnding - mOrigin; }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { return mOffset; }
|
||||
set
|
||||
{
|
||||
if (value < 0 || value > Length)
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
|
||||
mOffset = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
long remaining = mEnding - mOrigin - mOffset;
|
||||
if (count > remaining)
|
||||
count = (int)remaining;
|
||||
|
||||
if (count == 0)
|
||||
return 0;
|
||||
|
||||
int delta;
|
||||
lock (mSync)
|
||||
{
|
||||
mStream.Position = mOrigin + mOffset;
|
||||
delta = mStream.Read(buffer, offset, count);
|
||||
}
|
||||
|
||||
mOffset += delta;
|
||||
return delta;
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
return Position = offset;
|
||||
case SeekOrigin.Current:
|
||||
return Position += offset;
|
||||
case SeekOrigin.End:
|
||||
return Position = Length + offset;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException("origin");
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace master._7zip.Utilities
|
||||
{
|
||||
/// <remarks>
|
||||
/// This stream is a length-constrained wrapper around a cached stream so it does not dispose the inner stream.
|
||||
/// </remarks>
|
||||
internal class UnpackSubStream: Stream
|
||||
{
|
||||
private Stream mSource;
|
||||
private long mLength;
|
||||
private long mOffset;
|
||||
|
||||
internal UnpackSubStream(Stream source, long length)
|
||||
{
|
||||
mSource = source;
|
||||
mLength = length;
|
||||
}
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return mSource.CanRead; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { return mLength; }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { return mOffset; }
|
||||
set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if(buffer == null)
|
||||
throw new ArgumentNullException("buffer");
|
||||
|
||||
if(offset < 0 || offset > buffer.Length)
|
||||
throw new ArgumentOutOfRangeException("offset");
|
||||
|
||||
if(count < 0 || count > buffer.Length - offset)
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
|
||||
if(count > mLength - mOffset)
|
||||
count = (int)(mLength - mOffset);
|
||||
|
||||
if(count == 0)
|
||||
return 0;
|
||||
|
||||
int processed = mSource.Read(buffer, offset, count);
|
||||
if(processed == 0)
|
||||
throw new EndOfStreamException("Decoded stream ended prematurely, unpacked data is corrupt.");
|
||||
|
||||
mOffset += processed;
|
||||
return processed;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
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,68 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace SharpCompress.IO
|
||||
{
|
||||
internal class CountingWritableSubStream : Stream
|
||||
{
|
||||
private Stream writableStream;
|
||||
|
||||
internal CountingWritableSubStream(Stream stream)
|
||||
{
|
||||
writableStream = stream;
|
||||
}
|
||||
|
||||
public uint Count { get; private set; }
|
||||
|
||||
public override bool CanRead
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanSeek
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
public override long Length
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override long Position
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
set { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
writableStream.Write(buffer, offset, count);
|
||||
Count += (uint) count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +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; }
|
||||
}
|
||||
|
||||
internal override void Close()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,323 +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.Portable</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile1</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<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;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\</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\AbstractWritableArchive.Extensions.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\IArchiveEntry.cs" />
|
||||
<Compile Include="Archive\IArchiveEntry.Extensions.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\SeekableStreamFilePart.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\GenericVolume.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\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="Common\IStreamListener.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\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\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\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\SyncStreamView.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\UnpackSubStream.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\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\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,402 +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</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>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="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.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="Common\GenericVolume.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\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\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\SyncStreamView.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\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\IStreamListener.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\SeekableStreamFilePart.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="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\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,386 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.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.WindowsStore</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\</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\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</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\AbstractWritableArchive.Extensions.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\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\SeekableStreamFilePart.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\GenericVolume.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\IncompleteArchiveException.cs" />
|
||||
<Compile Include="Common\InvalidFormatException.cs" />
|
||||
<Compile Include="Common\IStreamListener.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\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\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\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\SyncStreamView.cs" />
|
||||
<Compile Include="Compressor\LZMA\Utilites\UnpackSubStream.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\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\ZipWriter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '11.0' ">
|
||||
<VisualStudioVersion>11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</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,387 +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>
|
||||
<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</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<NoWarn>1591</NoWarn>
|
||||
<DocumentationFile>..\bin\SharpCompress.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.xml</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="Common\ArchiveEncoding.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.cs" />
|
||||
<Compile Include="Archive\AbstractArchive.cs" />
|
||||
<Compile Include="Archive\AbstractWritableArchive.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="Common\GenericVolume.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\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\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\SyncStreamView.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\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\IStreamListener.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\SeekableStreamFilePart.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="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\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,512 +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>
|
||||
#if PORTABLE || NETFX_CORE
|
||||
public static void WriteLittleEndian(byte[] array, int pos, short value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
#else
|
||||
public static unsafe void WriteLittleEndian(byte[] array, int pos, short value)
|
||||
{
|
||||
fixed (byte* numRef = &(array[pos]))
|
||||
{
|
||||
*((short*)numRef) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <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>
|
||||
#if PORTABLE || NETFX_CORE
|
||||
public static void WriteLittleEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
#else
|
||||
public static unsafe void WriteLittleEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
fixed (byte* numRef = &(array[pos]))
|
||||
{
|
||||
*((int*)numRef) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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);
|
||||
}
|
||||
catch
|
||||
{
|
||||
dt = new DateTime();
|
||||
}
|
||||
return dt;
|
||||
}
|
||||
|
||||
public static uint DateTimeToDosTime(this DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return (uint)(
|
||||
(dateTime.Value.Second / 2) | (dateTime.Value.Minute << 5) | (dateTime.Value.Hour << 11) |
|
||||
(dateTime.Value.Day << 16) | (dateTime.Value.Month << 21) |
|
||||
((dateTime.Value.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[4096];
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
internal static void Extract<TEntry, TVolume>(this TEntry entry,
|
||||
AbstractArchive<TEntry, TVolume> archive, Stream streamToWriteTo)
|
||||
where TEntry : IArchiveEntry
|
||||
where TVolume : IVolume
|
||||
{
|
||||
if (entry.IsDirectory)
|
||||
{
|
||||
throw new ExtractionException("Entry is a file directory and cannot be extracted.");
|
||||
}
|
||||
|
||||
archive.EnsureEntriesLoaded();
|
||||
archive.FireEntryExtractionBegin(entry);
|
||||
((IStreamListener)archive).FireFilePartExtractionBegin(entry.FilePath, entry.Size, entry.CompressedSize);
|
||||
using (Stream s = new ListeningStream(archive, entry.OpenEntryStream()))
|
||||
{
|
||||
s.TransferTo(streamToWriteTo);
|
||||
}
|
||||
archive.FireEntryExtractionEnd(entry);
|
||||
}
|
||||
|
||||
#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.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.10.0.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,320 +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 ZipCompressionMethod compression;
|
||||
private readonly CompressionLevel deflateCompressionLevel;
|
||||
|
||||
private readonly List<ZipCentralDirectoryEntry> entries = new List<ZipCentralDirectoryEntry>();
|
||||
private readonly string zipComment;
|
||||
private long streamPosition;
|
||||
|
||||
private readonly PpmdProperties ppmdProperties; // Caching properties to speed up PPMd.
|
||||
|
||||
public ZipWriter(Stream destination, CompressionInfo compressionInfo, string zipComment)
|
||||
: base(ArchiveType.Zip)
|
||||
{
|
||||
this.zipComment = zipComment ?? string.Empty;
|
||||
|
||||
switch (compressionInfo.Type)
|
||||
{
|
||||
case CompressionType.None:
|
||||
{
|
||||
compression = ZipCompressionMethod.None;
|
||||
}
|
||||
break;
|
||||
case CompressionType.Deflate:
|
||||
{
|
||||
compression = ZipCompressionMethod.Deflate;
|
||||
deflateCompressionLevel = compressionInfo.DeflateCompressionLevel;
|
||||
}
|
||||
break;
|
||||
case CompressionType.BZip2:
|
||||
{
|
||||
compression = ZipCompressionMethod.BZip2;
|
||||
}
|
||||
break;
|
||||
case CompressionType.LZMA:
|
||||
{
|
||||
compression = ZipCompressionMethod.LZMA;
|
||||
}
|
||||
break;
|
||||
case CompressionType.PPMd:
|
||||
{
|
||||
ppmdProperties = new PpmdProperties();
|
||||
compression = ZipCompressionMethod.PPMd;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidFormatException("Invalid compression method: " + compressionInfo.Type);
|
||||
}
|
||||
InitalizeStream(destination, false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (isDisposing)
|
||||
{
|
||||
uint size = 0;
|
||||
foreach (ZipCentralDirectoryEntry entry in entries)
|
||||
{
|
||||
size += entry.Write(OutputStream, 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)
|
||||
{
|
||||
using (Stream output = WriteToStream(entryPath, modificationTime, comment))
|
||||
{
|
||||
source.TransferTo(output);
|
||||
}
|
||||
}
|
||||
|
||||
public Stream WriteToStream(string entryPath, DateTime? modificationTime, string comment)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
byte[] encodedFilename = Encoding.UTF8.GetBytes(filename);
|
||||
|
||||
OutputStream.Write(BitConverter.GetBytes(ZipHeaderFactory.ENTRY_HEADER_BYTES), 0, 4);
|
||||
OutputStream.Write(new byte[] {63, 0}, 0, 2); //version
|
||||
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(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 = Encoding.UTF8.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.compression)
|
||||
{
|
||||
case ZipCompressionMethod.None:
|
||||
{
|
||||
return output;
|
||||
}
|
||||
case ZipCompressionMethod.Deflate:
|
||||
{
|
||||
return new DeflateStream(counting, CompressionMode.Compress, writer.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.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,129 +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/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></wpf:ResourceDictionary>
|
||||
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);
|
||||
}
|
||||
```
|
||||
17
appveyor.yml
Normal file
17
appveyor.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
version: '0.13.{build}'
|
||||
|
||||
init:
|
||||
- git config --global core.autocrlf true
|
||||
|
||||
build_script:
|
||||
- ps: .\build.ps1
|
||||
|
||||
test: off
|
||||
|
||||
cache:
|
||||
- tools -> build.cake
|
||||
- tools -> build.ps1
|
||||
|
||||
artifacts:
|
||||
- path: nupkgs\*.nupkg
|
||||
name: NuPkgs
|
||||
229
build.cake
Normal file
229
build.cake
Normal file
@@ -0,0 +1,229 @@
|
||||
#addin "Cake.Json"
|
||||
|
||||
#addin "nuget:?package=NuGet.Core"
|
||||
|
||||
using NuGet;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// ARGUMENTS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
var target = Argument("target", "Default");
|
||||
var apiKey = Argument("apiKey", "");
|
||||
var repo = Argument("repo", "");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// PREPARATION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
var sources = new [] { "https://api.nuget.org/v3/index.json" };
|
||||
var publishTarget = "";
|
||||
|
||||
Warning("=============");
|
||||
var globalPath = MakeFullPath("global.json");
|
||||
var nupkgs = MakeFullPath("nupkgs");
|
||||
Warning("Operating on global.json: " + globalPath);
|
||||
Warning("=============");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// FUNCTIONS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
string MakeFullPath(string relativePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(repo))
|
||||
{
|
||||
return MakeAbsolute(new DirectoryPath(relativePath)).ToString();
|
||||
}
|
||||
if (!System.IO.Path.IsPathRooted(repo))
|
||||
{
|
||||
return MakeAbsolute(new DirectoryPath(System.IO.Path.Combine(repo,relativePath))).ToString();
|
||||
}
|
||||
return System.IO.Path.Combine(repo, relativePath);
|
||||
}
|
||||
|
||||
IEnumerable<string> GetAllProjects()
|
||||
{
|
||||
var global = DeserializeJsonFromFile<JObject>(globalPath);
|
||||
var projs = global["projects"].Select(x => x.ToString());
|
||||
foreach(var y in projs)
|
||||
{
|
||||
yield return MakeFullPath(y);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<string> GetSourceProjects()
|
||||
{
|
||||
return GetAllProjects().Where(x => x.EndsWith("src"));
|
||||
}
|
||||
|
||||
IEnumerable<string> GetTestProjects()
|
||||
{
|
||||
return GetAllProjects().Where(x => x.EndsWith("test"));
|
||||
}
|
||||
|
||||
IEnumerable<string> GetFrameworks(string path)
|
||||
{
|
||||
var projectJObject = DeserializeJsonFromFile<JObject>(path);
|
||||
foreach(var prop in ((JObject)projectJObject["frameworks"]).Properties())
|
||||
{
|
||||
yield return prop.Name;
|
||||
}
|
||||
}
|
||||
|
||||
string GetVersion(string path)
|
||||
{
|
||||
var projectJObject = DeserializeJsonFromFile<JObject>(path);
|
||||
return ((JToken)projectJObject["version"]).ToString();
|
||||
}
|
||||
|
||||
IEnumerable<string> GetProjectJsons(IEnumerable<string> projects)
|
||||
{
|
||||
foreach(var proj in projects)
|
||||
{
|
||||
foreach(var projectJson in GetFiles(proj + "/**/project.json"))
|
||||
{
|
||||
yield return MakeFullPath(projectJson.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsNuGetPublished (FilePath file, string nugetSource)
|
||||
{
|
||||
var pkg = new ZipPackage(file.ToString());
|
||||
|
||||
var repo = PackageRepositoryFactory.Default.CreateRepository(nugetSource);
|
||||
|
||||
var packages = repo.FindPackagesById(pkg.Id);
|
||||
|
||||
var version = SemanticVersion.Parse(pkg.Version.ToString());
|
||||
|
||||
//Filter the list of packages that are not Release (Stable) versions
|
||||
var exists = packages.Any (p => p.Version == version);
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TASKS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Restore")
|
||||
.Does(() =>
|
||||
{
|
||||
var settings = new DotNetCoreRestoreSettings
|
||||
{
|
||||
Sources = sources,
|
||||
NoCache = true
|
||||
};
|
||||
|
||||
foreach(var project in GetProjectJsons(GetSourceProjects().Concat(GetTestProjects())))
|
||||
{
|
||||
DotNetCoreRestore(project, settings);
|
||||
}
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
.Does(() =>
|
||||
{
|
||||
var settings = new DotNetCoreBuildSettings
|
||||
{
|
||||
Configuration = "Release"
|
||||
};
|
||||
|
||||
foreach(var project in GetProjectJsons(GetSourceProjects().Concat(GetTestProjects())))
|
||||
{
|
||||
foreach(var framework in GetFrameworks(project))
|
||||
{
|
||||
Information("Building: {0} on Framework: {1}", project, framework);
|
||||
Information("========");
|
||||
settings.Framework = framework;
|
||||
DotNetCoreBuild(project, settings);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Task("Test")
|
||||
.Does(() =>
|
||||
{
|
||||
var settings = new DotNetCoreTestSettings
|
||||
{
|
||||
Configuration = "Release",
|
||||
Verbose = true
|
||||
};
|
||||
|
||||
foreach(var project in GetProjectJsons(GetTestProjects()))
|
||||
{
|
||||
settings.Framework = GetFrameworks(project).First();
|
||||
DotNetCoreTest(project.ToString(), settings);
|
||||
}
|
||||
|
||||
}).ReportError(exception =>
|
||||
{
|
||||
Error(exception.ToString());
|
||||
});
|
||||
|
||||
Task("Pack")
|
||||
.Does(() =>
|
||||
{
|
||||
if (DirectoryExists(nupkgs))
|
||||
{
|
||||
DeleteDirectory(nupkgs, true);
|
||||
}
|
||||
CreateDirectory(nupkgs);
|
||||
|
||||
var settings = new DotNetCorePackSettings
|
||||
{
|
||||
Configuration = "Release",
|
||||
OutputDirectory = nupkgs
|
||||
};
|
||||
|
||||
foreach(var project in GetProjectJsons(GetSourceProjects()))
|
||||
{
|
||||
DotNetCorePack(project, settings);
|
||||
}
|
||||
});
|
||||
|
||||
Task("Publish")
|
||||
.IsDependentOn("Restore")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Test")
|
||||
.IsDependentOn("Pack")
|
||||
.Does(() =>
|
||||
{
|
||||
var packages = GetFiles(nupkgs + "/*.nupkg");
|
||||
foreach(var package in packages)
|
||||
{
|
||||
if (package.ToString().Contains("symbols"))
|
||||
{
|
||||
Warning("Skipping Symbols package " + package);
|
||||
continue;
|
||||
}
|
||||
if (IsNuGetPublished(package, sources[1]))
|
||||
{
|
||||
throw new InvalidOperationException(package + " is already published.");
|
||||
}
|
||||
NuGetPush(package, new NuGetPushSettings{
|
||||
ApiKey = apiKey,
|
||||
Verbosity = NuGetVerbosity.Detailed,
|
||||
Source = publishTarget
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// TASK TARGETS
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Task("Default")
|
||||
.IsDependentOn("Restore")
|
||||
.IsDependentOn("Build")
|
||||
.IsDependentOn("Test")
|
||||
.IsDependentOn("Pack");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// EXECUTION
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
RunTarget(target);
|
||||
130
build.ps1
Normal file
130
build.ps1
Normal file
@@ -0,0 +1,130 @@
|
||||
<#
|
||||
.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 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 WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.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]$WhatIf,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
$CakeVersion = "0.16.1"
|
||||
$DotNetChannel = "preview";
|
||||
$DotNetVersion = "1.0.0-preview2-003131";
|
||||
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1";
|
||||
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
|
||||
# Make sure tools folder exists
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
$ToolPath = Join-Path $PSScriptRoot "tools"
|
||||
if (!(Test-Path $ToolPath)) {
|
||||
Write-Verbose "Creating tools directory..."
|
||||
New-Item -Path $ToolPath -Type directory | out-null
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL .NET CORE CLI
|
||||
###########################################################################
|
||||
|
||||
Function Remove-PathVariable([string]$VariableToRemove)
|
||||
{
|
||||
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
|
||||
if ($path -ne $null)
|
||||
{
|
||||
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
|
||||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
|
||||
}
|
||||
|
||||
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
|
||||
if ($path -ne $null)
|
||||
{
|
||||
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
|
||||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
|
||||
}
|
||||
}
|
||||
|
||||
# Get .NET Core CLI path if installed.
|
||||
$FoundDotNetCliVersion = $null;
|
||||
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
|
||||
$FoundDotNetCliVersion = dotnet --version;
|
||||
}
|
||||
|
||||
if($FoundDotNetCliVersion -ne $DotNetVersion) {
|
||||
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
|
||||
if (!(Test-Path $InstallPath)) {
|
||||
mkdir -Force $InstallPath | Out-Null;
|
||||
}
|
||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
|
||||
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
|
||||
|
||||
Remove-PathVariable "$InstallPath"
|
||||
$env:PATH = "$InstallPath;$env:PATH"
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL NUGET
|
||||
###########################################################################
|
||||
|
||||
# Make sure nuget.exe exists.
|
||||
$NugetPath = Join-Path $ToolPath "nuget.exe"
|
||||
if (!(Test-Path $NugetPath)) {
|
||||
Write-Host "Downloading NuGet.exe..."
|
||||
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath);
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL CAKE
|
||||
###########################################################################
|
||||
|
||||
# Make sure Cake has been installed.
|
||||
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion/Cake.exe"
|
||||
if (!(Test-Path $CakePath)) {
|
||||
Write-Host "Installing Cake..."
|
||||
Invoke-Expression "&`"$NugetPath`" install Cake -Version $CakeVersion -OutputDirectory `"$ToolPath`"" | Out-Null;
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring Cake from NuGet."
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
|
||||
# Build the argument list.
|
||||
$Arguments = @{
|
||||
target=$Target;
|
||||
configuration=$Configuration;
|
||||
verbosity=$Verbosity;
|
||||
dryrun=$WhatIf;
|
||||
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CakePath`" `"$Script`" $Arguments $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
||||
3
global.json
Normal file
3
global.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"projects": ["src","test"]
|
||||
}
|
||||
@@ -1,205 +1,191 @@
|
||||
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, IStreamListener
|
||||
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;
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
internal AbstractArchive(ArchiveType type, FileInfo fileInfo, Options options)
|
||||
{
|
||||
this.Type = type;
|
||||
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)
|
||||
{
|
||||
this.Type = type;
|
||||
lazyVolumes =
|
||||
new LazyReadOnlyCollection<TVolume>(LoadVolumes(streams.Select<Stream, Stream>(CheckStreams), options));
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(LoadEntries(Volumes));
|
||||
}
|
||||
|
||||
internal AbstractArchive(ArchiveType type)
|
||||
{
|
||||
this.Type = type;
|
||||
lazyVolumes = new LazyReadOnlyCollection<TVolume>(Enumerable.Empty<TVolume>());
|
||||
lazyEntries = new LazyReadOnlyCollection<TEntry>(Enumerable.Empty<TEntry>());
|
||||
}
|
||||
|
||||
internal void FireEntryExtractionBegin(IArchiveEntry entry)
|
||||
{
|
||||
if (EntryExtractionBegin != null)
|
||||
{
|
||||
EntryExtractionBegin(this, new ArchiveExtractionEventArgs<IArchiveEntry>(entry));
|
||||
}
|
||||
}
|
||||
|
||||
internal void 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>
|
||||
/// <returns></returns>
|
||||
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>
|
||||
/// <returns></returns>
|
||||
public ICollection<TVolume> Volumes
|
||||
{
|
||||
get { return lazyVolumes; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total size of the files compressed in the archive.
|
||||
/// </summary>
|
||||
public long TotalSize
|
||||
{
|
||||
get { return Entries.Aggregate(0L, (total, cf) => total + cf.CompressedSize); }
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<TVolume> LoadVolumes(IEnumerable<Stream> streams, Options options);
|
||||
protected abstract IEnumerable<TEntry> LoadEntries(IEnumerable<TVolume> volumes);
|
||||
|
||||
IEnumerable<IArchiveEntry> IArchive.Entries
|
||||
{
|
||||
get { return lazyEntries.Cast<IArchiveEntry>(); }
|
||||
}
|
||||
|
||||
IEnumerable<IVolume> IArchive.Volumes
|
||||
{
|
||||
get { return lazyVolumes.Cast<IVolume>(); }
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
lazyVolumes.ForEach(v => v.Dispose());
|
||||
lazyEntries.GetLoaded().Cast<Entry>().ForEach(x => x.Close());
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void EnsureEntriesLoaded()
|
||||
{
|
||||
lazyEntries.EnsureFullyLoaded();
|
||||
lazyVolumes.EnsureFullyLoaded();
|
||||
}
|
||||
|
||||
|
||||
public ArchiveType Type { get; private set; }
|
||||
|
||||
void IStreamListener.FireCompressedBytesRead(long currentPartCompressedBytes, long compressedReadBytes)
|
||||
{
|
||||
if (CompressedBytesRead != null)
|
||||
{
|
||||
CompressedBytesRead(this, new CompressedBytesReadEventArgs()
|
||||
{
|
||||
CurrentFilePartCompressedBytesRead = currentPartCompressedBytes,
|
||||
CompressedBytesRead = compressedReadBytes
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void IStreamListener.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()
|
||||
{
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
147
src/SharpCompress/Archives/AbstractWritableArchive.cs
Normal file
147
src/SharpCompress/Archives/AbstractWritableArchive.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
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,168 +1,157 @@
|
||||
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 (RarArchive.IsRarFile(stream, Options.LookForHeader | Options.KeepStreamsOpen))
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return RarArchive.Open(stream, options);
|
||||
}
|
||||
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);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type. Supported Archive Formats: Zip, GZip, Tar, Rar, 7Zip");
|
||||
}
|
||||
|
||||
public static IArchive Create(ArchiveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ArchiveType.Zip:
|
||||
{
|
||||
return ZipArchive.Create();
|
||||
}
|
||||
case ArchiveType.Tar:
|
||||
{
|
||||
return TarArchive.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 (RarArchive.IsRarFile(stream, Options.LookForHeader | Options.KeepStreamsOpen))
|
||||
{
|
||||
stream.Dispose();
|
||||
return RarArchive.Open(fileInfo, options);
|
||||
}
|
||||
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);
|
||||
}
|
||||
throw new InvalidOperationException("Cannot determine compressed stream type.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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.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");
|
||||
}
|
||||
|
||||
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,213 +1,192 @@
|
||||
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);
|
||||
}
|
||||
|
||||
#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.AsEnumerable(), options)
|
||||
{
|
||||
}
|
||||
|
||||
internal GZipArchive()
|
||||
: base(ArchiveType.GZip)
|
||||
{
|
||||
}
|
||||
|
||||
public void SaveTo(Stream stream)
|
||||
{
|
||||
this.SaveTo(stream, CompressionType.GZip);
|
||||
}
|
||||
|
||||
protected override GZipArchiveEntry CreateEntry(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.FilePath, 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];
|
||||
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, 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))
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
protected override IReader CreateReaderForSolidExtraction()
|
||||
{
|
||||
var stream = Volumes.Single().Stream;
|
||||
stream.Position = 0;
|
||||
return GZipReader.Open(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
28
src/SharpCompress/Archives/GZip/GZipArchiveEntry.cs
Normal file
28
src/SharpCompress/Archives/GZip/GZipArchiveEntry.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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()
|
||||
{
|
||||
return Parts.Single().GetCompressedStream();
|
||||
}
|
||||
|
||||
#region IArchiveEntry Members
|
||||
|
||||
public IArchive Archive { get; }
|
||||
|
||||
public bool IsComplete { get { return 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 { get { return 0; } }
|
||||
|
||||
public override string Key { get; }
|
||||
|
||||
public override long CompressedSize { get { return 0; } }
|
||||
|
||||
public override long Size { get; }
|
||||
|
||||
public override DateTime? LastModifiedTime { get; }
|
||||
|
||||
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,41 +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; }
|
||||
long TotalSize { 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>
|
||||
/// <returns></returns>
|
||||
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; }
|
||||
}
|
||||
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,21 +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();
|
||||
|
||||
void WriteTo(Stream stream);
|
||||
|
||||
/// <summary>
|
||||
/// The archive can find all the parts of the archive needed to extract this entry.
|
||||
/// </summary>
|
||||
bool IsComplete { 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; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user