/// <summary> /// Creates a SubStorage from the XmlReader. /// </summary> /// <param name="reader">Reader to get data from.</param> /// <param name="tableDefinitions">Table definitions to use for strongly-typed rows.</param> /// <returns>New SubStorage object.</returns> internal static SubStorage Read(XmlReader reader, TableDefinitionCollection tableDefinitions) { if (reader.LocalName != "subStorage") { throw new XmlException(); } WindowsInstallerData data = null; string name = null; var empty = reader.IsEmptyElement; while (reader.MoveToNextAttribute()) { switch (reader.LocalName) { case "name": name = reader.Value; break; } } if (!empty) { var done = false; while (!done && reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.LocalName) { case WindowsInstallerData.XmlElementName: data = WindowsInstallerData.Read(reader, tableDefinitions, true); break; default: throw new XmlException(); } break; case XmlNodeType.EndElement: done = true; break; } } if (!done) { throw new XmlException(); } } return(new SubStorage(name, data)); }
/// <summary> /// Loads an output from a WixOutput object. /// </summary> /// <param name="wixOutput">WixOutput object.</param> /// <param name="tableDefinitions">Table definitions to use for creating strongly-typed rows.</param> /// <param name="suppressVersionCheck">Suppresses wix.dll version mismatch check.</param> /// <returns>Output object.</returns> public static WindowsInstallerData Load(WixOutput wixOutput, TableDefinitionCollection tableDefinitions, bool suppressVersionCheck = false) { using (var stream = wixOutput.GetDataStream(WixOutputStreamName)) using (var reader = XmlReader.Create(stream, null, wixOutput.Uri.AbsoluteUri)) { try { reader.MoveToContent(); return(WindowsInstallerData.Read(reader, tableDefinitions, suppressVersionCheck)); } catch (XmlException xe) { throw new WixCorruptFileException(wixOutput.Uri.AbsoluteUri, "wixout", xe); } } }