Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool Save(XmlWriter writer)
        {
            if (writer == null)
            {
                return(false);
            }


            writer.WriteStartElement(Tag);

            writer.WriteAttributeString("side", Side.ToString());
            writer.WriteAttributeString("reusable", Reusable.ToString());
            writer.WriteAttributeString("activateitem", NeededItem);
            writer.WriteAttributeString("consumeitem", ConsumeItem.ToString());
            writer.WriteAttributeString("picklock", LockLevel.ToString());
            writer.WriteAttributeString("activated", ActivatedDecoration.ToString());
            writer.WriteAttributeString("deactivated", DeactivatedDecoration.ToString());

            if (Scripts.Count > 0)
            {
                writer.WriteStartElement("scripts");
                foreach (WallSwitchScript script in Scripts)
                {
                    script.Save(writer);
                }
                writer.WriteEndElement();
            }


            base.Save(writer);

            writer.WriteEndElement();

            return(true);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        public override bool Save(XmlWriter writer)
        {
            if (writer == null)
            {
                return(false);
            }

            writer.WriteStartElement(XmlTag);

            if (ConsumeItem)
            {
                writer.WriteElementString("consume", ConsumeItem.ToString());
            }


            if (!string.IsNullOrEmpty(ItemName))
            {
                writer.WriteElementString("item", ItemName);
            }

            base.Save(writer);

            writer.WriteEndElement();
            return(true);
        }