Exemple #1
0
        public virtual void SaveToXML(XmlElement objSystem)
        {
            var xeStar = objSystem.OwnerDocument.CreateElement("Star");

            objSystem.AppendChild(xeStar);
            Common.CreateTextNode(xeStar, "Type", StarType.ToString());
            Common.CreateTextNode(xeStar, "LumClass", LumClass.ToString());
            Common.CreateTextNode(xeStar, "DecClass", DecClass.ToString());
            Common.CreateTextNode(xeStar, "StellarMass", StellarMass.ToString());
            Common.CreateTextNode(xeStar, "Luminosity", Luminosity.ToString());
            Common.CreateTextNode(xeStar, "NumOrbits", NumOrbits.ToString());
            Common.CreateTextNode(xeStar, "HZone", HZone.ToString());
            Common.CreateTextNode(xeStar, "TypeRoll", TypeRoll.ToString());
            Common.CreateTextNode(xeStar, "ClassRoll", ClassRoll.ToString());
            Common.CreateTextNode(xeStar, "NumCompanions", NumCompanions.ToString());
            Common.CreateTextNode(xeStar, "Name", Name.ToString());

            foreach (var orbit in Orbits)
            {
                orbit.SaveToXML(xeStar);
            }

            var xeStars = objSystem.OwnerDocument.CreateElement("Companions");

            xeStar.AppendChild(xeStars);

            foreach (var companion in Companions)
            {
                companion.SaveToXML(xeStars);
            }
        }
        public override void SaveToXML(XmlElement objStar)
        {
            var xeStar = objStar.OwnerDocument.CreateElement("Star");

            objStar.AppendChild(xeStar);

            // Companion specific attributes
            Common.CreateTextNode(xeStar, "OrbitNum", OrbitNum.ToString());
            Common.CreateTextNode(xeStar, "Range", Range.ToString());
            Common.CreateTextNode(xeStar, "SysNat", SysNat.ToString());

            // Common attributes
            Common.CreateTextNode(xeStar, "Type", StarType.ToString());
            Common.CreateTextNode(xeStar, "LumClass", LumClass.ToString());
            Common.CreateTextNode(xeStar, "DecClass", DecClass.ToString());
            Common.CreateTextNode(xeStar, "StellarMass", StellarMass.ToString());
            Common.CreateTextNode(xeStar, "Luminosity", Luminosity.ToString());
            Common.CreateTextNode(xeStar, "NumOrbits", NumOrbits.ToString());
            Common.CreateTextNode(xeStar, "HZone", HZone.ToString());
            Common.CreateTextNode(xeStar, "TypeRoll", TypeRoll.ToString());
            Common.CreateTextNode(xeStar, "ClassRoll", ClassRoll.ToString());
            Common.CreateTextNode(xeStar, "NumCompanions", NumCompanions.ToString());
            Common.CreateTextNode(xeStar, "Name", Name.ToString());

            foreach (var orbit in Orbits)
            {
                orbit.SaveToXML(xeStar);
            }

            var xeStars = objStar.OwnerDocument.CreateElement("Companions");

            xeStar.AppendChild(xeStars);

            foreach (var companion in Companions)
            {
                companion.SaveToXML(xeStars);
            }
        }