public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("Type", Type.ToString()); if (IsOpened != null) { writer.WriteAttributeString("IsOpen", IsOpened.ToString()); if (LockBlockX != null) { writer.WriteAttributeString("BlockX", LockBlockX.ToString()); writer.WriteAttributeString("BlockY", LockBlockY.ToString()); } else if (NumberOfDiamonds != null) { writer.WriteAttributeString("Diamonds", NumberOfDiamonds.ToString()); } else if (HasGoldenKey != null) { writer.WriteAttributeString("Golden", HasGoldenKey.ToString()); } else if (HasSilverKey != null) { writer.WriteAttributeString("Silver", HasSilverKey.ToString()); } } }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("Number", LvlNumber.ToString()); writer.WriteAttributeString("Name", Name); writer.WriteElementString("StartX", CharacterStartX.ToString()); writer.WriteElementString("StartY", CharacterStartY.ToString()); writer.WriteElementString("EndX", CharacterEndX.ToString()); writer.WriteElementString("EndY", CharacterEndY.ToString()); writer.WriteElementString("InLevel", NumberOfDiamonds.ToString()); writer.WriteElementString("Needed", NumberOfDiamondsNeeded.ToString()); writer.WriteStartElement("Floor"); foreach (FloorTile[] row in floor) { writer.WriteStartElement("Row"); foreach (FloorTile tile in row) { writer.WriteStartElement("FloorTile"); tile.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); } writer.WriteEndElement(); }