public virtual void SaveAsXml(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null) { var schema = Header.FileSchema.Schemas.FirstOrDefault(); using (var xmlWriter = XmlWriter.Create(stream, xmlSettings)) { switch (SchemaVersion) { case XbimSchemaVersion.Ifc2X3: var writer3 = new IfcXmlWriter3(); writer3.Write(this, xmlWriter, GetXmlOrderedEntities(schema)); break; case XbimSchemaVersion.Ifc4: var writer4 = new XbimXmlWriter4(XbimXmlSettings.IFC4Add2); writer4.Write(this, xmlWriter, GetXmlOrderedEntities(schema)); break; default: if (xbimSettings == null) { Logger.LogWarning("No xbimsettings set. Defaulting to Ifc4 Add2"); xbimSettings = XbimXmlSettings.IFC4Add2; } var writer = new XbimXmlWriter4(xbimSettings); writer.Write(this, xmlWriter); break; } } }
public virtual void SaveAsXml(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null) { using (var xmlWriter = XmlWriter.Create(stream, xmlSettings)) { var schema = _entityFactory.SchemasIds.FirstOrDefault(); switch (schema) { case "IFC2X3": var writer3 = new IfcXmlWriter3(); writer3.Write(this, xmlWriter, GetXmlOrderedEntities(schema)); break; case "IFC4": var writer4 = new XbimXmlWriter4(configuration.IFC4Add1, XbimXmlSettings.IFC4Add1); writer4.Write(this, xmlWriter, GetXmlOrderedEntities(schema)); break; case "COBIE_EXPRESS": var writerCobie = new XbimXmlWriter4(configuration.COBieExpress, XbimXmlSettings.COBieExpress); writerCobie.Write(this, xmlWriter, GetXmlOrderedEntities(schema)); break; default: var writer = new XbimXmlWriter4(configuration, xbimSettings); writer.Write(this, xmlWriter); break; } xmlWriter.Close(); } }
public virtual void SaveAsXMLZip(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null) { using (var zipStream = new ZipArchive(stream, ZipArchiveMode.Update)) { var schema = EntityFactory.SchemasIds.FirstOrDefault(); var ext = schema != null && schema.StartsWith("IFC") ? ".ifcxml" : ".xml"; var newEntry = zipStream.CreateEntry($"data{ext}"); using (var writer = newEntry.Open()) { SaveAsXml(writer, xmlSettings, xbimSettings, configuration, progress); } } }
public virtual void SaveAsXMLZip(Stream stream, XmlWriterSettings xmlSettings, XbimXmlSettings xbimSettings = null, configuration configuration = null, ReportProgressDelegate progress = null) { using (var zipStream = new ZipOutputStream(stream)) { var schema = _entityFactory.SchemasIds.FirstOrDefault(); var ext = schema != null && schema.StartsWith("IFC") ? ".ifcxml" : ".xml"; var newEntry = new ZipEntry("data" + ext) { DateTime = DateTime.Now }; zipStream.PutNextEntry(newEntry); SaveAsXml(zipStream, xmlSettings, xbimSettings, configuration, progress); } }