aboutsummaryrefslogtreecommitdiff
path: root/src/dtf/WixToolset.Dtf.Compression.Cab/CabInfo.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dtf/WixToolset.Dtf.Compression.Cab/CabInfo.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/dtf/WixToolset.Dtf.Compression.Cab/CabInfo.cs b/src/dtf/WixToolset.Dtf.Compression.Cab/CabInfo.cs
new file mode 100644
index 00000000..969dcbef
--- /dev/null
+++ b/src/dtf/WixToolset.Dtf.Compression.Cab/CabInfo.cs
@@ -0,0 +1,82 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset.Dtf.Compression.Cab
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Runtime.Serialization;
8
9 /// <summary>
10 /// Object representing a cabinet file on disk; provides access to
11 /// file-based operations on the cabinet file.
12 /// </summary>
13 /// <remarks>
14 /// Generally, the methods on this class are much easier to use than the
15 /// stream-based interfaces provided by the <see cref="CabEngine"/> class.
16 /// </remarks>
17 [Serializable]
18 public class CabInfo : ArchiveInfo
19 {
20 /// <summary>
21 /// Creates a new CabinetInfo object representing a cabinet file in a specified path.
22 /// </summary>
23 /// <param name="path">The path to the cabinet file. When creating a cabinet file, this file does not
24 /// necessarily exist yet.</param>
25 public CabInfo(string path)
26 : base(path)
27 {
28 }
29
30 /// <summary>
31 /// Initializes a new instance of the CabinetInfo class with serialized data.
32 /// </summary>
33 /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
34 /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
35 protected CabInfo(SerializationInfo info, StreamingContext context)
36 : base(info, context)
37 {
38 }
39
40 /// <summary>
41 /// Creates a compression engine that does the low-level work for
42 /// this object.
43 /// </summary>
44 /// <returns>A new <see cref="CabEngine"/> instance.</returns>
45 /// <remarks>
46 /// Each instance will be <see cref="CompressionEngine.Dispose()"/>d
47 /// immediately after use.
48 /// </remarks>
49 protected override CompressionEngine CreateCompressionEngine()
50 {
51 return new CabEngine();
52 }
53
54 /// <summary>
55 /// Gets information about the files contained in the archive.
56 /// </summary>
57 /// <returns>A list of <see cref="CabFileInfo"/> objects, each
58 /// containing information about a file in the archive.</returns>
59 public new IList<CabFileInfo> GetFiles()
60 {
61 IList<ArchiveFileInfo> files = base.GetFiles();
62 List<CabFileInfo> cabFiles = new List<CabFileInfo>(files.Count);
63 foreach (CabFileInfo cabFile in files) cabFiles.Add(cabFile);
64 return cabFiles.AsReadOnly();
65 }
66
67 /// <summary>
68 /// Gets information about the certain files contained in the archive file.
69 /// </summary>
70 /// <param name="searchPattern">The search string, such as
71 /// &quot;*.txt&quot;.</param>
72 /// <returns>A list of <see cref="CabFileInfo"/> objects, each containing
73 /// information about a file in the archive.</returns>
74 public new IList<CabFileInfo> GetFiles(string searchPattern)
75 {
76 IList<ArchiveFileInfo> files = base.GetFiles(searchPattern);
77 List<CabFileInfo> cabFiles = new List<CabFileInfo>(files.Count);
78 foreach (CabFileInfo cabFile in files) cabFiles.Add(cabFile);
79 return cabFiles.AsReadOnly();
80 }
81 }
82}