Mercurial > repos > SharpZipLib
annotate Zip/FastZip.cs @ 4:7516b6315819
* Fix tooling version - we're 2.0 compatible, not 3.5
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 26 Jan 2011 20:04:48 +0000 |
parents | 94e25b786321 |
children |
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 // FastZip.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 2005 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
|
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
|
5 // 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
|
6 // 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
|
7 // 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
|
8 // 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
|
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
|
10 // 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
|
11 // 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
|
12 // 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
|
13 // 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
|
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
|
15 // 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
|
16 // 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
|
17 // 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
|
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 // 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
|
20 // 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
|
21 // 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
|
22 // 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
|
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
|
24 // 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
|
25 // 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
|
26 // 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
|
27 // 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
|
28 // 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
|
29 // 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
|
30 // 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
|
31 // 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
|
32 // 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
|
33 // 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
|
34 // 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
|
35 |
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 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
|
37 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
|
38 using ICSharpCode.SharpZipLib.Core; |
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 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
|
41 { |
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 /// <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
|
43 /// FastZipEvents supports all events applicable to <see cref="FastZip">FastZip</see> operations. |
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 /// </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
|
45 public class FastZipEvents |
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 /// <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
|
48 /// Delegate to invoke when processing directories. |
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 /// </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
|
50 public ProcessDirectoryHandler ProcessDirectory; |
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 |
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 /// Delegate to invoke when processing files. |
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 /// </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
|
55 public ProcessFileHandler ProcessFile; |
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 |
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 /// Delegate to invoke during processing of files. |
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 public ProgressHandler Progress; |
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 |
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 /// <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
|
63 /// Delegate to invoke when processing for a file has been completed. |
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 /// </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
|
65 public CompletedFileHandler CompletedFile; |
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 |
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 /// Delegate to invoke when processing directory failures. |
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 public DirectoryFailureHandler DirectoryFailure; |
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 |
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 /// <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
|
73 /// Delegate to invoke when processing file failures. |
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 /// </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
|
75 public FileFailureHandler FileFailure; |
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 |
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 /// Raise the <see cref="DirectoryFailure">directory failure</see> event. |
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 /// <param name="directory">The directory causing the failure.</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
|
81 /// <param name="e">The exception for this event.</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
|
82 /// <returns>A boolean indicating if execution should continue or 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
|
83 public bool OnDirectoryFailure(string directory, Exception e) |
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 { |
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 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
|
86 DirectoryFailureHandler handler = DirectoryFailure; |
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 |
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 if ( handler != 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
|
89 ScanFailureEventArgs args = new ScanFailureEventArgs(directory, e); |
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 handler(this, args); |
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 result = args.ContinueRunning; |
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 } |
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 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
|
94 } |
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 |
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 /// <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
|
97 /// Fires the <see cref="FileFailure"> file failure handler delegate</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
|
98 /// </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
|
99 /// <param name="file">The file causing the failure.</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
|
100 /// <param name="e">The exception for this failure.</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
|
101 /// <returns>A boolean indicating if execution should continue or 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
|
102 public bool OnFileFailure(string file, Exception e) |
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 { |
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 FileFailureHandler handler = FileFailure; |
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 bool result = (handler != 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
|
106 |
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 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
|
108 ScanFailureEventArgs args = new ScanFailureEventArgs(file, e); |
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 handler(this, args); |
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 result = args.ContinueRunning; |
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 } |
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 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
|
113 } |
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 |
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 /// Fires the <see cref="ProcessFile">ProcessFile delegate</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
|
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 /// <param name="file">The file being processed.</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
|
119 /// <returns>A boolean indicating if execution should continue or 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
|
120 public bool OnProcessFile(string 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
|
121 { |
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 bool 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
|
123 ProcessFileHandler handler = ProcessFile; |
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 |
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 if ( handler != 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
|
126 ScanEventArgs args = new ScanEventArgs(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
|
127 handler(this, args); |
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 result = args.ContinueRunning; |
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 } |
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 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
|
131 } |
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 |
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 /// Fires the <see cref="CompletedFile"/> delegate |
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 /// <param name="file">The file whose processing has been completed.</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
|
137 /// <returns>A boolean indicating if execution should continue or 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
|
138 public bool OnCompletedFile(string 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
|
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 bool 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
|
141 CompletedFileHandler handler = CompletedFile; |
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 if ( handler != 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
|
143 ScanEventArgs args = new ScanEventArgs(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
|
144 handler(this, args); |
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 result = args.ContinueRunning; |
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 } |
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 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
|
148 } |
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 |
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 /// <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
|
151 /// Fires the <see cref="ProcessDirectory">process directory</see> delegate. |
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 /// </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
|
153 /// <param name="directory">The directory being processed.</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
|
154 /// <param name="hasMatchingFiles">Flag indicating if the directory has matching files as determined by the current filter.</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
|
155 /// <returns>A <see cref="bool"/> of true if the operation should continue; 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
|
156 public bool OnProcessDirectory(string directory, bool hasMatchingFiles) |
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 { |
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 bool 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
|
159 ProcessDirectoryHandler handler = ProcessDirectory; |
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 if ( handler != 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
|
161 DirectoryEventArgs args = new DirectoryEventArgs(directory, hasMatchingFiles); |
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 handler(this, args); |
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 result = args.ContinueRunning; |
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 } |
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 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
|
166 } |
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 |
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 /// <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
|
169 /// The minimum timespan between <see cref="Progress"/> events. |
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 /// </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
|
171 /// <value>The minimum period of time between <see cref="Progress"/> events.</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
|
172 /// <seealso cref="Progress"/> |
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 /// <remarks>The default interval is three seconds.</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
|
174 public TimeSpan ProgressInterval |
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 { |
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 get { return progressInterval_; } |
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 set { progressInterval_ = 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
|
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 #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
|
181 TimeSpan progressInterval_ = TimeSpan.FromSeconds(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
|
182 #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
|
183 } |
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 |
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 /// <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
|
186 /// FastZip provides facilities for creating and extracting zip files. |
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 /// </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
|
188 public class FastZip |
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 { |
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 #region Enumerations |
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 /// <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
|
192 /// Defines the desired handling when overwriting files during extraction. |
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 /// </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
|
194 public enum Overwrite |
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 { |
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 /// <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
|
197 /// Prompt the user to confirm overwriting |
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 /// </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
|
199 Prompt, |
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 /// <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
|
201 /// Never overwrite files. |
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 /// </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
|
203 Never, |
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 /// <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
|
205 /// Always overwrite files. |
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 /// </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
|
207 Always |
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 } |
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 #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
|
210 |
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 #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
|
212 /// <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
|
213 /// Initialise a default instance of <see cref="FastZip"/>. |
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 /// </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
|
215 public FastZip() |
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 { |
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 } |
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 |
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 /// <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
|
220 /// Initialise a new instance of <see cref="FastZip"/> |
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 /// </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
|
222 /// <param name="events">The <see cref="FastZipEvents">events</see> to use during operations.</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
|
223 public FastZip(FastZipEvents events) |
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 events_ = events; |
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 } |
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 #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
|
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 #region Properties |
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 /// <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
|
231 /// Get/set a value indicating wether empty directories should be created. |
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 /// </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
|
233 public bool CreateEmptyDirectories |
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 { |
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 get { return createEmptyDirectories_; } |
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 set { createEmptyDirectories_ = 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
|
237 } |
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 #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
|
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 /// Get / set the password 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
|
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 public string Password |
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 { |
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 get { return password_; } |
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 set { password_ = 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
|
247 } |
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 #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
|
249 |
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 /// <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
|
251 /// Get or set the <see cref="INameTransform"></see> active when creating Zip files. |
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 /// </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
|
253 /// <seealso cref="EntryFactory"></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
|
254 public INameTransform NameTransform |
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 { |
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 get { return entryFactory_.NameTransform; } |
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 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
|
258 entryFactory_.NameTransform = 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
|
259 } |
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 } |
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 |
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 /// <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
|
263 /// Get or set the <see cref="IEntryFactory"></see> active when creating Zip files. |
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 /// </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
|
265 public IEntryFactory EntryFactory |
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 { |
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 get { return entryFactory_; } |
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 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
|
269 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
|
270 entryFactory_ = new ZipEntryFactory(); |
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 } |
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 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
|
273 entryFactory_ = 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
|
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 |
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 /// <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
|
279 /// Gets or sets the setting for <see cref="UseZip64">Zip64 handling when writing.</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
|
280 /// </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
|
281 /// <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
|
282 /// The default value is dynamic which is not backwards compatible with old |
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 /// programs and can cause problems with XP's built in compression which cant |
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 /// read Zip64 archives. However it does avoid the situation were a large 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
|
285 /// is added and cannot be completed 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
|
286 /// NOTE: Setting the size for entries before they are added is the best solution! |
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 /// By default the EntryFactory used by FastZip will set fhe file 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
|
288 /// </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
|
289 public UseZip64 UseZip64 |
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 { |
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 get { return useZip64_; } |
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 set { useZip64_ = 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
|
293 } |
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 |
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 /// <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
|
296 /// Get/set a value indicating wether file dates and times 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
|
297 /// be restored when extracting files from an archive. |
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 /// </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
|
299 /// <remarks>The default value is false.</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
|
300 public bool RestoreDateTimeOnExtract |
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 { |
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 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
|
303 return restoreDateTimeOnExtract_; |
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 } |
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 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
|
306 restoreDateTimeOnExtract_ = 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
|
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 |
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 /// <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
|
311 /// Get/set a value indicating wether file attributes 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
|
312 /// be restored during extract operations |
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 /// </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
|
314 public bool RestoreAttributesOnExtract |
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 { return restoreAttributesOnExtract_; } |
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 set { restoreAttributesOnExtract_ = 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
|
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 #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
|
320 |
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 #region Delegates |
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 /// <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
|
323 /// Delegate called when confirming overwriting of files. |
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 /// </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
|
325 public delegate bool ConfirmOverwriteDelegate(string fileName); |
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 #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
|
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 #region CreateZip |
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 /// Create 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
|
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 /// <param name="zipFileName">The name of the zip file to create.</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
|
333 /// <param name="sourceDirectory">The directory to source files from.</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
|
334 /// <param name="recurse">True to recurse directories, false for no recursion.</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
|
335 /// <param name="fileFilter">The <see cref="PathFilter">file filter</see> to apply.</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
|
336 /// <param name="directoryFilter">The <see cref="PathFilter">directory filter</see> to apply.</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
|
337 public void CreateZip(string zipFileName, string sourceDirectory, |
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 bool recurse, string fileFilter, string directoryFilter) |
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 { |
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 CreateZip(File.Create(zipFileName), sourceDirectory, recurse, fileFilter, directoryFilter); |
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 /// Create a zip file/archive. |
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 /// <param name="zipFileName">The name of the zip file to create.</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
|
347 /// <param name="sourceDirectory">The directory to obtain files and directories from.</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
|
348 /// <param name="recurse">True to recurse directories, false for no recursion.</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
|
349 /// <param name="fileFilter">The file filter to apply.</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
|
350 public void CreateZip(string zipFileName, string sourceDirectory, bool recurse, string fileFilter) |
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 { |
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 CreateZip(File.Create(zipFileName), sourceDirectory, recurse, fileFilter, 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
|
353 } |
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 |
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 /// <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
|
356 /// Create a zip archive sending output to the <paramref name="outputStream"/> passed. |
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 /// </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
|
358 /// <param name="outputStream">The stream to write archive data to.</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
|
359 /// <param name="sourceDirectory">The directory to source files from.</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
|
360 /// <param name="recurse">True to recurse directories, false for no recursion.</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
|
361 /// <param name="fileFilter">The <see cref="PathFilter">file filter</see> to apply.</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
|
362 /// <param name="directoryFilter">The <see cref="PathFilter">directory filter</see> to apply.</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
|
363 /// <remarks>The <paramref name="outputStream"/> is closed after creation.</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
|
364 public void CreateZip(Stream outputStream, string sourceDirectory, bool recurse, string fileFilter, string directoryFilter) |
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 { |
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 NameTransform = new ZipNameTransform(sourceDirectory); |
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 sourceDirectory_ = sourceDirectory; |
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 |
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 using ( outputStream_ = new ZipOutputStream(outputStream) ) { |
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 |
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 #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
|
372 if ( password_ != 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
|
373 outputStream_.Password = password_; |
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 } |
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 #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
|
376 |
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 outputStream_.UseZip64 = UseZip64; |
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 FileSystemScanner scanner = new FileSystemScanner(fileFilter, directoryFilter); |
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 scanner.ProcessFile += new ProcessFileHandler(ProcessFile); |
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 if ( this.CreateEmptyDirectories ) { |
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 scanner.ProcessDirectory += new ProcessDirectoryHandler(ProcessDirectory); |
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 if (events_ != 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
|
385 if ( events_.FileFailure != 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
|
386 scanner.FileFailure += events_.FileFailure; |
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 } |
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 |
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 if ( events_.DirectoryFailure != 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
|
390 scanner.DirectoryFailure += events_.DirectoryFailure; |
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 } |
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 |
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 scanner.Scan(sourceDirectory, recurse); |
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 #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
|
399 |
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 #region ExtractZip |
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 /// <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
|
402 /// Extract the contents of 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
|
403 /// </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
|
404 /// <param name="zipFileName">The zip file to extract from.</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
|
405 /// <param name="targetDirectory">The directory to save extracted information in.</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
|
406 /// <param name="fileFilter">A filter to apply to files.</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
|
407 public void ExtractZip(string zipFileName, string targetDirectory, string fileFilter) |
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 ExtractZip(zipFileName, targetDirectory, Overwrite.Always, null, fileFilter, null, restoreDateTimeOnExtract_); |
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 |
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 /// <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
|
413 /// Extract the contents of 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
|
414 /// </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
|
415 /// <param name="zipFileName">The zip file to extract from.</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
|
416 /// <param name="targetDirectory">The directory to save extracted information in.</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
|
417 /// <param name="overwrite">The style of <see cref="Overwrite">overwriting</see> to apply.</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
|
418 /// <param name="confirmDelegate">A delegate to invoke when confirming overwriting.</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
|
419 /// <param name="fileFilter">A filter to apply to files.</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
|
420 /// <param name="directoryFilter">A filter to apply to directories.</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
|
421 /// <param name="restoreDateTime">Flag indicating whether to restore the date and time for extracted files.</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
|
422 public void ExtractZip(string zipFileName, string targetDirectory, |
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 Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, |
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 string fileFilter, string directoryFilter, bool restoreDateTime) |
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 Stream inputStream = File.Open(zipFileName, FileMode.Open, FileAccess.Read, FileShare.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
|
427 ExtractZip(inputStream, targetDirectory, overwrite, confirmDelegate, fileFilter, directoryFilter, restoreDateTime, 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
|
428 } |
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 |
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 /// <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
|
431 /// Extract the contents of a zip file held in a stream. |
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 /// </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
|
433 /// <param name="inputStream">The seekable input stream containing the zip to extract from.</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
|
434 /// <param name="targetDirectory">The directory to save extracted information in.</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
|
435 /// <param name="overwrite">The style of <see cref="Overwrite">overwriting</see> to apply.</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
|
436 /// <param name="confirmDelegate">A delegate to invoke when confirming overwriting.</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
|
437 /// <param name="fileFilter">A filter to apply to files.</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
|
438 /// <param name="directoryFilter">A filter to apply to directories.</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
|
439 /// <param name="restoreDateTime">Flag indicating whether to restore the date and time for extracted files.</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
|
440 /// <param name="isStreamOwner">Flag indicating whether the inputStream will be closed by this method.</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
|
441 public void ExtractZip(Stream inputStream, string targetDirectory, |
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 Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, |
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 string fileFilter, string directoryFilter, bool restoreDateTime, |
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 bool isStreamOwner) |
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 { |
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 if ((overwrite == Overwrite.Prompt) && (confirmDelegate == 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
|
447 throw new ArgumentNullException("confirmDelegate"); |
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 } |
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 continueRunning_ = 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
|
451 overwrite_ = overwrite; |
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 confirmDelegate_ = confirmDelegate; |
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 extractNameTransform_ = new WindowsNameTransform(targetDirectory); |
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 fileFilter_ = new NameFilter(fileFilter); |
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 directoryFilter_ = new NameFilter(directoryFilter); |
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 restoreDateTimeOnExtract_ = restoreDateTime; |
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 |
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 using (zipFile_ = new ZipFile(inputStream)) { |
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 |
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 #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
|
462 if (password_ != 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
|
463 zipFile_.Password = password_; |
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 } |
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 #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
|
466 zipFile_.IsStreamOwner = isStreamOwner; |
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 System.Collections.IEnumerator enumerator = zipFile_.GetEnumerator(); |
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 while (continueRunning_ && enumerator.MoveNext()) { |
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 ZipEntry entry = (ZipEntry)enumerator.Current; |
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 if (entry.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
|
471 { |
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 // TODO Path.GetDirectory can fail here on invalid 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
|
473 if (directoryFilter_.IsMatch(Path.GetDirectoryName(entry.Name)) && fileFilter_.IsMatch(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
|
474 ExtractEntry(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
|
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 else if (entry.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
|
478 if (directoryFilter_.IsMatch(entry.Name) && CreateEmptyDirectories) { |
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 ExtractEntry(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
|
480 } |
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 } |
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 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
|
483 // Do nothing for volume labels etc... |
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 } |
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 } |
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 } |
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 } |
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 #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
|
489 |
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 #region Internal Processing |
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 void ProcessDirectory(object sender, DirectoryEventArgs e) |
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 { |
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 if ( !e.HasMatchingFiles && CreateEmptyDirectories ) { |
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 if ( events_ != 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
|
495 events_.OnProcessDirectory(e.Name, e.HasMatchingFiles); |
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 } |
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 |
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 if ( e.ContinueRunning ) { |
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 if (e.Name != sourceDirectory_) { |
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 ZipEntry entry = entryFactory_.MakeDirectoryEntry(e.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
|
501 outputStream_.PutNextEntry(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
|
502 } |
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 } |
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 } |
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 } |
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 |
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 void ProcessFile(object sender, ScanEventArgs e) |
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 { |
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 if ( (events_ != null) && (events_.ProcessFile != 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
|
510 events_.ProcessFile(sender, e); |
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 } |
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 |
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 if ( e.ContinueRunning ) { |
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 try { |
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 // The open below is equivalent to OpenRead which gaurantees that if opened 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
|
516 // file will not be changed by subsequent openers, but precludes opening in some cases |
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 // were it could succeed. |
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 using (FileStream stream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.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
|
519 ZipEntry entry = entryFactory_.MakeFileEntry(e.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
|
520 outputStream_.PutNextEntry(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
|
521 AddFileContents(e.Name, stream); |
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 } |
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 catch(Exception ex) { |
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 if (events_ != 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
|
526 continueRunning_ = events_.OnFileFailure(e.Name, ex); |
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 } |
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 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
|
529 continueRunning_ = 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
|
530 throw; |
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 } |
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 } |
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 } |
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 } |
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 |
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 void AddFileContents(string name, Stream stream) |
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 { |
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 if( stream==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
|
539 throw new ArgumentNullException("stream"); |
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 } |
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 |
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 if( buffer_==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
|
543 buffer_=new byte[4096]; |
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 } |
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 |
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 if( (events_!=null)&&(events_.Progress!=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
|
547 StreamUtils.Copy(stream, outputStream_, buffer_, |
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 events_.Progress, events_.ProgressInterval, this, 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
|
549 } |
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 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
|
551 StreamUtils.Copy(stream, outputStream_, buffer_); |
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 } |
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 |
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 if( events_!=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
|
555 continueRunning_=events_.OnCompletedFile(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
|
556 } |
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 |
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 void ExtractFileEntry(ZipEntry entry, string targetName) |
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 { |
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 bool proceed = 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
|
562 if ( overwrite_ != Overwrite.Always ) { |
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 if ( File.Exists(targetName) ) { |
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 if ( (overwrite_ == Overwrite.Prompt) && (confirmDelegate_ != 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
|
565 proceed = confirmDelegate_(targetName); |
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 } |
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 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
|
568 proceed = 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
|
569 } |
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 } |
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 |
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 if ( proceed ) { |
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 if ( events_ != 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
|
575 continueRunning_ = events_.OnProcessFile(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
|
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 |
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 if ( continueRunning_ ) { |
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 try { |
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 using ( FileStream outputStream = File.Create(targetName) ) { |
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 if ( buffer_ == 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
|
582 buffer_ = new byte[4096]; |
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 } |
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 if ((events_ != null) && (events_.Progress != 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
|
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 StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_, |
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 events_.Progress, events_.ProgressInterval, this, entry.Name, 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
|
588 } |
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 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
|
590 { |
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 StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_); |
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 } |
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 |
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 if (events_ != 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
|
595 continueRunning_ = events_.OnCompletedFile(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
|
596 } |
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 } |
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 |
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 #if !NETCF_1_0 && !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
|
600 if ( restoreDateTimeOnExtract_ ) { |
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 File.SetLastWriteTime(targetName, entry.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
|
602 } |
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 if ( RestoreAttributesOnExtract && entry.IsDOSEntry && (entry.ExternalFileAttributes != -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
|
605 FileAttributes fileAttributes = (FileAttributes) 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
|
606 // TODO: FastZip - Setting of other file attributes on extraction is a little trickier. |
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 fileAttributes &= (FileAttributes.Archive | FileAttributes.Normal | FileAttributes.ReadOnly | FileAttributes.Hidden); |
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 File.SetAttributes(targetName, fileAttributes); |
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 } |
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 #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
|
611 } |
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 catch(Exception ex) { |
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 if ( events_ != 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
|
614 continueRunning_ = events_.OnFileFailure(targetName, ex); |
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 } |
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 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
|
617 continueRunning_ = 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
|
618 throw; |
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 } |
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 } |
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 |
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 void ExtractEntry(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
|
626 { |
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 bool doExtraction = entry.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
|
628 string targetName = 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
|
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 if ( doExtraction ) { |
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 if ( entry.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
|
632 targetName = extractNameTransform_.TransformFile(targetName); |
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 } |
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 else if ( entry.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
|
635 targetName = extractNameTransform_.TransformDirectory(targetName); |
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 } |
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 |
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 doExtraction = !((targetName == null) || (targetName.Length == 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
|
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 |
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 // TODO: Fire delegate/throw exception were compression method not supported, or name 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
|
642 |
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 string dirName = 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
|
644 |
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 if ( doExtraction ) { |
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 if ( entry.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
|
647 dirName = targetName; |
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 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
|
650 dirName = Path.GetDirectoryName(Path.GetFullPath(targetName)); |
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 } |
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 } |
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 |
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 if ( doExtraction && !Directory.Exists(dirName) ) { |
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 if ( !entry.IsDirectory || CreateEmptyDirectories ) { |
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 try { |
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 Directory.CreateDirectory(dirName); |
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 catch (Exception ex) { |
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 doExtraction = 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
|
661 if ( events_ != 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
|
662 if ( entry.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
|
663 continueRunning_ = events_.OnDirectoryFailure(targetName, ex); |
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 } |
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 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
|
666 continueRunning_ = events_.OnFileFailure(targetName, ex); |
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 } |
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 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
|
670 continueRunning_ = 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
|
671 throw; |
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 } |
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 } |
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 if ( doExtraction && entry.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
|
678 ExtractFileEntry(entry, targetName); |
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 } |
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 } |
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 static int MakeExternalAttributes(FileInfo info) |
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 { |
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 return (int)info.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
|
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 #if NET_1_0 || NET_1_1 || 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
|
688 static bool NameIsValid(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
|
689 { |
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 return (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
|
691 (name.Length > 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
|
692 (name.IndexOfAny(Path.InvalidPathChars) < 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
|
693 } |
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 #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
|
695 static bool NameIsValid(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
|
696 { |
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 return (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
|
698 (name.Length > 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
|
699 (name.IndexOfAny(Path.GetInvalidPathChars()) < 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
|
700 } |
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 #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
|
702 #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
|
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 #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
|
705 bool continueRunning_; |
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 byte[] buffer_; |
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 ZipOutputStream outputStream_; |
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 ZipFile 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
|
709 string sourceDirectory_; |
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 NameFilter fileFilter_; |
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 NameFilter directoryFilter_; |
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 Overwrite overwrite_; |
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 ConfirmOverwriteDelegate confirmDelegate_; |
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 |
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 bool restoreDateTimeOnExtract_; |
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 bool restoreAttributesOnExtract_; |
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 bool createEmptyDirectories_; |
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 FastZipEvents events_; |
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 IEntryFactory entryFactory_ = new ZipEntryFactory(); |
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 INameTransform extractNameTransform_; |
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 UseZip64 useZip64_=UseZip64.Dynamic; |
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 |
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 #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
|
724 string password_; |
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 #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
|
726 |
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 #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
|
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 } |