/// <summary> /// Writes the data block to an XML document. /// This may add one or more nodes to the given parentNode. /// </summary> /// <param name="parentNode">XML node to add this data block to.</param> /// <param name="index">Optional index attribute.</param> public override void WriteXml(XmlNode parentNode) { SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName); writer.WriteHex("signature", signature); writer.Write("version", version); writer.Write("ref_data_start", refDataStart); writer.Write("unknown", unknown); SRXmlNodeWriter referenceDataWriter = new SRXmlNodeWriter(writer, "references"); for (int i = 0; i < referenceData.Count; i++) referenceDataWriter.Write("reference", referenceData[i], i + 1); }
/// <summary> /// Writes the data block to an XML document. /// </summary> /// <param name="parentNode">XML node to add this data block to.</param> /// <param name="index">Index within a sequence (starts at 0).</param> public override void WriteXml(XmlNode parentNode, int index) { try { SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName, index + 1); writer.Write("name", name != null ? name : ""); writer.WriteHex("handle", handleOffset); writer.WriteHex("parent_handle", parentHandleOffset); writer.WriteHex("object_type_hash", objectTypeHash); writer.Write("padding", padding); XmlNode propertiesNode = writer.CreateNode("properties"); int i = 0; foreach (SRZoneProperty property in propertyList) property.WriteXml(propertiesNode, i++); } catch (Exception e) { // Add context information for the error message if (index >= 0) e.Data[BlockName] = index + 1; throw; } }
/// <summary> /// Writes the section block to an XML document. /// </summary> /// <param name="parentNode">XML node to add this section to.</param> /// <param name="index">Index within a sequence (starts at 0).</param> public override void WriteXml(XmlNode parentNode, int index) { try { SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName, index + 1); writer.WriteHex("id", sectionID); if (HasDescription()) writer.Write("description", Description()); if (HasGPUData()) writer.Write("gpu_size", gpuSize); if (cpuData != null) cpuData.WriteXml(writer.CreateNode("cpu_data")); } catch (Exception e) { // Add context information for the error message if (index >= 0) e.Data[BlockName] = index + 1; throw; } }
/// <summary> /// Writes the data block to an XML document. /// This may add one or more nodes to the given parentNode. /// </summary> /// <param name="parentNode">XML node to add this data block to.</param> /// <param name="index">Optional index attribute.</param> public override void WriteXml(XmlNode parentNode) { SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName); writer.Write("signature", signature); writer.Write("version", version); fileReferenceOffset.WriteXml(writer.Node, "file_reference_offset"); writer.WriteHex("file_references_ptr", fileReferencesPtr); writer.Write("zone_type", zoneType); string zoneTypeName = (zoneType < WorldZoneTypeNames.Length) ? WorldZoneTypeNames[zoneType] : "unknown"; writer.Write("zone_type_description", zoneTypeName); // informational only SRXmlNodeWriter referenceDataWriter = new SRXmlNodeWriter(writer, "mesh_file_references"); for (int i = 0; i < references.Count; i++) references[i].WriteXml(referenceDataWriter.Node, i); }
/// <summary> /// Writes the data block to an XML document. /// This may add one or more nodes to the given parentNode. /// </summary> /// <param name="parentNode">XML node to add this data block to.</param> /// <param name="index">Optional index attribute.</param> public override void WriteXml(XmlNode parentNode) { int index; SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName); writer.WriteHex("signature", signature); writer.Write("version", version); writer.WriteHex("flags", flags); writer.WriteHex("handle_list_pointer", handleListPointer); writer.WriteHex("object_data_pointer", objectDataPointer); writer.Write("object_data_size", objectDataSize); SRXmlNodeWriter handleWriter = new SRXmlNodeWriter(writer, "handles"); index = 0; foreach (UInt64 handle in handleList) handleWriter.WriteHex("handle", handle, ++index); XmlNode objectsNode = writer.CreateNode("objects"); index = 0; foreach (SRZoneObject srObject in objectList) srObject.WriteXml(objectsNode, index++); }
/// <summary> /// Writes the data block to an XML document. /// </summary> /// <param name="parentNode">XML node to add this data block to.</param> /// <param name="index">Index within a sequence (starts at 0).</param> public override void WriteXml(XmlNode parentNode, int index) { try { SRXmlNodeWriter writer = new SRXmlNodeWriter(parentNode, XmlTagName, index + 1); writer.Write("type", Type); string typeName = (Type < PropertyTypeNames.Length) ? PropertyTypeNames[Type] : "unknown"; writer.Write("type_description", typeName); writer.WriteHex("name_crc", nameCrc); WriteXmlData(writer.CreateNode("value")); if (paddingData != null) paddingData.WriteXml(writer.CreateNode("padding")); } catch (Exception e) { // Add context information for the error message if (index >= 0) e.Data[BlockName] = index + 1; throw; } }