コード例 #1
0
ファイル: StarIntel.cs プロジェクト: bangush/stars-nova
        /// <summary>
        /// Create an XmlElement representation of the star report for saving.
        /// </summary>
        /// <param name="xmldoc">The parent XmlDocument.</param>
        /// <returns>An XmlElement representation of the report.</returns>
        public new XmlElement ToXml(XmlDocument xmldoc)
        {
            XmlElement xmlelStarIntel = xmldoc.CreateElement("StarIntel");

            // include inherited Item properties
            xmlelStarIntel.AppendChild(base.ToXml(xmldoc));

            Global.SaveData(xmldoc, xmlelStarIntel, "Year", Year.ToString(System.Globalization.CultureInfo.InvariantCulture));

            xmlelStarIntel.AppendChild(MineralConcentration.ToXml(xmldoc, "MineralConcentration"));

            Global.SaveData(xmldoc, xmlelStarIntel, "Gravity", Gravity.ToString(System.Globalization.CultureInfo.InvariantCulture));
            Global.SaveData(xmldoc, xmlelStarIntel, "Radiation", Radiation.ToString(System.Globalization.CultureInfo.InvariantCulture));
            Global.SaveData(xmldoc, xmlelStarIntel, "Temperature", Temperature.ToString(System.Globalization.CultureInfo.InvariantCulture));

            Global.SaveData(xmldoc, xmlelStarIntel, "Colonists", Colonists.ToString(System.Globalization.CultureInfo.InvariantCulture));

            Global.SaveData(xmldoc, xmlelStarIntel, "HasFleetsInOrbit", HasFleetsInOrbit.ToString());

            if (Starbase != null)
            {
                Global.SaveData(xmldoc, xmlelStarIntel, "Starbase", Starbase.Key.ToString("X"));
            }

            return(xmlelStarIntel);
        }
コード例 #2
0
        public override string ToString()
        {
            string str = "\n";

            str += string.Format("{0} \t{1} \t{2} \n",
                                 StringExtensions.SpaceUppercaseLetters(Classification.ToString()),
                                 StringExtensions.SpaceUppercaseLetters(Age.ToString()),
                                 StringExtensions.SpaceUppercaseLetters(Radiation.ToString()));

            foreach (var body in CelestialBodies)
            {
                str += string.Format("{0}\n", body);
            }

            return(str);
        }