From df8f367c7bc515be7f5652338f1e64e6a9e6acd8 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 5 Feb 2020 14:36:35 -0800 Subject: Code cleanup --- .../WindowsInstaller/WindowsInstallerData.cs | 67 ++++++++++++---------- 1 file changed, 36 insertions(+), 31 deletions(-) (limited to 'src/WixToolset.Data/WindowsInstaller/WindowsInstallerData.cs') 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 @@ -60,6 +60,42 @@ namespace WixToolset.Data.WindowsInstaller /// Collection of tables. public TableIndexedCollection Tables { get; private set; } + /// + /// Ensure this output contains a particular table. + /// + /// Definition of the table that should exist. + /// Optional section to use for the table. If one is not provided, the entry section will be used. + /// The table in this output. + public Table EnsureTable(TableDefinition tableDefinition) + { + if (!this.Tables.TryGetTable(tableDefinition.Name, out var table)) + { + table = new Table(tableDefinition); + this.Tables.Add(table); + } + + return table; + } + + /// + /// Saves an output to a WixOutput container. + /// + /// Container to save to. + public void Save(WixOutput wixout) + { + using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName))) + { + writer.WriteStartDocument(); + this.Write(writer); + writer.WriteEndDocument(); + } + } + + /// + /// Gets table by name. + /// + public bool TryGetTable(string tableName, out Table table) => this.Tables.TryGetTable(tableName, out table); + /// /// Loads an output from a path on disk. /// @@ -84,20 +120,6 @@ namespace WixToolset.Data.WindowsInstaller } } - /// - /// Saves an output to a WixOutput container. - /// - /// Container to save to. - public void Save(WixOutput wixout) - { - using (var writer = XmlWriter.Create(wixout.CreateDataStream(WixOutputStreamName))) - { - writer.WriteStartDocument(); - this.Write(writer); - writer.WriteEndDocument(); - } - } - /// /// Processes an XmlReader and builds up the output object. /// @@ -206,23 +228,6 @@ namespace WixToolset.Data.WindowsInstaller return output; } - /// - /// Ensure this output contains a particular table. - /// - /// Definition of the table that should exist. - /// Optional section to use for the table. If one is not provided, the entry section will be used. - /// The table in this output. - public Table EnsureTable(TableDefinition tableDefinition) - { - if (!this.Tables.TryGetTable(tableDefinition.Name, out var table)) - { - table = new Table(tableDefinition); - this.Tables.Add(table); - } - - return table; - } - /// /// Persists an output in an XML format. /// -- cgit v1.2.3-55-g6feb