Exemplo n.º 1
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print.</param>
        /// <param name="strLanguageToPrint">Language in which to print</param>
        public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint)
        {
            objWriter.WriteStartElement("lifestyle");
            objWriter.WriteElementString("name", CustomName);
            objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("dice", Dice.ToString(objCulture));
            objWriter.WriteElementString("multiplier", Multiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("months", Increments.ToString(objCulture));
            objWriter.WriteElementString("purchased", Purchased.ToString());
            objWriter.WriteElementString("type", StyleType.ToString());
            objWriter.WriteElementString("increment", IncrementType.ToString());
            objWriter.WriteElementString("sourceid", SourceID.ToString("D"));
            objWriter.WriteElementString("bonuslp", BonusLP.ToString(objCulture));
            string strBaseLifestyle = string.Empty;

            // Retrieve the Advanced Lifestyle information if applicable.
            if (!string.IsNullOrEmpty(BaseLifestyle))
            {
                XmlNode objXmlAspect = GetNode();
                if (objXmlAspect != null)
                {
                    strBaseLifestyle = objXmlAspect["translate"]?.InnerText ?? objXmlAspect["name"]?.InnerText ?? strBaseLifestyle;
                }
            }

            objWriter.WriteElementString("baselifestyle", strBaseLifestyle);
            objWriter.WriteElementString("trustfund", TrustFund.ToString());
            objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(Source, strLanguageToPrint));
            objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint));
            objWriter.WriteStartElement("qualities");

            // Retrieve the Qualities for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in LifestyleQualities)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            // Retrieve the free Grids for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in FreeGrids)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            objWriter.WriteEndElement();
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", Notes);
            }
            objWriter.WriteEndElement();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        public void Print(XmlTextWriter objWriter, CultureInfo objCulture)
        {
            objWriter.WriteStartElement("lifestyle");
            objWriter.WriteElementString("name", Name);
            objWriter.WriteElementString("cost", _decCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("dice", _intDice.ToString(objCulture));
            objWriter.WriteElementString("multiplier", _decMultiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("months", _intMonths.ToString(objCulture));
            objWriter.WriteElementString("purchased", _blnPurchased.ToString());
            objWriter.WriteElementString("type", _objType.ToString());
            objWriter.WriteElementString("sourceid", SourceID.ToString());
            string strBaseLifestyle = string.Empty;

            // Retrieve the Advanced Lifestyle information if applicable.
            if (!string.IsNullOrEmpty(_strBaseLifestyle))
            {
                XmlNode objXmlAspect = MyXmlNode;
                if (objXmlAspect != null)
                {
                    if (objXmlAspect["translate"] != null)
                    {
                        strBaseLifestyle = objXmlAspect["translate"].InnerText;
                    }
                    else if (objXmlAspect["name"] != null)
                    {
                        strBaseLifestyle = objXmlAspect["name"].InnerText;
                    }
                }
            }

            objWriter.WriteElementString("baselifestyle", strBaseLifestyle);
            objWriter.WriteElementString("trustfund", _blnTrustFund.ToString());
            objWriter.WriteElementString("source", _objCharacter.Options.LanguageBookShort(_strSource));
            objWriter.WriteElementString("page", Page);
            objWriter.WriteStartElement("qualities");

            // Retrieve the Qualities for the Advanced Lifestyle if applicable.
            if (_lstLifestyleQualities.Count > 0)
            {
                foreach (LifestyleQuality objQuality in _lstLifestyleQualities)
                {
                    objQuality.Print(objWriter, objCulture);
                }
            }
            // Retrieve the free Grids for the Advanced Lifestyle if applicable.
            if (FreeGrids.Count > 0)
            {
                foreach (LifestyleQuality objQuality in FreeGrids)
                {
                    string strThisQuality = objQuality.DisplayName;
                    objWriter.WriteElementString("quality", strThisQuality);
                }
            }
            objWriter.WriteEndElement();
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", _strNotes);
            }
            objWriter.WriteEndElement();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        public void Print(XmlTextWriter objWriter)
        {
            objWriter.WriteStartElement("lifestyle");
            objWriter.WriteElementString("name", DisplayNameShort);
            objWriter.WriteElementString("cost", _intCost.ToString());
            objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString());
            objWriter.WriteElementString("totalcost", TotalCost.ToString());
            objWriter.WriteElementString("dice", _intDice.ToString());
            objWriter.WriteElementString("multiplier", _intMultiplier.ToString());
            objWriter.WriteElementString("months", _intMonths.ToString());
            objWriter.WriteElementString("purchased", _blnPurchased.ToString());
            objWriter.WriteElementString("lifestylename", _strLifestyleName);
            objWriter.WriteElementString("type", _objType.ToString());
            objWriter.WriteElementString("sourceid", SourceID.ToString());
            string strBaseLifestyle = string.Empty;

            // Retrieve the Advanced Lifestyle information if applicable.
            if (!string.IsNullOrEmpty(_strBaseLifestyle))
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");

                XmlNode objXmlAspect = objXmlDocument.SelectSingleNode("/chummer/lifestyles/lifestyle[id = \"" + SourceID + "\"]");
                if (objXmlAspect != null)
                {
                    if (objXmlAspect["translate"] != null)
                    {
                        strBaseLifestyle = objXmlAspect["translate"].InnerText;
                    }
                    else if (objXmlAspect["name"] != null)
                    {
                        strBaseLifestyle = objXmlAspect["name"].InnerText;
                    }
                }
            }

            objWriter.WriteElementString("baselifestyle", strBaseLifestyle);
            objWriter.WriteElementString("trustfund", _blnTrustFund.ToString());
            objWriter.WriteElementString("source", _objCharacter.Options.LanguageBookShort(_strSource));
            objWriter.WriteElementString("page", Page);
            objWriter.WriteStartElement("qualities");

            // Retrieve the Qualities for the Advanced Lifestyle if applicable.
            if (_lstLifestyleQualities.Count > 0)
            {
                foreach (LifestyleQuality objQuality in _lstLifestyleQualities)
                {
                    objQuality.Print(objWriter);
                }
            }
            // Retrieve the free Grids for the Advanced Lifestyle if applicable.
            if (FreeGrids.Count > 0)
            {
                foreach (LifestyleQuality objQuality in FreeGrids)
                {
                    string strThisQuality = objQuality.DisplayName;
                    objWriter.WriteElementString("quality", strThisQuality);
                }
            }
            objWriter.WriteEndElement();
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", _strNotes);
            }
            objWriter.WriteEndElement();
        }