annotate Zip/ZipEntry.cs @ 3:686f96c8b694

Open with VS2k8 and force .Net 2.0 compatibility no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 30 Oct 2010 14:26:04 +0000
parents 94e25b786321
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // ZipEntry.cs
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // Copyright (C) 2001 Mike Krueger
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 // Copyright (C) 2004 John Reilly
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 // This file was translated from java, it was part of the GNU Classpath
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 // Copyright (C) 2001 Free Software Foundation, Inc.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 // This program is free software; you can redistribute it and/or
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 // modify it under the terms of the GNU General Public License
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 // as published by the Free Software Foundation; either version 2
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 // of the License, or (at your option) any later version.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 // This program is distributed in the hope that it will be useful,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 // GNU General Public License for more details.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 // You should have received a copy of the GNU General Public License
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 // along with this program; if not, write to the Free Software
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 // Linking this library statically or dynamically with other modules is
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 // making a combined work based on this library. Thus, the terms and
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 // conditions of the GNU General Public License cover the whole
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 // combination.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 // As a special exception, the copyright holders of this library give you
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 // permission to link this library with independent modules to produce an
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 // executable, regardless of the license terms of these independent
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 // modules, and to copy and distribute the resulting executable under
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 // terms of your choice, provided that you also meet, for each linked
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 // independent module, the terms and conditions of the license of that
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 // module. An independent module is a module which is not derived from
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 // or based on this library. If you modify this library, you may extend
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 // this exception to your version of the library, but you are not
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 // obligated to do so. If you do not wish to do so, delete this
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 // exception statement from your version.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 // HISTORY
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 // 22-12-2009 DavidPierson Added AES support
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 // 02-02-2010 DavidPierson Changed NTFS Extra Data min length to 4
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 using System;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 using System.IO;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 namespace ICSharpCode.SharpZipLib.Zip
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 /// Defines known values for the <see cref="HostSystemID"/> property.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 public enum HostSystemID
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 /// Host system = MSDOS
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 Msdos = 0,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60 /// Host system = Amiga
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 Amiga = 1,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 /// Host system = Open VMS
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 OpenVms = 2,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 /// Host system = Unix
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 Unix = 3,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 /// Host system = VMCms
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 VMCms = 4,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 /// Host system = Atari ST
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78 AtariST = 5,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80 /// Host system = OS2
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 OS2 = 6,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 /// Host system = Macintosh
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 Macintosh = 7,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88 /// Host system = ZSystem
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 ZSystem = 8,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92 /// Host system = Cpm
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94 Cpm = 9,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 /// Host system = Windows NT
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98 WindowsNT = 10,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100 /// Host system = MVS
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 MVS = 11,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104 /// Host system = VSE
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106 Vse = 12,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108 /// Host system = Acorn RISC
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110 AcornRisc = 13,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112 /// Host system = VFAT
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 Vfat = 14,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116 /// Host system = Alternate MVS
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 AlternateMvs = 15,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
120 /// Host system = BEOS
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122 BeOS = 16,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 /// Host system = Tandem
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126 Tandem = 17,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 /// Host system = OS400
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 OS400 = 18,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
132 /// Host system = OSX
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
133 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 OSX = 19,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
135 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 /// Host system = WinZIP AES
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138 WinZipAES = 99,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142 /// This class represents an entry in a zip archive. This can be a file
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 /// or a directory
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144 /// ZipFile and ZipInputStream will give you instances of this class as
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
145 /// information about the members in an archive. ZipOutputStream
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
146 /// uses an instance of this class when creating an entry in a Zip file.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
147 /// <br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
148 /// <br/>Author of the original java version : Jochen Hoenicke
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
149 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
150 public class ZipEntry : ICloneable
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
151 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
152 [Flags]
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 enum Known : byte
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
154 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
155 None = 0,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
156 Size = 0x01,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
157 CompressedSize = 0x02,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
158 Crc = 0x04,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
159 Time = 0x08,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
160 ExternalAttributes = 0x10,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
161 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
162
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
163 #region Constructors
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
164 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
165 /// Creates a zip entry with the given name.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
166 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
167 /// <param name="name">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
168 /// The name for this entry. Can include directory components.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
169 /// The convention for names is 'unix' style paths with relative names only.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
170 /// There are with no device names and path elements are separated by '/' characters.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
171 /// </param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
172 /// <exception cref="ArgumentNullException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
173 /// The name passed is null
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
174 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
175 public ZipEntry(string name)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
176 : this(name, 0, ZipConstants.VersionMadeBy, CompressionMethod.Deflated)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
177 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
181 /// Creates a zip entry with the given name and version required to extract
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
182 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
183 /// <param name="name">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
184 /// The name for this entry. Can include directory components.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
185 /// The convention for names is 'unix' style paths with no device names and
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
186 /// path elements separated by '/' characters. This is not enforced see <see cref="CleanName(string)">CleanName</see>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
187 /// on how to ensure names are valid if this is desired.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
188 /// </param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
189 /// <param name="versionRequiredToExtract">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
190 /// The minimum 'feature version' required this entry
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
191 /// </param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
192 /// <exception cref="ArgumentNullException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
193 /// The name passed is null
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
194 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
195 internal ZipEntry(string name, int versionRequiredToExtract)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
196 : this(name, versionRequiredToExtract, ZipConstants.VersionMadeBy,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
197 CompressionMethod.Deflated)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
198 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
199 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
200
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
201 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
202 /// Initializes an entry with the given name and made by information
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
203 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
204 /// <param name="name">Name for this entry</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
205 /// <param name="madeByInfo">Version and HostSystem Information</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
206 /// <param name="versionRequiredToExtract">Minimum required zip feature version required to extract this entry</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
207 /// <param name="method">Compression method for this entry.</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
208 /// <exception cref="ArgumentNullException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
209 /// The name passed is null
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
210 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
211 /// <exception cref="ArgumentOutOfRangeException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
212 /// versionRequiredToExtract should be 0 (auto-calculate) or > 10
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
213 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
214 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
215 /// This constructor is used by the ZipFile class when reading from the central header
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
216 /// It is not generally useful, use the constructor specifying the name only.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
217 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
218 internal ZipEntry(string name, int versionRequiredToExtract, int madeByInfo,
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
219 CompressionMethod method)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
220 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
221 if (name == null) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
222 throw new System.ArgumentNullException("name");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
223 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
224
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
225 if ( name.Length > 0xffff ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
226 throw new ArgumentException("Name is too long", "name");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
227 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
228
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
229 if ( (versionRequiredToExtract != 0) && (versionRequiredToExtract < 10) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
230 throw new ArgumentOutOfRangeException("versionRequiredToExtract");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
231 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
232
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
233 this.DateTime = System.DateTime.Now;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
234 this.name = name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
235 this.versionMadeBy = (ushort)madeByInfo;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
236 this.versionToExtract = (ushort)versionRequiredToExtract;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
237 this.method = method;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
238 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
239
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
240 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
241 /// Creates a deep copy of the given zip entry.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
242 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
243 /// <param name="entry">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
244 /// The entry to copy.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
245 /// </param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
246 [Obsolete("Use Clone instead")]
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
247 public ZipEntry(ZipEntry entry)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
248 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
249 if ( entry == null ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
250 throw new ArgumentNullException("entry");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
251 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
252
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
253 known = entry.known;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
254 name = entry.name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
255 size = entry.size;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
256 compressedSize = entry.compressedSize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
257 crc = entry.crc;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
258 dosTime = entry.dosTime;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
259 method = entry.method;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
260 comment = entry.comment;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
261 versionToExtract = entry.versionToExtract;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
262 versionMadeBy = entry.versionMadeBy;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
263 externalFileAttributes = entry.externalFileAttributes;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
264 flags = entry.flags;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
265
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
266 zipFileIndex = entry.zipFileIndex;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
267 offset = entry.offset;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
268
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
269 forceZip64_ = entry.forceZip64_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
270
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
271 if ( entry.extra != null ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
272 extra = new byte[entry.extra.Length];
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
273 Array.Copy(entry.extra, 0, extra, 0, entry.extra.Length);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
274 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
275 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
276
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
277 #endregion
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
278
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
279 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
280 /// Get a value indicating wether the entry has a CRC value available.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
281 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
282 public bool HasCrc
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
283 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
284 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
285 return (known & Known.Crc) != 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
286 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
287 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
288
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
289 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
290 /// Get/Set flag indicating if entry is encrypted.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
291 /// A simple helper routine to aid interpretation of <see cref="Flags">flags</see>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
292 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
293 /// <remarks>This is an assistant that interprets the <see cref="Flags">flags</see> property.</remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
294 public bool IsCrypted
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
295 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
296 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
297 return (flags & 1) != 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
298 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
299 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
300 if (value) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
301 flags |= 1;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
302 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
303 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
304 flags &= ~1;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
305 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
306 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
307 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
308
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
309 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
310 /// Get / set a flag indicating wether entry name and comment text are
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
311 /// encoded in <a href="http://www.unicode.org">unicode UTF8</a>.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
312 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
313 /// <remarks>This is an assistant that interprets the <see cref="Flags">flags</see> property.</remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
314 public bool IsUnicodeText
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
315 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
316 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
317 return ( flags & (int)GeneralBitFlags.UnicodeText ) != 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
318 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
319 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
320 if ( value ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
321 flags |= (int)GeneralBitFlags.UnicodeText;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
322 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
323 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
324 flags &= ~(int)GeneralBitFlags.UnicodeText;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
325 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
326 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
327 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
328
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
329 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
330 /// Value used during password checking for PKZIP 2.0 / 'classic' encryption.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
331 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
332 internal byte CryptoCheckValue
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
333 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
334 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
335 return cryptoCheckValue_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
336 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
337
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
338 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
339 cryptoCheckValue_ = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
340 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
341 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
342
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
343 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
344 /// Get/Set general purpose bit flag for entry
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
345 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
346 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
347 /// General purpose bit flag<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
348 /// <br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
349 /// Bit 0: If set, indicates the file is encrypted<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
350 /// Bit 1-2 Only used for compression type 6 Imploding, and 8, 9 deflating<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
351 /// Imploding:<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
352 /// Bit 1 if set indicates an 8K sliding dictionary was used. If clear a 4k dictionary was used<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
353 /// Bit 2 if set indicates 3 Shannon-Fanno trees were used to encode the sliding dictionary, 2 otherwise<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
354 /// <br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
355 /// Deflating:<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
356 /// Bit 2 Bit 1<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
357 /// 0 0 Normal compression was used<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
358 /// 0 1 Maximum compression was used<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
359 /// 1 0 Fast compression was used<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
360 /// 1 1 Super fast compression was used<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
361 /// <br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
362 /// Bit 3: If set, the fields crc-32, compressed size
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
363 /// and uncompressed size are were not able to be written during zip file creation
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
364 /// The correct values are held in a data descriptor immediately following the compressed data. <br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
365 /// Bit 4: Reserved for use by PKZIP for enhanced deflating<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
366 /// Bit 5: If set indicates the file contains compressed patch data<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
367 /// Bit 6: If set indicates strong encryption was used.<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
368 /// Bit 7-10: Unused or reserved<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
369 /// Bit 11: If set the name and comments for this entry are in <a href="http://www.unicode.org">unicode</a>.<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
370 /// Bit 12-15: Unused or reserved<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
371 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
372 /// <seealso cref="IsUnicodeText"></seealso>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
373 /// <seealso cref="IsCrypted"></seealso>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
374 public int Flags
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
375 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
376 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
377 return flags;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
378 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
379 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
380 flags = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
381 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
382 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
383
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
384 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
385 /// Get/Set index of this entry in Zip file
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
386 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
387 /// <remarks>This is only valid when the entry is part of a <see cref="ZipFile"></see></remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
388 public long ZipFileIndex
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
389 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
390 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
391 return zipFileIndex;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
392 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
393 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
394 zipFileIndex = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
395 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
396 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
397
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
398 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
399 /// Get/set offset for use in central header
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
400 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
401 public long Offset
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
402 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
403 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
404 return offset;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
405 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
406 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
407 offset = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
408 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
409 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
410
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
411 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
412 /// Get/Set external file attributes as an integer.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
413 /// The values of this are operating system dependant see
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
414 /// <see cref="HostSystem">HostSystem</see> for details
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
415 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
416 public int ExternalFileAttributes
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
417 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
418 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
419 if ((known & Known.ExternalAttributes) == 0) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
420 return -1;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
421 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
422 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
423 return externalFileAttributes;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
424 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
425 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
426
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
427 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
428 externalFileAttributes = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
429 known |= Known.ExternalAttributes;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
430 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
431 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
432
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
433 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
434 /// Get the version made by for this entry or zero if unknown.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
435 /// The value / 10 indicates the major version number, and
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
436 /// the value mod 10 is the minor version number
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
437 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
438 public int VersionMadeBy
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
439 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
440 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
441 return (versionMadeBy & 0xff);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
442 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
443 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
444
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
445 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
446 /// Get a value indicating this entry is for a DOS/Windows system.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
447 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
448 public bool IsDOSEntry
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
449 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
450 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
451 return ((HostSystem == ( int )HostSystemID.Msdos) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
452 (HostSystem == ( int )HostSystemID.WindowsNT));
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
453 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
454 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
455
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
456 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
457 /// Test the external attributes for this <see cref="ZipEntry"/> to
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
458 /// see if the external attributes are Dos based (including WINNT and variants)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
459 /// and match the values
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
460 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
461 /// <param name="attributes">The attributes to test.</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
462 /// <returns>Returns true if the external attributes are known to be DOS/Windows
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
463 /// based and have the same attributes set as the value passed.</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
464 bool HasDosAttributes(int attributes)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
465 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
466 bool result = false;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
467 if ( (known & Known.ExternalAttributes) != 0 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
468 if ( ((HostSystem == (int)HostSystemID.Msdos) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
469 (HostSystem == (int)HostSystemID.WindowsNT)) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
470 (ExternalFileAttributes & attributes) == attributes) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
471 result = true;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
472 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
473 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
474 return result;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
475 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
476
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
477 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
478 /// Gets the compatability information for the <see cref="ExternalFileAttributes">external file attribute</see>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
479 /// If the external file attributes are compatible with MS-DOS and can be read
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
480 /// by PKZIP for DOS version 2.04g then this value will be zero. Otherwise the value
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
481 /// will be non-zero and identify the host system on which the attributes are compatible.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
482 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
483 ///
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
484 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
485 /// The values for this as defined in the Zip File format and by others are shown below. The values are somewhat
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
486 /// misleading in some cases as they are not all used as shown. You should consult the relevant documentation
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
487 /// to obtain up to date and correct information. The modified appnote by the infozip group is
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
488 /// particularly helpful as it documents a lot of peculiarities. The document is however a little dated.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
489 /// <list type="table">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
490 /// <item>0 - MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems)</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
491 /// <item>1 - Amiga</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
492 /// <item>2 - OpenVMS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
493 /// <item>3 - Unix</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
494 /// <item>4 - VM/CMS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
495 /// <item>5 - Atari ST</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
496 /// <item>6 - OS/2 HPFS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
497 /// <item>7 - Macintosh</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
498 /// <item>8 - Z-System</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
499 /// <item>9 - CP/M</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
500 /// <item>10 - Windows NTFS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
501 /// <item>11 - MVS (OS/390 - Z/OS)</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
502 /// <item>12 - VSE</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
503 /// <item>13 - Acorn Risc</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
504 /// <item>14 - VFAT</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
505 /// <item>15 - Alternate MVS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
506 /// <item>16 - BeOS</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
507 /// <item>17 - Tandem</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
508 /// <item>18 - OS/400</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
509 /// <item>19 - OS/X (Darwin)</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
510 /// <item>99 - WinZip AES</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
511 /// <item>remainder - unused</item>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
512 /// </list>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
513 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
514 public int HostSystem
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
515 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
516 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
517 return (versionMadeBy >> 8) & 0xff;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
518 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
519
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
520 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
521 versionMadeBy &= 0xff;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
522 versionMadeBy |= (ushort)((value & 0xff) << 8);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
523 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
524 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
525
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
526 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
527 /// Get minimum Zip feature version required to extract this entry
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
528 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
529 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
530 /// Minimum features are defined as:<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
531 /// 1.0 - Default value<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
532 /// 1.1 - File is a volume label<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
533 /// 2.0 - File is a folder/directory<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
534 /// 2.0 - File is compressed using Deflate compression<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
535 /// 2.0 - File is encrypted using traditional encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
536 /// 2.1 - File is compressed using Deflate64<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
537 /// 2.5 - File is compressed using PKWARE DCL Implode<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
538 /// 2.7 - File is a patch data set<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
539 /// 4.5 - File uses Zip64 format extensions<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
540 /// 4.6 - File is compressed using BZIP2 compression<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
541 /// 5.0 - File is encrypted using DES<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
542 /// 5.0 - File is encrypted using 3DES<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
543 /// 5.0 - File is encrypted using original RC2 encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
544 /// 5.0 - File is encrypted using RC4 encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
545 /// 5.1 - File is encrypted using AES encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
546 /// 5.1 - File is encrypted using corrected RC2 encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
547 /// 5.1 - File is encrypted using corrected RC2-64 encryption<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
548 /// 6.1 - File is encrypted using non-OAEP key wrapping<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
549 /// 6.2 - Central directory encryption (not confirmed yet)<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
550 /// 6.3 - File is compressed using LZMA<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
551 /// 6.3 - File is compressed using PPMD+<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
552 /// 6.3 - File is encrypted using Blowfish<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
553 /// 6.3 - File is encrypted using Twofish<br/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
554 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
555 /// <seealso cref="CanDecompress"></seealso>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
556 public int Version
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
557 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
558 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
559 // Return recorded version if known.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
560 if (versionToExtract != 0) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
561 return versionToExtract;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
562 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
563 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
564 int result = 10;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
565 if (AESKeySize > 0) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
566 result = ZipConstants.VERSION_AES; // Ver 5.1 = AES
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
567 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
568 else if (CentralHeaderRequiresZip64) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
569 result = ZipConstants.VersionZip64;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
570 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
571 else if (CompressionMethod.Deflated == method) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
572 result = 20;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
573 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
574 else if (IsDirectory == true) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
575 result = 20;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
576 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
577 else if (IsCrypted == true) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
578 result = 20;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
579 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
580 else if (HasDosAttributes(0x08) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
581 result = 11;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
582 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
583 return result;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
584 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
585 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
586 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
587
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
588 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
589 /// Get a value indicating whether this entry can be decompressed by the library.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
590 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
591 /// <remarks>This is based on the <see cref="Version"></see> and
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
592 /// wether the <see cref="IsCompressionMethodSupported()">compression method</see> is supported.</remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
593 public bool CanDecompress
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
594 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
595 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
596 return (Version <= ZipConstants.VersionMadeBy) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
597 ((Version == 10) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
598 (Version == 11) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
599 (Version == 20) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
600 (Version == 45) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
601 (Version == 51)) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
602 IsCompressionMethodSupported();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
603 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
604 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
605
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
606 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
607 /// Force this entry to be recorded using Zip64 extensions.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
608 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
609 public void ForceZip64()
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
610 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
611 forceZip64_ = true;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
612 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
613
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
614 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
615 /// Get a value indicating wether Zip64 extensions were forced.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
616 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
617 /// <returns>A <see cref="bool"/> value of true if Zip64 extensions have been forced on; false if not.</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
618 public bool IsZip64Forced()
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
619 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
620 return forceZip64_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
621 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
622
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
623 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
624 /// Gets a value indicating if the entry requires Zip64 extensions
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
625 /// to store the full entry values.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
626 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
627 /// <value>A <see cref="bool"/> value of true if a local header requires Zip64 extensions; false if not.</value>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
628 public bool LocalHeaderRequiresZip64
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
629 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
630 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
631 bool result = forceZip64_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
632
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
633 if ( !result ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
634 ulong trueCompressedSize = compressedSize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
635
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
636 if ( (versionToExtract == 0) && IsCrypted ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
637 trueCompressedSize += ZipConstants.CryptoHeaderSize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
638 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
639
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
640 // TODO: A better estimation of the true limit based on compression overhead should be used
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
641 // to determine when an entry should use Zip64.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
642 result =
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
643 ((this.size >= uint.MaxValue) || (trueCompressedSize >= uint.MaxValue)) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
644 ((versionToExtract == 0) || (versionToExtract >= ZipConstants.VersionZip64));
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
645 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
646
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
647 return result;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
648 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
649 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
650
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
651 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
652 /// Get a value indicating wether the central directory entry requires Zip64 extensions to be stored.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
653 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
654 public bool CentralHeaderRequiresZip64
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
655 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
656 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
657 return LocalHeaderRequiresZip64 || (offset >= uint.MaxValue);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
658 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
659 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
660
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
661 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
662 /// Get/Set DosTime value.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
663 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
664 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
665 /// The MS-DOS date format can only represent dates between 1/1/1980 and 12/31/2107.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
666 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
667 public long DosTime
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
668 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
669 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
670 if ((known & Known.Time) == 0) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
671 return 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
672 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
673 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
674 return dosTime;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
675 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
676 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
677
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
678 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
679 unchecked {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
680 dosTime = (uint)value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
681 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
682
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
683 known |= Known.Time;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
684 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
685 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
686
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
687 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
688 /// Gets/Sets the time of last modification of the entry.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
689 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
690 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
691 /// The <see cref="DosTime"></see> property is updated to match this as far as possible.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
692 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
693 public DateTime DateTime
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
694 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
695 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
696 uint sec = Math.Min(59, 2 * (dosTime & 0x1f));
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
697 uint min = Math.Min(59, (dosTime >> 5) & 0x3f);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
698 uint hrs = Math.Min(23, (dosTime >> 11) & 0x1f);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
699 uint mon = Math.Max(1, Math.Min(12, ((dosTime >> 21) & 0xf)));
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
700 uint year = ((dosTime >> 25) & 0x7f) + 1980;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
701 int day = Math.Max(1, Math.Min(DateTime.DaysInMonth((int)year, (int)mon), (int)((dosTime >> 16) & 0x1f)));
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
702 return new System.DateTime((int)year, (int)mon, day, (int)hrs, (int)min, (int)sec);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
703 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
704
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
705 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
706 uint year = (uint) value.Year;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
707 uint month = (uint) value.Month;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
708 uint day = (uint) value.Day;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
709 uint hour = (uint) value.Hour;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
710 uint minute = (uint) value.Minute;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
711 uint second = (uint) value.Second;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
712
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
713 if ( year < 1980 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
714 year = 1980;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
715 month = 1;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
716 day = 1;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
717 hour = 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
718 minute = 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
719 second = 0;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
720 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
721 else if ( year > 2107 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
722 year = 2107;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
723 month = 12;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
724 day = 31;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
725 hour = 23;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
726 minute = 59;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
727 second = 59;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
728 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
729
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
730 DosTime = ((year - 1980) & 0x7f) << 25 |
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
731 (month << 21) |
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
732 (day << 16) |
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
733 (hour << 11) |
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
734 (minute << 5) |
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
735 (second >> 1);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
736 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
737 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
738
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
739 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
740 /// Returns the entry name.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
741 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
742 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
743 /// The unix naming convention is followed.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
744 /// Path components in the entry should always separated by forward slashes ('/').
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
745 /// Dos device names like C: should also be removed.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
746 /// See the <see cref="ZipNameTransform"/> class, or <see cref="CleanName(string)"/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
747 ///</remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
748 public string Name
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
749 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
750 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
751 return name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
752 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
753 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
754
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
755 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
756 /// Gets/Sets the size of the uncompressed data.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
757 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
758 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
759 /// The size or -1 if unknown.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
760 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
761 /// <remarks>Setting the size before adding an entry to an archive can help
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
762 /// avoid compatability problems with some archivers which dont understand Zip64 extensions.</remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
763 public long Size
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
764 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
765 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
766 return (known & Known.Size) != 0 ? (long)size : -1L;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
767 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
768 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
769 this.size = (ulong)value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
770 this.known |= Known.Size;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
771 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
772 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
773
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
774 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
775 /// Gets/Sets the size of the compressed data.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
776 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
777 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
778 /// The compressed entry size or -1 if unknown.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
779 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
780 public long CompressedSize
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
781 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
782 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
783 return (known & Known.CompressedSize) != 0 ? (long)compressedSize : -1L;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
784 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
785 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
786 this.compressedSize = (ulong)value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
787 this.known |= Known.CompressedSize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
788 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
789 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
790
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
791 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
792 /// Gets/Sets the crc of the uncompressed data.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
793 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
794 /// <exception cref="System.ArgumentOutOfRangeException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
795 /// Crc is not in the range 0..0xffffffffL
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
796 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
797 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
798 /// The crc value or -1 if unknown.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
799 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
800 public long Crc
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
801 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
802 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
803 return (known & Known.Crc) != 0 ? crc & 0xffffffffL : -1L;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
804 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
805 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
806 if (((ulong)crc & 0xffffffff00000000L) != 0) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
807 throw new ArgumentOutOfRangeException("value");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
808 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
809 this.crc = (uint)value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
810 this.known |= Known.Crc;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
811 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
812 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
813
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
814 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
815 /// Gets/Sets the compression method. Only Deflated and Stored are supported.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
816 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
817 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
818 /// The compression method for this entry
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
819 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
820 /// <see cref="ICSharpCode.SharpZipLib.Zip.CompressionMethod.Deflated"/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
821 /// <see cref="ICSharpCode.SharpZipLib.Zip.CompressionMethod.Stored"/>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
822 public CompressionMethod CompressionMethod {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
823 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
824 return method;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
825 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
826
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
827 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
828 if ( !IsCompressionMethodSupported(value) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
829 throw new NotSupportedException("Compression method not supported");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
830 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
831 this.method = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
832 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
833 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
834
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
835 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
836 /// Gets the compression method for outputting to the local or central header.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
837 /// Returns same value as CompressionMethod except when AES encrypting, which
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
838 /// places 99 in the method and places the real method in the extra data.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
839 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
840 internal CompressionMethod CompressionMethodForHeader {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
841 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
842 return (AESKeySize > 0) ? CompressionMethod.WinZipAES : method;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
843 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
844 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
845
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
846 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
847 /// Gets/Sets the extra data.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
848 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
849 /// <exception cref="System.ArgumentOutOfRangeException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
850 /// Extra data is longer than 64KB (0xffff) bytes.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
851 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
852 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
853 /// Extra data or null if not set.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
854 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
855 public byte[] ExtraData {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
856
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
857 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
858 // TODO: This is slightly safer but less efficient. Think about wether it should change.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
859 // return (byte[]) extra.Clone();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
860 return extra;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
861 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
862
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
863 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
864 if (value == null) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
865 extra = null;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
866 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
867 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
868 if (value.Length > 0xffff) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
869 throw new System.ArgumentOutOfRangeException("value");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
870 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
871
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
872 extra = new byte[value.Length];
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
873 Array.Copy(value, 0, extra, 0, value.Length);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
874 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
875 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
876 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
877
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
878
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
879 #if !NET_1_1 && !NETCF_2_0
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
880 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
881 /// For AES encrypted files returns or sets the number of bits of encryption (128, 192 or 256).
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
882 /// When setting, only 0 (off), 128 or 256 is supported.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
883 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
884 public int AESKeySize {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
885 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
886 // the strength (1 or 3) is in the entry header
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
887 switch (_aesEncryptionStrength) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
888 case 0: return 0; // Not AES
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
889 case 1: return 128;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
890 case 2: return 192; // Not used by WinZip
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
891 case 3: return 256;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
892 default: throw new ZipException("Invalid AESEncryptionStrength " + _aesEncryptionStrength);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
893 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
894 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
895 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
896 switch (value) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
897 case 0: _aesEncryptionStrength = 0; break;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
898 case 128: _aesEncryptionStrength = 1; break;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
899 case 256: _aesEncryptionStrength = 3; break;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
900 default: throw new ZipException("AESKeySize must be 0, 128 or 256: " + value);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
901 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
902 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
903 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
904
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
905 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
906 /// AES Encryption strength for storage in extra data in entry header.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
907 /// 1 is 128 bit, 2 is 192 bit, 3 is 256 bit.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
908 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
909 internal byte AESEncryptionStrength {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
910 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
911 return (byte)_aesEncryptionStrength;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
912 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
913 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
914 #else
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
915 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
916 /// AES unsupported prior to .NET 2.0
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
917 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
918 internal int AESKeySize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
919 #endif
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
920
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
921 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
922 /// Returns the length of the salt, in bytes
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
923 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
924 internal int AESSaltLen {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
925 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
926 // Key size -> Salt length: 128 bits = 8 bytes, 192 bits = 12 bytes, 256 bits = 16 bytes.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
927 return AESKeySize / 16;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
928 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
929 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
930
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
931 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
932 /// Number of extra bytes required to hold the AES Header fields (Salt, Pwd verify, AuthCode)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
933 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
934 internal int AESOverheadSize {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
935 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
936 // File format:
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
937 // Bytes Content
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
938 // Variable Salt value
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
939 // 2 Password verification value
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
940 // Variable Encrypted file data
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
941 // 10 Authentication code
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
942 return 12 + AESSaltLen;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
943 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
944 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
945
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
946 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
947 /// Process extra data fields updating the entry based on the contents.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
948 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
949 /// <param name="localHeader">True if the extra data fields should be handled
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
950 /// for a local header, rather than for a central header.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
951 /// </param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
952 internal void ProcessExtraData(bool localHeader)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
953 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
954 ZipExtraData extraData = new ZipExtraData(this.extra);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
955
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
956 if ( extraData.Find(0x0001) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
957 // Version required to extract is ignored here as some archivers dont set it correctly
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
958 // in theory it should be version 45 or higher
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
959
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
960 // The recorded size will change but remember that this is zip64.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
961 forceZip64_ = true;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
962
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
963 if ( extraData.ValueLength < 4 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
964 throw new ZipException("Extra data extended Zip64 information length is invalid");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
965 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
966
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
967 if ( localHeader || (size == uint.MaxValue) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
968 size = (ulong)extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
969 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
970
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
971 if ( localHeader || (compressedSize == uint.MaxValue) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
972 compressedSize = (ulong)extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
973 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
974
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
975 if ( !localHeader && (offset == uint.MaxValue) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
976 offset = extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
977 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
978
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
979 // Disk number on which file starts is ignored
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
980 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
981 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
982 if (
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
983 ((versionToExtract & 0xff) >= ZipConstants.VersionZip64) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
984 ((size == uint.MaxValue) || (compressedSize == uint.MaxValue))
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
985 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
986 throw new ZipException("Zip64 Extended information required but is missing.");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
987 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
988 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
989
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
990 if ( extraData.Find(10) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
991 // No room for any tags.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
992 if ( extraData.ValueLength < 4 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
993 throw new ZipException("NTFS Extra data invalid");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
994 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
995
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
996 extraData.ReadInt(); // Reserved
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
997
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
998 while ( extraData.UnreadCount >= 4 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
999 int ntfsTag = extraData.ReadShort();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1000 int ntfsLength = extraData.ReadShort();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1001 if ( ntfsTag == 1 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1002 if ( ntfsLength >= 24 ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1003 long lastModification = extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1004 long lastAccess = extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1005 long createTime = extraData.ReadLong();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1006
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1007 DateTime = System.DateTime.FromFileTime(lastModification);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1008 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1009 break;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1010 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1011 else {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1012 // An unknown NTFS tag so simply skip it.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1013 extraData.Skip(ntfsLength);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1014 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1015 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1016 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1017 else if ( extraData.Find(0x5455) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1018 int length = extraData.ValueLength;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1019 int flags = extraData.ReadByte();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1020
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1021 // Can include other times but these are ignored. Length of data should
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1022 // actually be 1 + 4 * no of bits in flags.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1023 if ( ((flags & 1) != 0) && (length >= 5) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1024 int iTime = extraData.ReadInt();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1025
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1026 DateTime = (new System.DateTime ( 1970, 1, 1, 0, 0, 0 ).ToUniversalTime() +
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1027 new TimeSpan ( 0, 0, 0, iTime, 0 )).ToLocalTime();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1028 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1029 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1030 if (method == CompressionMethod.WinZipAES) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1031 ProcessAESExtraData(extraData);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1032 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1033 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1034
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1035 // For AES the method in the entry is 99, and the real compression method is in the extradata
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1036 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1037 private void ProcessAESExtraData(ZipExtraData extraData) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1038
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1039 #if !NET_1_1 && !NETCF_2_0
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1040 if (extraData.Find(0x9901)) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1041 // Set version and flag for Zipfile.CreateAndInitDecryptionStream
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1042 versionToExtract = ZipConstants.VERSION_AES; // Ver 5.1 = AES see "Version" getter
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1043 // Set StrongEncryption flag for ZipFile.CreateAndInitDecryptionStream
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1044 Flags = Flags | (int)GeneralBitFlags.StrongEncryption;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1045 //
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1046 // Unpack AES extra data field see http://www.winzip.com/aes_info.htm
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1047 int length = extraData.ValueLength; // Data size currently 7
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1048 if (length < 7)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1049 throw new ZipException("AES Extra Data Length " + length + " invalid.");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1050 int ver = extraData.ReadShort(); // Version number (1=AE-1 2=AE-2)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1051 int vendorId = extraData.ReadShort(); // 2-character vendor ID 0x4541 = "AE"
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1052 int encrStrength = extraData.ReadByte(); // encryption strength 1 = 128 2 = 192 3 = 256
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1053 int actualCompress = extraData.ReadShort(); // The actual compression method used to compress the file
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1054 _aesVer = ver;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1055 _aesEncryptionStrength = encrStrength;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1056 method = (CompressionMethod)actualCompress;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1057 } else
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1058 throw new ZipException("AES Extra Data missing");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1059 #else
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1060 throw new ZipException("AES unsupported");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1061 #endif
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1062 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1063
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1064 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1065 /// Gets/Sets the entry comment.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1066 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1067 /// <exception cref="System.ArgumentOutOfRangeException">
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1068 /// If comment is longer than 0xffff.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1069 /// </exception>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1070 /// <returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1071 /// The comment or null if not set.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1072 /// </returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1073 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1074 /// A comment is only available for entries when read via the <see cref="ZipFile"/> class.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1075 /// The <see cref="ZipInputStream"/> class doesnt have the comment data available.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1076 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1077 public string Comment {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1078 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1079 return comment;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1080 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1081 set {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1082 // This test is strictly incorrect as the length is in characters
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1083 // while the storage limit is in bytes.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1084 // While the test is partially correct in that a comment of this length or greater
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1085 // is definitely invalid, shorter comments may also have an invalid length
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1086 // where there are multi-byte characters
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1087 // The full test is not possible here however as the code page to apply conversions with
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1088 // isnt available.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1089 if ( (value != null) && (value.Length > 0xffff) ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1090 #if NETCF_1_0
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1091 throw new ArgumentOutOfRangeException("value");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1092 #else
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1093 throw new ArgumentOutOfRangeException("value", "cannot exceed 65535");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1094 #endif
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1095 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1096
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1097 comment = value;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1098 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1099 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1100
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1101 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1102 /// Gets a value indicating if the entry is a directory.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1103 /// however.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1104 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1105 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1106 /// A directory is determined by an entry name with a trailing slash '/'.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1107 /// The external file attributes can also indicate an entry is for a directory.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1108 /// Currently only dos/windows attributes are tested in this manner.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1109 /// The trailing slash convention should always be followed.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1110 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1111 public bool IsDirectory
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1112 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1113 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1114 int nameLength = name.Length;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1115 bool result =
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1116 ((nameLength > 0) &&
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1117 ((name[nameLength - 1] == '/') || (name[nameLength - 1] == '\\'))) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1118 HasDosAttributes(16)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1119 ;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1120 return result;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1121 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1122 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1123
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1124 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1125 /// Get a value of true if the entry appears to be a file; false otherwise
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1126 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1127 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1128 /// This only takes account of DOS/Windows attributes. Other operating systems are ignored.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1129 /// For linux and others the result may be incorrect.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1130 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1131 public bool IsFile
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1132 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1133 get {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1134 return !IsDirectory && !HasDosAttributes(8);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1135 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1136 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1137
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1138 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1139 /// Test entry to see if data can be extracted.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1140 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1141 /// <returns>Returns true if data can be extracted for this entry; false otherwise.</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1142 public bool IsCompressionMethodSupported()
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1143 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1144 return IsCompressionMethodSupported(CompressionMethod);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1145 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1146
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1147 #region ICloneable Members
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1148 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1149 /// Creates a copy of this zip entry.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1150 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1151 /// <returns>An <see cref="Object"/> that is a copy of the current instance.</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1152 public object Clone()
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1153 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1154 ZipEntry result = (ZipEntry)this.MemberwiseClone();
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1155
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1156 // Ensure extra data is unique if it exists.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1157 if ( extra != null ) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1158 result.extra = new byte[extra.Length];
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1159 Array.Copy(extra, 0, result.extra, 0, extra.Length);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1160 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1161
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1162 return result;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1163 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1164
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1165 #endregion
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1166
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1167 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1168 /// Gets a string representation of this ZipEntry.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1169 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1170 /// <returns>A readable textual representation of this <see cref="ZipEntry"/></returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1171 public override string ToString()
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1172 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1173 return name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1174 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1175
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1176 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1177 /// Test a <see cref="CompressionMethod">compression method</see> to see if this library
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1178 /// supports extracting data compressed with that method
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1179 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1180 /// <param name="method">The compression method to test.</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1181 /// <returns>Returns true if the compression method is supported; false otherwise</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1182 public static bool IsCompressionMethodSupported(CompressionMethod method)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1183 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1184 return
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1185 ( method == CompressionMethod.Deflated ) ||
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1186 ( method == CompressionMethod.Stored );
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1187 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1188
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1189 /// <summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1190 /// Cleans a name making it conform to Zip file conventions.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1191 /// Devices names ('c:\') and UNC share names ('\\server\share') are removed
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1192 /// and forward slashes ('\') are converted to back slashes ('/').
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1193 /// Names are made relative by trimming leading slashes which is compatible
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1194 /// with the ZIP naming convention.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1195 /// </summary>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1196 /// <param name="name">The name to clean</param>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1197 /// <returns>The 'cleaned' name.</returns>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1198 /// <remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1199 /// The <seealso cref="ZipNameTransform">Zip name transform</seealso> class is more flexible.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1200 /// </remarks>
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1201 public static string CleanName(string name)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1202 {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1203 if (name == null) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1204 return string.Empty;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1205 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1206
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1207 if (Path.IsPathRooted(name) == true) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1208 // NOTE:
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1209 // for UNC names... \\machine\share\zoom\beet.txt gives \zoom\beet.txt
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1210 name = name.Substring(Path.GetPathRoot(name).Length);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1211 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1212
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1213 name = name.Replace(@"\", "/");
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1214
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1215 while ( (name.Length > 0) && (name[0] == '/')) {
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1216 name = name.Remove(0, 1);
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1217 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1218 return name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1219 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1220
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1221 #region Instance Fields
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1222 Known known;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1223 int externalFileAttributes = -1; // contains external attributes (O/S dependant)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1224
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1225 ushort versionMadeBy; // Contains host system and version information
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1226 // only relevant for central header entries
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1227
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1228 string name;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1229 ulong size;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1230 ulong compressedSize;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1231 ushort versionToExtract; // Version required to extract (library handles <= 2.0)
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1232 uint crc;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1233 uint dosTime;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1234
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1235 CompressionMethod method = CompressionMethod.Deflated;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1236 byte[] extra;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1237 string comment;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1238
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1239 int flags; // general purpose bit flags
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1240
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1241 long zipFileIndex = -1; // used by ZipFile
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1242 long offset; // used by ZipFile and ZipOutputStream
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1243
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1244 bool forceZip64_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1245 byte cryptoCheckValue_;
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1246 #if !NET_1_1 && !NETCF_2_0
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1247 int _aesVer; // Version number (2 = AE-2 ?). Assigned but not used.
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1248 int _aesEncryptionStrength; // Encryption strength 1 = 128 2 = 192 3 = 256
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1249 #endif
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1250 #endregion
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1251 }
94e25b786321 Re #311: can't read ZIP file packed by Linux app Archive Manager/File Roller
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1252 }