aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs')
-rw-r--r--src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs67
1 files changed, 36 insertions, 31 deletions
diff --git a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
index 0855997c..ac593152 100644
--- a/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
+++ b/src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs
@@ -61,6 +61,42 @@ namespace WixToolset.Data.WindowsInstaller
61 public TableIndexedCollection Tables { get; private set; } 61 public TableIndexedCollection Tables { get; private set; }
62 62
63 /// <summary> 63 /// <summary>
64 /// Ensure this output contains a particular table.
65 /// </summary>
66 /// <param name="tableDefinition">Definition of the table that should exist.</param>
67 /// <param name="section">Optional section to use for the table. If one is not provided, the entry section will be used.</param>
68 /// <returns>The table in this output.</returns>
69 public Table EnsureTable(TableDefinition tableDefinition)
70 {
71 if (!this.Tables.TryGetTable(tableDefinition.Name, out var table))
72 {
73 table = new Table(tableDefinition);
74 this.Tables.Add(table);
75 }
76
77 return table;
78 }
79
80 /// <summary>
81 /// Saves an output to a <c>WixOutput</c> container.
82 /// </summary>
83 /// <param name="wixout">Container to save to.</param>
84 public void Save(WixOutput wixout)
85 {
86 using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName)))
87 {
88 writer.WriteStartDocument();
89 this.Write(writer);
90 writer.WriteEndDocument();
91 }
92 }
93
94 /// <summary>
95 /// Gets table by name.
96 /// </summary>
97 public bool TryGetTable(string tableName, out Table table) => this.Tables.TryGetTable(tableName, out table);
98
99 /// <summary>
64 /// Loads an output from a path on disk. 100 /// Loads an output from a path on disk.
65 /// </summary> 101 /// </summary>
66 /// <param name="path">Path to output file saved on disk.</param> 102 /// <param name="path">Path to output file saved on disk.</param>
@@ -85,20 +121,6 @@ namespace WixToolset.Data.WindowsInstaller
85 } 121 }
86 122
87 /// <summary> 123 /// <summary>
88 /// Saves an output to a <c>WixOutput</c> container.
89 /// </summary>
90 /// <param name="wixout">Container to save to.</param>
91 public void Save(WixOutput wixout)
92 {
93 using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName)))
94 {
95 writer.WriteStartDocument();
96 this.Write(writer);
97 writer.WriteEndDocument();
98 }
99 }
100
101 /// <summary>
102 /// Processes an XmlReader and builds up the output object. 124 /// Processes an XmlReader and builds up the output object.
103 /// </summary> 125 /// </summary>
104 /// <param name="reader">Reader to get data from.</param> 126 /// <param name="reader">Reader to get data from.</param>
@@ -207,23 +229,6 @@ namespace WixToolset.Data.WindowsInstaller
207 } 229 }
208 230
209 /// <summary> 231 /// <summary>
210 /// Ensure this output contains a particular table.
211 /// </summary>
212 /// <param name="tableDefinition">Definition of the table that should exist.</param>
213 /// <param name="section">Optional section to use for the table. If one is not provided, the entry section will be used.</param>
214 /// <returns>The table in this output.</returns>
215 public Table EnsureTable(TableDefinition tableDefinition)
216 {
217 if (!this.Tables.TryGetTable(tableDefinition.Name, out var table))
218 {
219 table = new Table(tableDefinition);
220 this.Tables.Add(table);
221 }
222
223 return table;
224 }
225
226 /// <summary>
227 /// Persists an output in an XML format. 232 /// Persists an output in an XML format.
228 /// </summary> 233 /// </summary>
229 /// <param name="writer">XmlWriter where the Output should persist itself as XML.</param> 234 /// <param name="writer">XmlWriter where the Output should persist itself as XML.</param>