public XElement WriteToXml() { var propertyRoot = new XElement("Property"); PropertyManager.WritePropertyInfoToXml(propertyRoot, Type, Size, NameHash, Name, TypeString); propertyRoot.Add(Data.ToXElement("Data")); return(propertyRoot); }
public XElement WriteToXml() { //Create object node HashGuesser.TryGuessHashString(ClassnameHash, out string className); var objectRoot = new XElement("ZoneObject", new XAttribute("Type", className)); var objectData = new XElement("Data"); objectRoot.Add(objectData); //Write 56 byte data block objectData.Add(new XAttribute("ClassnameHash", ClassnameHash)); objectData.Add(new XElement("Handle", Handle)); objectData.Add(Bmin.ToXElement("Bmin")); objectData.Add(Bmax.ToXElement("Bmax")); var flagsNode = new XElement("Flags", new XAttribute("Value", Flags)); flagsNode.Add(new XElement("Flag0", (Flags & (ushort)ZoneObjectFlags.Flag0) != 0)); flagsNode.Add(new XElement("Flag1", (Flags & (ushort)ZoneObjectFlags.Flag1) != 0)); flagsNode.Add(new XElement("Flag2", (Flags & (ushort)ZoneObjectFlags.Flag2) != 0)); flagsNode.Add(new XElement("Flag3", (Flags & (ushort)ZoneObjectFlags.Flag3) != 0)); flagsNode.Add(new XElement("Flag4", (Flags & (ushort)ZoneObjectFlags.Flag4) != 0)); flagsNode.Add(new XElement("Flag5", (Flags & (ushort)ZoneObjectFlags.Flag5) != 0)); flagsNode.Add(new XElement("Flag6", (Flags & (ushort)ZoneObjectFlags.Flag6) != 0)); flagsNode.Add(new XElement("Flag7", (Flags & (ushort)ZoneObjectFlags.Flag7) != 0)); flagsNode.Add(new XElement("Flag8", (Flags & (ushort)ZoneObjectFlags.Flag8) != 0)); flagsNode.Add(new XElement("Flag9", (Flags & (ushort)ZoneObjectFlags.Flag9) != 0)); flagsNode.Add(new XElement("Flag10", (Flags & (ushort)ZoneObjectFlags.Flag10) != 0)); flagsNode.Add(new XElement("Flag11", (Flags & (ushort)ZoneObjectFlags.Flag11) != 0)); flagsNode.Add(new XElement("Flag12", (Flags & (ushort)ZoneObjectFlags.Flag12) != 0)); flagsNode.Add(new XElement("Flag13", (Flags & (ushort)ZoneObjectFlags.Flag13) != 0)); flagsNode.Add(new XElement("Flag14", (Flags & (ushort)ZoneObjectFlags.Flag14) != 0)); flagsNode.Add(new XElement("Flag15", (Flags & (ushort)ZoneObjectFlags.Flag15) != 0)); objectData.Add(flagsNode); objectData.Add(new XAttribute("BlockSize", BlockSize)); objectData.Add(new XElement("Parent", Parent)); objectData.Add(new XElement("Sibling", Sibling)); objectData.Add(new XElement("Child", Child)); objectData.Add(new XElement("Num", Num)); objectData.Add(new XAttribute("NumProps", NumProps)); objectData.Add(new XAttribute("Size", Size)); var propertiesNode = new XElement("Properties"); objectRoot.Add(propertiesNode); //Write properties foreach (var property in Properties) { propertiesNode.Add(property.WriteToXml()); } //Return object node return(objectRoot); }
public XElement WriteToXml() { var propertyRoot = new XElement("Property"); PropertyManager.WritePropertyInfoToXml(propertyRoot, Type, Size, NameHash, "op", "op (orient + position)"); var data = new XElement("Data"); data.Add(Position.ToXElement("position")); data.Add(Orient.ToXElement("orient")); propertyRoot.Add(data); return(propertyRoot); }