Ejemplo 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)
        {
            if (!AllowPrint)
            {
                return;
            }
            objWriter.WriteStartElement("quality");
            objWriter.WriteElementString("name", DisplayNameShort(strLanguageToPrint));
            objWriter.WriteElementString("fullname", DisplayName(strLanguageToPrint));
            objWriter.WriteElementString("formattedname", FormattedDisplayName(objCulture, strLanguageToPrint));
            objWriter.WriteElementString("extra", LanguageManager.TranslateExtra(Extra, strLanguageToPrint));
            objWriter.WriteElementString("lp", LP.ToString(objCulture));
            objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            string strLifestyleQualityType = Type.ToString();

            if (strLanguageToPrint != GlobalOptions.DefaultLanguage)
            {
                XmlNode objNode = XmlManager.Load("lifestyles.xml", strLanguageToPrint).SelectSingleNode("/chummer/categories/category[. = \"" + strLifestyleQualityType + "\"]");
                strLifestyleQualityType = objNode?.Attributes?["translate"]?.InnerText ?? strLifestyleQualityType;
            }
            objWriter.WriteElementString("lifestylequalitytype", strLifestyleQualityType);
            objWriter.WriteElementString("lifestylequalitytype_english", Type.ToString());
            objWriter.WriteElementString("lifestylequalitysource", OriginSource.ToString());
            objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(Source, strLanguageToPrint));
            objWriter.WriteElementString("page", Page(strLanguageToPrint));
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", Notes);
            }
            objWriter.WriteEndElement();
        }
Ejemplo n.º 2
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)
        {
            if (!AllowPrint || objWriter == null)
            {
                return;
            }
            objWriter.WriteStartElement("quality");
            objWriter.WriteElementString("guid", InternalId);
            objWriter.WriteElementString("sourceid", SourceIDString);
            objWriter.WriteElementString("name", DisplayNameShort(strLanguageToPrint));
            objWriter.WriteElementString("fullname", DisplayName(strLanguageToPrint));
            objWriter.WriteElementString("formattedname", FormattedDisplayName(objCulture, strLanguageToPrint));
            objWriter.WriteElementString("extra", _objCharacter.TranslateExtra(Extra, strLanguageToPrint));
            objWriter.WriteElementString("lp", LP.ToString(objCulture));
            objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            var strLifestyleQualityType = Type.ToString();

            if (strLanguageToPrint != GlobalOptions.DefaultLanguage)
            {
                XPathNavigator objNode = _objCharacter.LoadDataXPath("lifestyles.xml", strLanguageToPrint)
                                         .SelectSingleNode("/chummer/categories/category[. = " + strLifestyleQualityType.CleanXPath() + "]");
                strLifestyleQualityType = objNode?.SelectSingleNode("@translate")?.Value ?? strLifestyleQualityType;
            }

            objWriter.WriteElementString("lifestylequalitytype", strLifestyleQualityType);
            objWriter.WriteElementString("lifestylequalitytype_english", Type.ToString());
            objWriter.WriteElementString("lifestylequalitysource", OriginSource.ToString());
            objWriter.WriteElementString("source", _objCharacter.LanguageBookShort(Source, strLanguageToPrint));
            objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint));
            if (GlobalOptions.PrintNotes)
            {
                objWriter.WriteElementString("notes", Notes);
            }
            objWriter.WriteEndElement();
        }
Ejemplo n.º 3
0
 public dynamic GetData(LP pref)
 {
     if (data.d.ContainsKey(pref))
     {
         return(Convert.ChangeType(data[pref], data[pref].GetType()));
     }
     else
     {
         throw new NullReferenceException("There is no such value named as " + pref.ToString() + " in data.");
     }
 }
Ejemplo n.º 4
0
        private void GetPosition()
        {
            string propertyName  = "phiPosition";
            string propertyName2 = "thetaPosition";
            Object LP;
            Object LP2;
            string SLP = "Phi: ";

            LP   = m_missileLauncher.GetType().GetProperty(propertyName).GetValue(m_missileLauncher, null);
            SLP += LP.ToString();
            LP2  = m_missileLauncher.GetType().GetProperty(propertyName2).GetValue(m_missileLauncher, null);
            SLP += " Theta: ";      //"Phi: (phiPostion value) Theta: "
            SLP += LP2.ToString();  //"Phi: (phiPostion value) Theta: (thetaPosition value)"
            LauncherPosition = SLP; //will display Phi: (phiPostion value) Theta: (thetaPosition value)
        }