1 <?xml version="1.0" encoding="utf-8"?>
4 <name>System.IO.Compression.ZipFile</name>
7 <member name="T:System.IO.Compression.ZipFile">
8 <summary>Provides static methods for creating, extracting, and opening zip archives.</summary>
10 <member name="M:System.IO.Compression.ZipFile.CreateFromDirectory(System.String,System.String)">
11 <summary>Creates a zip archive that contains the files and directories from the specified directory.</summary>
12 <param name="sourceDirectoryName">The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
13 <param name="destinationArchiveFileName">The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
14 <exception cref="T:System.ArgumentException">
15 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
16 <exception cref="T:System.ArgumentNullException">
17 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see langword="null" />.</exception>
18 <exception cref="T:System.IO.PathTooLongException">In <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
19 <exception cref="T:System.IO.DirectoryNotFoundException">
20 <paramref name="sourceDirectoryName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
21 <exception cref="T:System.IO.IOException">
22 <paramref name="destinationArchiveFileName" /> already exists.
26 A file in the specified directory could not be opened.
30 An I/O error occurred while opening a file to be archived.</exception>
31 <exception cref="T:System.UnauthorizedAccessException">
32 <paramref name="destinationArchiveFileName" /> specifies a directory.
36 The caller does not have the required permission to access the directory specified in <paramref name="sourceDirectoryName" /> or the file specified in <paramref name="destinationArchiveFileName" />.</exception>
37 <exception cref="T:System.NotSupportedException">
38 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> contains an invalid format.
42 The zip archive does not support writing.</exception>
44 <member name="M:System.IO.Compression.ZipFile.CreateFromDirectory(System.String,System.String,System.IO.Compression.CompressionLevel,System.Boolean)">
45 <summary>Creates a zip archive that contains the files and directories from the specified directory, uses the specified compression level, and optionally includes the base directory.</summary>
46 <param name="sourceDirectoryName">The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
47 <param name="destinationArchiveFileName">The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
48 <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry.</param>
49 <param name="includeBaseDirectory">
50 <see langword="true" /> to include the directory name from <paramref name="sourceDirectoryName" /> at the root of the archive; <see langword="false" /> to include only the contents of the directory.</param>
51 <exception cref="T:System.ArgumentException">
52 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
53 <exception cref="T:System.ArgumentNullException">
54 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see langword="null" />.</exception>
55 <exception cref="T:System.IO.PathTooLongException">In <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
56 <exception cref="T:System.IO.DirectoryNotFoundException">
57 <paramref name="sourceDirectoryName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
58 <exception cref="T:System.IO.IOException">
59 <paramref name="destinationArchiveFileName" /> already exists.
63 A file in the specified directory could not be opened.
67 An I/O error occurred while opening a file to be archived.</exception>
68 <exception cref="T:System.UnauthorizedAccessException">
69 <paramref name="destinationArchiveFileName" /> specifies a directory.
73 The caller does not have the required permission to access the directory specified in <paramref name="sourceDirectoryName" /> or the file specified in <paramref name="destinationArchiveFileName" />.</exception>
74 <exception cref="T:System.NotSupportedException">
75 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> contains an invalid format.
79 The zip archive does not support writing.</exception>
81 <member name="M:System.IO.Compression.ZipFile.CreateFromDirectory(System.String,System.String,System.IO.Compression.CompressionLevel,System.Boolean,System.Text.Encoding)">
82 <summary>Creates a zip archive that contains the files and directories from the specified directory, uses the specified compression level and character encoding for entry names, and optionally includes the base directory.</summary>
83 <param name="sourceDirectoryName">The path to the directory to be archived, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
84 <param name="destinationArchiveFileName">The path of the archive to be created, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
85 <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry.</param>
86 <param name="includeBaseDirectory">
87 <see langword="true" /> to include the directory name from <paramref name="sourceDirectoryName" /> at the root of the archive; <see langword="false" /> to include only the contents of the directory.</param>
88 <param name="entryNameEncoding">The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.</param>
89 <exception cref="T:System.ArgumentException">
90 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
94 <paramref name="entryNameEncoding" /> is set to a Unicode encoding other than UTF-8.</exception>
95 <exception cref="T:System.ArgumentNullException">
96 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> is <see langword="null" />.</exception>
97 <exception cref="T:System.IO.PathTooLongException">In <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
98 <exception cref="T:System.IO.DirectoryNotFoundException">
99 <paramref name="sourceDirectoryName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
100 <exception cref="T:System.IO.IOException">
101 <paramref name="destinationArchiveFileName" /> already exists.
105 A file in the specified directory could not be opened.
109 An I/O error occurred while opening a file to be archived.</exception>
110 <exception cref="T:System.UnauthorizedAccessException">
111 <paramref name="destinationArchiveFileName" /> specifies a directory.
115 The caller does not have the required permission to access the directory specified in <paramref name="sourceDirectoryName" /> or the file specified in <paramref name="destinationArchiveFileName" />.</exception>
116 <exception cref="T:System.NotSupportedException">
117 <paramref name="sourceDirectoryName" /> or <paramref name="destinationArchiveFileName" /> contains an invalid format.
121 The zip archive does not support writing.</exception>
123 <member name="M:System.IO.Compression.ZipFile.ExtractToDirectory(System.String,System.String)">
124 <summary>Extracts all the files in the specified zip archive to a directory on the file system.</summary>
125 <param name="sourceArchiveFileName">The path to the archive that is to be extracted.</param>
126 <param name="destinationDirectoryName">The path to the directory in which to place the extracted files, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
127 <exception cref="T:System.ArgumentException">
128 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
129 <exception cref="T:System.ArgumentNullException">
130 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> is <see langword="null" />.</exception>
131 <exception cref="T:System.IO.PathTooLongException">The specified path in <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> exceeds the system-defined maximum length.</exception>
132 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
133 <exception cref="T:System.IO.IOException">The name of an entry in the archive is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
137 Extracting an archive entry would create a file that is outside the directory specified by <paramref name="destinationDirectoryName" />. (For example, this might happen if the entry name contains parent directory accessors.)
141 An archive entry to extract has the same name as an entry that has already been extracted or that exists in <paramref name="destinationDirectoryName" />.</exception>
142 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission to access the archive or the destination directory.</exception>
143 <exception cref="T:System.NotSupportedException">
144 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> contains an invalid format.</exception>
145 <exception cref="T:System.IO.FileNotFoundException">
146 <paramref name="sourceArchiveFileName" /> was not found.</exception>
147 <exception cref="T:System.IO.InvalidDataException">The archive specified by <paramref name="sourceArchiveFileName" /> is not a valid zip archive.
151 An archive entry was not found or was corrupt.
155 An archive entry was compressed by using a compression method that is not supported.</exception>
157 <member name="M:System.IO.Compression.ZipFile.ExtractToDirectory(System.String,System.String,System.Boolean)">
158 <summary>Extracts all of the files in the specified archive to a directory on the file system.</summary>
159 <param name="sourceArchiveFileName">The path on the file system to the archive that is to be extracted.</param>
160 <param name="destinationDirectoryName">The path to the destination directory on the file system.</param>
161 <param name="overwriteFiles">
162 <see langword="true" /> to overwrite files; <see langword="false" /> otherwise.</param>
163 <exception cref="T:System.ArgumentException">
164 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is a zero-length string, contains only whitespace, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.</exception>
165 <exception cref="T:System.ArgumentNullException">
166 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is <see langword="null" />.</exception>
167 <exception cref="T:System.IO.PathTooLongException">
168 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> specifies a path, a file name, or both that exceed the system-defined maximum length.</exception>
169 <exception cref="T:System.IO.DirectoryNotFoundException">The path specified by <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is invalid (for example, it is on an unmapped drive).</exception>
170 <exception cref="T:System.IO.IOException">
171 <paramref name="overwriteFiles" /> is <see langword="false" /> and <paramref name="destinationDirectoryName" /> already contains a file with the same name as a file that's being extracted.
175 An I/O error has occurred.
179 The name of a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> is zero-length, contains only whitespace, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
183 Extracting a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> would result in a file destination that is outside the destination directory (for example, because of parent directory accessors).
187 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has the same name as an entry from the same archive that's already been extracted.</exception>
188 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.</exception>
189 <exception cref="T:System.NotSupportedException">
190 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is in an invalid format.</exception>
191 <exception cref="T:System.IO.FileNotFoundException">
192 <paramref name="sourceArchiveFileName" /> was not found.</exception>
193 <exception cref="T:System.IO.InvalidDataException">The archive specified by <paramref name="sourceArchiveFileName" /> is not a valid <see cref="T:System.IO.Compression.ZipArchive" />.
197 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> was not found or was corrupt.
201 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has been compressed using a compression method that is not supported.</exception>
203 <member name="M:System.IO.Compression.ZipFile.ExtractToDirectory(System.String,System.String,System.Text.Encoding)">
204 <summary>Extracts all the files in the specified zip archive to a directory on the file system and uses the specified character encoding for entry names.</summary>
205 <param name="sourceArchiveFileName">The path to the archive that is to be extracted.</param>
206 <param name="destinationDirectoryName">The path to the directory in which to place the extracted files, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
207 <param name="entryNameEncoding">The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.</param>
208 <exception cref="T:System.ArgumentException">
209 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
213 <paramref name="entryNameEncoding" /> is set to a Unicode encoding other than UTF-8.</exception>
214 <exception cref="T:System.ArgumentNullException">
215 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> is <see langword="null" />.</exception>
216 <exception cref="T:System.IO.PathTooLongException">The specified path in <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> exceeds the system-defined maximum length.</exception>
217 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
218 <exception cref="T:System.IO.IOException">The name of an entry in the archive is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
222 Extracting an archive entry would create a file that is outside the directory specified by <paramref name="destinationDirectoryName" />. (For example, this might happen if the entry name contains parent directory accessors.)
226 An archive entry to extract has the same name as an entry that has already been extracted or that exists in <paramref name="destinationDirectoryName" />.</exception>
227 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission to access the archive or the destination directory.</exception>
228 <exception cref="T:System.NotSupportedException">
229 <paramref name="destinationDirectoryName" /> or <paramref name="sourceArchiveFileName" /> contains an invalid format.</exception>
230 <exception cref="T:System.IO.FileNotFoundException">
231 <paramref name="sourceArchiveFileName" /> was not found.</exception>
232 <exception cref="T:System.IO.InvalidDataException">The archive specified by <paramref name="sourceArchiveFileName" /> is not a valid zip archive.
236 An archive entry was not found or was corrupt.
240 An archive entry was compressed by using a compression method that is not supported.</exception>
242 <member name="M:System.IO.Compression.ZipFile.ExtractToDirectory(System.String,System.String,System.Text.Encoding,System.Boolean)">
243 <summary>Extracts all of the files in the specified archive to a directory on the file system.</summary>
244 <param name="sourceArchiveFileName">The path on the file system to the archive that is to be extracted.</param>
245 <param name="destinationDirectoryName">The path to the destination directory on the file system.</param>
246 <param name="entryNameEncoding">The encoding to use when reading entry names in this <see cref="T:System.IO.Compression.ZipArchive" />.</param>
247 <param name="overwriteFiles">
248 <see langword="true" /> to overwrite files; <see langword="false" /> otherwise.</param>
249 <exception cref="T:System.ArgumentException">
250 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is a zero-length string, contains only whitespace, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
254 <paramref name="entryNameEncoding" /> is set to a Unicode encoding other than UTF-8.</exception>
255 <exception cref="T:System.ArgumentNullException">
256 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is <see langword="null" />.</exception>
257 <exception cref="T:System.IO.PathTooLongException">
258 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> specifies a path, a file name, or both that exceed the system-defined maximum length.</exception>
259 <exception cref="T:System.IO.DirectoryNotFoundException">The path specified by <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is invalid (for example, it is on an unmapped drive).</exception>
260 <exception cref="T:System.IO.IOException">
261 <paramref name="overwriteFiles" /> is <see langword="false" /> and an archive entry to extract has the same name as a file that already exists in <paramref name="destinationDirectoryName" />.
265 An I/O error has occurred.
269 The name of a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> is zero-length, contains only whitespace, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
273 Extracting a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> would result in a file destination that is outside the destination directory (for example, because of parent directory accessors).
277 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has the same name as an already extracted entry from the same archive.</exception>
278 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.</exception>
279 <exception cref="T:System.NotSupportedException">
280 <paramref name="sourceArchiveFileName" /> or <paramref name="destinationDirectoryName" /> is in an invalid format.</exception>
281 <exception cref="T:System.IO.FileNotFoundException">
282 <paramref name="sourceArchiveFileName" /> was not found.</exception>
283 <exception cref="T:System.IO.InvalidDataException">The archive specified by <paramref name="sourceArchiveFileName" /> is not a valid <see cref="T:System.IO.Compression.ZipArchive" />.
287 An archive entry was not found or was corrupt.
291 An archive entry has been compressed using a compression method that is not supported.</exception>
293 <member name="M:System.IO.Compression.ZipFile.Open(System.String,System.IO.Compression.ZipArchiveMode)">
294 <summary>Opens a zip archive at the specified path and in the specified mode.</summary>
295 <param name="archiveFileName">The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
296 <param name="mode">One of the enumeration values that specifies the actions which are allowed on the entries in the opened archive.</param>
297 <exception cref="T:System.ArgumentException">
298 <paramref name="archiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
299 <exception cref="T:System.ArgumentNullException">
300 <paramref name="archiveFileName" /> is <see langword="null" />.</exception>
301 <exception cref="T:System.IO.PathTooLongException">In <paramref name="archiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
302 <exception cref="T:System.IO.DirectoryNotFoundException">
303 <paramref name="archiveFileName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
304 <exception cref="T:System.IO.IOException">
305 <paramref name="archiveFileName" /> could not be opened.
309 <paramref name="mode" /> is set to <see cref="F:System.IO.Compression.ZipArchiveMode.Create" />, but the file specified in <paramref name="archiveFileName" /> already exists.
313 An unspecified I/O error occurred while opening the file.</exception>
314 <exception cref="T:System.UnauthorizedAccessException">
315 <paramref name="archiveFileName" /> specifies a directory.
319 The caller does not have the required permission to access the file specified in <paramref name="archiveFileName" />.</exception>
320 <exception cref="T:System.ArgumentOutOfRangeException">
321 <paramref name="mode" /> specifies an invalid value.</exception>
322 <exception cref="T:System.IO.FileNotFoundException">
323 <paramref name="mode" /> is set to <see cref="F:System.IO.Compression.ZipArchiveMode.Read" />, but the file specified in <paramref name="archiveFileName" /> is not found.</exception>
324 <exception cref="T:System.NotSupportedException">
325 <paramref name="archiveFileName" /> contains an invalid format.</exception>
326 <exception cref="T:System.IO.InvalidDataException">
327 <paramref name="archiveFileName" /> could not be interpreted as a zip archive.
331 <paramref name="mode" /> is <see cref="F:System.IO.Compression.ZipArchiveMode.Update" />, but an entry is missing or corrupt and cannot be read.
335 <paramref name="mode" /> is <see cref="F:System.IO.Compression.ZipArchiveMode.Update" />, but an entry is too large to fit into memory.</exception>
336 <returns>The opened zip archive.</returns>
338 <member name="M:System.IO.Compression.ZipFile.Open(System.String,System.IO.Compression.ZipArchiveMode,System.Text.Encoding)">
339 <summary>Opens a zip archive at the specified path, in the specified mode, and by using the specified character encoding for entry names.</summary>
340 <param name="archiveFileName">The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
341 <param name="mode">One of the enumeration values that specifies the actions that are allowed on the entries in the opened archive.</param>
342 <param name="entryNameEncoding">The encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.</param>
343 <exception cref="T:System.ArgumentException">
344 <paramref name="archiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
348 <paramref name="entryNameEncoding" /> is set to a Unicode encoding other than UTF-8.</exception>
349 <exception cref="T:System.ArgumentNullException">
350 <paramref name="archiveFileName" /> is <see langword="null" />.</exception>
351 <exception cref="T:System.IO.PathTooLongException">In <paramref name="archiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
352 <exception cref="T:System.IO.DirectoryNotFoundException">
353 <paramref name="archiveFileName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
354 <exception cref="T:System.IO.IOException">
355 <paramref name="archiveFileName" /> could not be opened.
359 <paramref name="mode" /> is set to <see cref="F:System.IO.Compression.ZipArchiveMode.Create" />, but the file specified in <paramref name="archiveFileName" /> already exists.
363 An unspecified I/O error occurred while opening the file.</exception>
364 <exception cref="T:System.UnauthorizedAccessException">
365 <paramref name="archiveFileName" /> specifies a directory.
369 The caller does not have the required permission to access the file specified in <paramref name="archiveFileName" />.</exception>
370 <exception cref="T:System.ArgumentOutOfRangeException">
371 <paramref name="mode" /> specifies an invalid value.</exception>
372 <exception cref="T:System.IO.FileNotFoundException">
373 <paramref name="mode" /> is set to <see cref="F:System.IO.Compression.ZipArchiveMode.Read" />, but the file specified in <paramref name="archiveFileName" /> is not found.</exception>
374 <exception cref="T:System.NotSupportedException">
375 <paramref name="archiveFileName" /> contains an invalid format.</exception>
376 <exception cref="T:System.IO.InvalidDataException">
377 <paramref name="archiveFileName" /> could not be interpreted as a zip archive.
381 <paramref name="mode" /> is <see cref="F:System.IO.Compression.ZipArchiveMode.Update" />, but an entry is missing or corrupt and cannot be read.
385 <paramref name="mode" /> is <see cref="F:System.IO.Compression.ZipArchiveMode.Update" />, but an entry is too large to fit into memory.</exception>
386 <returns>The opened zip archive.</returns>
388 <member name="M:System.IO.Compression.ZipFile.OpenRead(System.String)">
389 <summary>Opens a zip archive for reading at the specified path.</summary>
390 <param name="archiveFileName">The path to the archive to open, specified as a relative or absolute path. A relative path is interpreted as relative to the current working directory.</param>
391 <exception cref="T:System.ArgumentException">
392 <paramref name="archiveFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
393 <exception cref="T:System.ArgumentNullException">
394 <paramref name="archiveFileName" /> is <see langword="null" />.</exception>
395 <exception cref="T:System.IO.PathTooLongException">In <paramref name="archiveFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
396 <exception cref="T:System.IO.DirectoryNotFoundException">
397 <paramref name="archiveFileName" /> is invalid or does not exist (for example, it is on an unmapped drive).</exception>
398 <exception cref="T:System.IO.IOException">
399 <paramref name="archiveFileName" /> could not be opened.
403 An unspecified I/O error occurred while opening the file.</exception>
404 <exception cref="T:System.UnauthorizedAccessException">
405 <paramref name="archiveFileName" /> specifies a directory.
409 The caller does not have the required permission to access the file specified in <paramref name="archiveFileName" />.</exception>
410 <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="archiveFileName" /> is not found.</exception>
411 <exception cref="T:System.NotSupportedException">
412 <paramref name="archiveFileName" /> contains an invalid format.</exception>
413 <exception cref="T:System.IO.InvalidDataException">
414 <paramref name="archiveFileName" /> could not be interpreted as a zip archive.</exception>
415 <returns>The opened zip archive.</returns>
417 <member name="T:System.IO.Compression.ZipFileExtensions">
418 <summary>Provides extension methods for the <see cref="T:System.IO.Compression.ZipArchive" /> and <see cref="T:System.IO.Compression.ZipArchiveEntry" /> classes.</summary>
420 <member name="M:System.IO.Compression.ZipFileExtensions.CreateEntryFromFile(System.IO.Compression.ZipArchive,System.String,System.String)">
421 <summary>Archives a file by compressing it and adding it to the zip archive.</summary>
422 <param name="destination">The zip archive to add the file to.</param>
423 <param name="sourceFileName">The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</param>
424 <param name="entryName">The name of the entry to create in the zip archive.</param>
425 <exception cref="T:System.ArgumentException">
426 <paramref name="sourceFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
430 <paramref name="entryName" /> is <see cref="F:System.String.Empty" />.</exception>
431 <exception cref="T:System.ArgumentNullException">
432 <paramref name="sourceFileName" /> or <paramref name="entryName" /> is <see langword="null" />.</exception>
433 <exception cref="T:System.IO.PathTooLongException">In <paramref name="sourceFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
434 <exception cref="T:System.IO.DirectoryNotFoundException">
435 <paramref name="sourceFileName" /> is invalid (for example, it is on an unmapped drive).</exception>
436 <exception cref="T:System.IO.IOException">The file specified by <paramref name="sourceFileName" /> cannot be opened, or is too large to be updated (current limit is <see cref="F:System.Int32.MaxValue" />).</exception>
437 <exception cref="T:System.UnauthorizedAccessException">
438 <paramref name="sourceFileName" /> specifies a directory.
442 The caller does not have the required permission to access the file specified by <paramref name="sourceFileName" />.</exception>
443 <exception cref="T:System.IO.FileNotFoundException">The file specified by <paramref name="sourceFileName" /> is not found.</exception>
444 <exception cref="T:System.NotSupportedException">The <paramref name="sourceFileName" /> parameter is in an invalid format.
448 The zip archive does not support writing.</exception>
449 <exception cref="T:System.ObjectDisposedException">The zip archive has been disposed.</exception>
450 <returns>A wrapper for the new entry in the zip archive.</returns>
452 <member name="M:System.IO.Compression.ZipFileExtensions.CreateEntryFromFile(System.IO.Compression.ZipArchive,System.String,System.String,System.IO.Compression.CompressionLevel)">
453 <summary>Archives a file by compressing it using the specified compression level and adding it to the zip archive.</summary>
454 <param name="destination">The zip archive to add the file to.</param>
455 <param name="sourceFileName">The path to the file to be archived. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</param>
456 <param name="entryName">The name of the entry to create in the zip archive.</param>
457 <param name="compressionLevel">One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry.</param>
458 <exception cref="T:System.ArgumentException">
459 <paramref name="sourceFileName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
463 <paramref name="entryName" /> is <see cref="F:System.String.Empty" />.</exception>
464 <exception cref="T:System.ArgumentNullException">
465 <paramref name="sourceFileName" /> or <paramref name="entryName" /> is <see langword="null" />.</exception>
466 <exception cref="T:System.IO.DirectoryNotFoundException">
467 <paramref name="sourceFileName" /> is invalid (for example, it is on an unmapped drive).</exception>
468 <exception cref="T:System.IO.PathTooLongException">In <paramref name="sourceFileName" />, the specified path, file name, or both exceed the system-defined maximum length.</exception>
469 <exception cref="T:System.IO.IOException">The file specified by <paramref name="sourceFileName" /> cannot be opened, or is too large to be updated (current limit is <see cref="F:System.Int32.MaxValue" />).</exception>
470 <exception cref="T:System.UnauthorizedAccessException">
471 <paramref name="sourceFileName" /> specifies a directory.
475 The caller does not have the required permission to access the file specified by <paramref name="sourceFileName" />.</exception>
476 <exception cref="T:System.IO.FileNotFoundException">The file specified by <paramref name="sourceFileName" /> is not found.</exception>
477 <exception cref="T:System.NotSupportedException">The <paramref name="sourceFileName" /> parameter is in an invalid format.
481 The zip archive does not support writing.</exception>
482 <exception cref="T:System.ObjectDisposedException">The zip archive has been disposed.</exception>
483 <returns>A wrapper for the new entry in the zip archive.</returns>
485 <member name="M:System.IO.Compression.ZipFileExtensions.ExtractToDirectory(System.IO.Compression.ZipArchive,System.String)">
486 <summary>Extracts all the files in the zip archive to a directory on the file system.</summary>
487 <param name="source">The zip archive to extract files from.</param>
488 <param name="destinationDirectoryName">The path to the directory to place the extracted files in. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</param>
489 <exception cref="T:System.ArgumentException">
490 <paramref name="destinationDirectoryName" /> is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.</exception>
491 <exception cref="T:System.ArgumentNullException">
492 <paramref name="destinationDirectoryName" /> is <see langword="null" />.</exception>
493 <exception cref="T:System.IO.PathTooLongException">The specified path exceeds the system-defined maximum length.</exception>
494 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
495 <exception cref="T:System.IO.IOException">The name of an entry in the archive is <see cref="F:System.String.Empty" />, contains only white space, or contains at least one invalid character.
499 Extracting an entry from the archive would create a file that is outside the directory specified by <paramref name="destinationDirectoryName" />. (For example, this might happen if the entry name contains parent directory accessors.)
503 Two or more entries in the archive have the same name.</exception>
504 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission to write to the destination directory.</exception>
505 <exception cref="T:System.NotSupportedException">
506 <paramref name="destinationDirectoryName" /> contains an invalid format.</exception>
507 <exception cref="T:System.IO.InvalidDataException">An archive entry cannot be found or is corrupt.
511 An archive entry was compressed by using a compression method that is not supported.</exception>
513 <member name="M:System.IO.Compression.ZipFileExtensions.ExtractToDirectory(System.IO.Compression.ZipArchive,System.String,System.Boolean)">
514 <summary>Extracts all of the files in the archive to a directory on the file system.</summary>
515 <param name="source">The <see cref="T:System.IO.Compression.ZipArchive" /> to extract.</param>
516 <param name="destinationDirectoryName">The path to the destination directory on the file system. The path can be relative or absolute. A relative path is interpreted as relative to the current working directory.</param>
517 <param name="overwriteFiles">
518 <see langword="true" /> to overwrite existing files; <see langword="false" /> otherwise.</param>
519 <exception cref="T:System.ArgumentException">
520 <paramref name="destinationArchiveFileName" /> is a zero-length string, contains only whitespace,
521 or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.</exception>
522 <exception cref="T:System.ArgumentNullException">
523 <paramref name="destinationArchiveFileName" /> is <see langword="null" />.</exception>
524 <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
525 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
526 <exception cref="T:System.IO.IOException">The name of a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> is zero-length, contains only whitespace, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
530 Extracting a <see cref="T:System.IO.Compression.ZipArchiveEntry" /> would have resulted in a destination file that is outside <paramref name="destinationArchiveFileName" /> (for example, if the entry name contains parent directory accessors).
534 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has the same name as an already extracted entry from the same archive.</exception>
535 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.</exception>
536 <exception cref="T:System.NotSupportedException">
537 <paramref name="destinationArchiveFileName" /> is in an invalid format.</exception>
538 <exception cref="T:System.IO.InvalidDataException">A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> was not found or was corrupt.
542 A <see cref="T:System.IO.Compression.ZipArchiveEntry" /> has been compressed using a compression method that is not supported.</exception>
544 <member name="M:System.IO.Compression.ZipFileExtensions.ExtractToFile(System.IO.Compression.ZipArchiveEntry,System.String)">
545 <summary>Extracts an entry in the zip archive to a file.</summary>
546 <param name="source">The zip archive entry to extract a file from.</param>
547 <param name="destinationFileName">The path of the file to create from the contents of the entry. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</param>
548 <exception cref="T:System.ArgumentException">
549 <paramref name="destinationFileName" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
553 <paramref name="destinationFileName" /> specifies a directory.</exception>
554 <exception cref="T:System.ArgumentNullException">
555 <paramref name="destinationFileName" /> is <see langword="null" />.</exception>
556 <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
557 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
558 <exception cref="T:System.IO.IOException">
559 <paramref name="destinationFileName" /> already exists.
563 An I/O error occurred.
567 The entry is currently open for writing.
571 The entry has been deleted from the archive.</exception>
572 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission to create the new file.</exception>
573 <exception cref="T:System.IO.InvalidDataException">The entry is missing from the archive, or is corrupt and cannot be read.
577 The entry has been compressed by using a compression method that is not supported.</exception>
578 <exception cref="T:System.ObjectDisposedException">The zip archive that this entry belongs to has been disposed.</exception>
579 <exception cref="T:System.NotSupportedException">
580 <paramref name="destinationFileName" /> is in an invalid format.
584 The zip archive for this entry was opened in <see cref="F:System.IO.Compression.ZipArchiveMode.Create" /> mode, which does not permit the retrieval of entries.</exception>
586 <member name="M:System.IO.Compression.ZipFileExtensions.ExtractToFile(System.IO.Compression.ZipArchiveEntry,System.String,System.Boolean)">
587 <summary>Extracts an entry in the zip archive to a file, and optionally overwrites an existing file that has the same name.</summary>
588 <param name="source">The zip archive entry to extract a file from.</param>
589 <param name="destinationFileName">The path of the file to create from the contents of the entry. You can specify either a relative or an absolute path. A relative path is interpreted as relative to the current working directory.</param>
590 <param name="overwrite">
591 <see langword="true" /> to overwrite an existing file that has the same name as the destination file; otherwise, <see langword="false" />.</param>
592 <exception cref="T:System.ArgumentException">
593 <paramref name="destinationFileName" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.
597 <paramref name="destinationFileName" /> specifies a directory.</exception>
598 <exception cref="T:System.ArgumentNullException">
599 <paramref name="destinationFileName" /> is <see langword="null" />.</exception>
600 <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length.</exception>
601 <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive).</exception>
602 <exception cref="T:System.IO.IOException">
603 <paramref name="destinationFileName" /> already exists and <paramref name="overwrite" /> is <see langword="false" />.
607 An I/O error occurred.
611 The entry is currently open for writing.
615 The entry has been deleted from the archive.</exception>
616 <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission to create the new file.</exception>
617 <exception cref="T:System.IO.InvalidDataException">The entry is missing from the archive or is corrupt and cannot be read.
621 The entry has been compressed by using a compression method that is not supported.</exception>
622 <exception cref="T:System.ObjectDisposedException">The zip archive that this entry belongs to has been disposed.</exception>
623 <exception cref="T:System.NotSupportedException">
624 <paramref name="destinationFileName" /> is in an invalid format.
628 The zip archive for this entry was opened in <see cref="F:System.IO.Compression.ZipArchiveMode.Create" /> mode, which does not permit the retrieval of entries.</exception>