You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Fallout.Utilities.IO.Compression/CompressionExtensions.cs
+98-61Lines changed: 98 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -3,65 +3,101 @@
3
3
usingSystem.IO;
4
4
usingSystem.IO.Compression;
5
5
usingSystem.Linq;
6
+
usingFallout.Common.Utilities.Collections;
6
7
usingICSharpCode.SharpZipLib.BZip2;
7
8
usingICSharpCode.SharpZipLib.GZip;
8
9
usingICSharpCode.SharpZipLib.Tar;
9
10
usingICSharpCode.SharpZipLib.Zip;
10
11
usingSharpCompress.Common;
11
12
usingSharpCompress.Readers;
12
-
usingFallout.Common.Utilities.Collections;
13
+
usingZipFile=ICSharpCode.SharpZipLib.Zip.ZipFile;
13
14
14
15
namespaceFallout.Common.IO;
15
16
16
17
publicstaticclassCompressionExtensions
17
18
{
18
19
/// <summary>
19
-
/// Compresses <paramref name="directory"/> into <paramref name="archiveFile"/>, choosing the compression format based on the archive file's extension.
20
+
/// Compresses <paramref name="directory" /> into <paramref name="archiveFile" />, choosing the compression format based on the
21
+
/// archive file's extension.
20
22
/// </summary>
21
23
/// <param name="directory">The directory whose contents should be compressed.</param>
22
-
/// <param name="archiveFile">The archive file to create. Its extension determines the compression format (e.g. <c>.zip</c>, <c>.tar.gz</c>, <c>.tar.bz2</c>).</param>
23
-
/// <param name="filter">An optional predicate used to filter which files are included in the archive. If <c>null</c>, all files are included.</param>
24
+
/// <param name="archiveFile">
25
+
/// The archive file to create. Its extension determines the compression format (e.g. <c>.zip</c>,
26
+
/// <c>.tar.gz</c>, <c>.tar.bz2</c>).
27
+
/// </param>
28
+
/// <param name="filter">
29
+
/// An optional predicate used to filter which files are included in the archive. If <c>null</c>, all files are
Assert.Fail($"Compressing a .tar.xz archive currently not supported. Archive file: '{Path.GetFileName(archiveFile)}'");
47
+
{
48
+
Assert.Fail(
49
+
$"Compressing a .tar.xz archive currently not supported. Archive file: '{Path.GetFileName(archiveFile)}'");
50
+
}
34
51
else
52
+
{
35
53
Assert.Fail($"Unknown archive extension for archive '{Path.GetFileName(archiveFile)}'");
54
+
}
36
55
}
37
56
38
57
/// <summary>
39
-
/// Uncompresses <paramref name="archiveFile"/> into <paramref name="directory"/>, choosing the decompression format based on the archive file's extension.
58
+
/// Uncompresses <paramref name="archiveFile" /> into <paramref name="directory" />, choosing the decompression format based on
59
+
/// the archive file's extension.
40
60
/// </summary>
41
-
/// <param name="archiveFile">The archive file to extract. Its extension determines the decompression format (e.g. <c>.zip</c>, <c>.tar.gz</c>, <c>.tar.bz2</c>, <c>.tar.xz</c>).</param>
61
+
/// <param name="archiveFile">
62
+
/// The archive file to extract. Its extension determines the decompression format (e.g. <c>.zip</c>,
/// Compresses the given <paramref name="files"/> into a tar archive at <paramref name="archiveFile"/>, wrapping the underlying file stream with the compression stream produced by <paramref name="outputStreamFactory"/>.
264
+
/// Compresses the given <paramref name="files" /> into a tar archive at <paramref name="archiveFile" />, wrapping the underlying
265
+
/// file stream with the compression stream produced by <paramref name="outputStreamFactory" />.
230
266
/// </summary>
231
267
/// <param name="baseDirectory">The base directory used to compute the relative entry names of the archived files.</param>
232
268
/// <param name="archiveFile">The archive file to create.</param>
233
269
/// <param name="files">The files to add to the archive.</param>
234
-
/// <param name="fileMode">The <see cref="FileMode"/> used to open the archive file.</param>
270
+
/// <param name="fileMode">The <see cref="FileMode"/> used to open the archive file.</param>
235
271
/// <param name="outputStreamFactory">A factory that wraps the raw archive file stream with the desired compression stream.</param>
/// Extracts the contents of a tar archive at <paramref name="archiveFile"/> into <paramref name="directory"/>, wrapping the underlying file stream with the decompression stream produced by <paramref name="inputStreamFactory"/>.
297
+
/// Extracts the contents of a tar archive at <paramref name="archiveFile" /> into <paramref name="directory" />, wrapping the
298
+
/// underlying file stream with the decompression stream produced by <paramref name="inputStreamFactory" />.
262
299
/// </summary>
263
300
/// <param name="archiveFile">The archive file to extract.</param>
264
301
/// <param name="directory">The directory into which the archive's contents are extracted.</param>
265
302
/// <param name="inputStreamFactory">A factory that wraps the raw archive file stream with the desired decompression stream.</param>
0 commit comments