Exemple #1
0
        public virtual void ToXml(XmlNode node)
        {
            XmlDocument  doc = node.OwnerDocument;
            XmlAttribute at;

            XmlElement el = doc.CreateElement("Id");

            el.InnerText = this.id;
            node.AppendChild(el);

            el = doc.CreateElement("TextureArea");
            node.AppendChild(el);

            StructXml.RectangleToXml(this.textureArea, el);

            el           = doc.CreateElement("Picture");
            el.InnerText = this.picture;
            node.AppendChild(el);

            el = doc.CreateElement("Location");
            node.AppendChild(el);

            StructXml.PointToXml(this.location, el);

            el = doc.CreateElement("Buttons");
            node.AppendChild(el);

            XmlElement el2;

            foreach (KeyValuePair <string, GuiButtonInfo> btn in this.buttons)
            {
                // ALTERNATIVE: use this to save the button info:
                // btn.ToXml(el2);
                // el2 = doc.CreateElement(btn.GetType().ToString());

                el2 = doc.CreateElement(btn.Key);
                el.AppendChild(el2);

                at       = doc.CreateAttribute("Template");
                at.Value = btn.Value.Template;
            }
        }
Exemple #2
0
        public virtual void ToXml(XmlNode node)
        {
            XmlDocument doc = node.OwnerDocument;

            XmlAttribute at = doc.CreateAttribute("Type");

            at.Value = this.GetType().ToString();
            node.Attributes.Append(at);

            XmlElement el = doc.CreateElement("Title");

            el.InnerText = title;
            node.AppendChild(el);

            el           = doc.CreateElement("Researched");
            el.InnerText = researched.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("CanResearch");
            el.InnerText = canResearch.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("ItemType");
            el.InnerText = type.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("Description");
            el.InnerText = this.description;
            node.AppendChild(el);

            el           = doc.CreateElement("BuildTime");
            el.InnerText = this.buildTime.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("BuildRank");
            el.InnerText = this.buildRank.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("ResearchRank");
            el.InnerText = this.researchRank.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("OrbitalOnly");
            el.InnerText = this.orbitalOnly.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("Picture");
            el.InnerText = this.picture;
            node.AppendChild(el);

            el = doc.CreateElement("TextureArea");
            node.AppendChild(el);

            StructXml.RectangleToXml(this.textureArea, el);

            XmlElement el2;

            el = doc.CreateElement("Resources");
            node.AppendChild(el);

            for (int i = 0; i < this.resources.Count; i++)
            {
                el2 = doc.CreateElement("Resource");
                el.AppendChild(el2);

                this.resources[i].ToXml(el2);
            }

            el           = doc.CreateElement("Mass");
            el.InnerText = this.mass.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("ResearchPointsNeeded");
            el.InnerText = this.researchPointsNeeded.ToString();
            node.AppendChild(el);
        }
Exemple #3
0
        public void ToXml(XmlNode node)
        {
            XmlDocument doc = node.OwnerDocument;

            XmlElement   el;
            XmlAttribute at;

//			el = doc.CreateElement("GuiMenuId");
//			el.InnerText = GuiMenuId;
//			node.AppendChild(el);

            el           = doc.CreateElement("Text");
            el.InnerText = Text;
            node.AppendChild(el);

            el           = doc.CreateElement("Font");
            el.InnerText = Font;
            node.AppendChild(el);

            el           = doc.CreateElement("ForeColor");
            el.InnerText = StructXml.ColorToXml(ForeColor);
            node.AppendChild(el);

            el           = doc.CreateElement("TextFormat");
            el.InnerText = TextFormat.ToString();
            node.AppendChild(el);

            el = doc.CreateElement("ButtonRect");
            node.AppendChild(el);

            StructXml.RectangleToXml(this.ButtonRect, el);

            el           = doc.CreateElement("Tooltip");
            el.InnerText = Tooltip;
            node.AppendChild(el);

            el = doc.CreateElement("Params");
            node.AppendChild(el);

            XmlElement el2;

            foreach (KeyValuePair <string, GuiButtonParam> par in Params)
            {
                if (par.Value != null)
                {
                    el2      = doc.CreateElement(par.Key);
                    at       = doc.CreateAttribute("Type");
                    at.Value = par.Value.GetType().ToString();
                    el2.Attributes.Append(at);
                    el.AppendChild(el2);

                    par.Value.ToXml(el2);
                }
            }

            el           = doc.CreateElement("Picture");
            el.InnerText = Picture;
            node.AppendChild(el);

            el           = doc.CreateElement("PictureColor");
            el.InnerText = StructXml.ColorToXml(PictureColor);
            node.AppendChild(el);

            el           = doc.CreateElement("Enabled");
            el.InnerText = Enabled.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("AnimationFrames");
            el.InnerText = AnimationFrames.ToString();
            node.AppendChild(el);

            el           = doc.CreateElement("AnimationTime");
            el.InnerText = AnimationTime.ToString();
            node.AppendChild(el);
        }