コード例 #1
0
ファイル: clsUnique.cs プロジェクト: Vanatrix/chummer5a
		/// <summary>
		/// Load the Attribute from the XmlNode.
		/// </summary>
		/// <param name="objNode">XmlNode to load.</param>
		public void Load(XmlNode objNode)
		{
			string strId;
			if (objNode.TryGetField("id", out strId))
			{
				Id = Guid.Parse(strId);
			}
			_strName = objNode["name"].InnerText;
			_strSkillGroup = objNode["skillgroup"].InnerText;
			_strSkillCategory = objNode["skillcategory"].InnerText;
			_blnIsGrouped = Convert.ToBoolean(objNode["grouped"].InnerText);
            _blnDefault = Convert.ToBoolean(objNode["default"].InnerText);
			_intRating = Convert.ToInt32(objNode["rating"].InnerText);
			bool basefail = false;
            try
            {
                _intBase = Convert.ToInt32(objNode["base"].InnerText);
            }
            catch
            {
                _intBase = _intRating;
	            basefail = true;
            }
            try
            {
                _intKarma = Convert.ToInt32(objNode["karma"].InnerText);
            }
            catch
            {
                _intKarma = 0;
            }

			if (!basefail)
			{
				if (_intRating != _intKarma + _intBase)
				{
					_intBase = _intRating - _intKarma;
				}
			}

            _intFreeLevels = Convert.ToInt32(objNode["freelevels"].InnerText);
            _intRatingMaximum = Convert.ToInt32(objNode["ratingmax"].InnerText);
			_blnKnowledgeSkill = Convert.ToBoolean(objNode["knowledge"].InnerText);
			try
			{
				_blnExoticSkill = Convert.ToBoolean(objNode["exotic"].InnerText);
			}
			catch
			{
			}
            try
            {
                _blnBuyWithKarma = Convert.ToBoolean(objNode["buywithkarma"].InnerText);
            }
            catch
            {
            }
            if (objNode["spec"].InnerText.Contains("Hold-Outs"))
				objNode["spec"].InnerText = "Holdouts";
			_strSkillSpec = objNode["spec"].InnerText;

            if (_strSkillSpec != "")
            {
                SkillSpecialization objSpec = new SkillSpecialization(_strSkillSpec);
                _lstSpecializations.Add(objSpec);
                _strSkillSpec = "";
            }

			_blnAllowDelete = Convert.ToBoolean(objNode["allowdelete"].InnerText);
			_strAttribute = objNode["attribute"].InnerText;
            if (objNode.InnerXml.Contains("skillspecializations"))
            {
                XmlNodeList nodSpecializations = objNode.SelectNodes("skillspecializations/skillspecialization");
                foreach (XmlNode nodSpecialization in nodSpecializations)
                {
                    SkillSpecialization objSpec = new SkillSpecialization("");
                    objSpec.Load(nodSpecialization);
                    _lstSpecializations.Add(objSpec);
                }
            }
            try
			{
				_strSource = objNode["source"].InnerText;
				_strPage = objNode["page"].InnerText;
			}
			catch
			{
			}

			if (objNode["folded"] != null)
			{
				foreach (XmlNode foldNode in objNode["folded"].ChildNodes)
				{
					Skill s = new Skill(_objCharacter);
					s.Load(foldNode);

					_fold.Add(s);
				}
			}
		}
コード例 #2
0
ファイル: clsUnique.cs プロジェクト: kingcortez905/chummer5
        /// <summary>
        /// Load the Attribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            _strName = objNode["name"].InnerText;
            _strSkillGroup = objNode["skillgroup"].InnerText;
            _strSkillCategory = objNode["skillcategory"].InnerText;
            _blnIsGrouped = Convert.ToBoolean(objNode["grouped"].InnerText);
            _blnDefault = Convert.ToBoolean(objNode["default"].InnerText);
            _intRating = Convert.ToInt32(objNode["rating"].InnerText);
            try
            {
                _intBase = Convert.ToInt32(objNode["base"].InnerText);
            }
            catch
            {
                _intBase = _intRating;
            }
            try
            {
                _intKarma = Convert.ToInt32(objNode["karma"].InnerText);
            }
            catch
            {
                _intKarma = 0;
            }
            _intFreeLevels = Convert.ToInt32(objNode["freelevels"].InnerText);
            _intRatingMaximum = Convert.ToInt32(objNode["ratingmax"].InnerText);
            _blnKnowledgeSkill = Convert.ToBoolean(objNode["knowledge"].InnerText);
            try
            {
                _blnExoticSkill = Convert.ToBoolean(objNode["exotic"].InnerText);
            }
            catch
            {
            }
            try
            {
                _blnBuyWithKarma = Convert.ToBoolean(objNode["buywithkarma"].InnerText);
            }
            catch
            {
            }
            if (objNode["spec"].InnerText.Contains("Hold-Outs"))
                objNode["spec"].InnerText = "Holdouts";
            _strSkillSpec = objNode["spec"].InnerText;

            if (_strSkillSpec != "")
            {
                SkillSpecialization objSpec = new SkillSpecialization(_strSkillSpec);
                _lstSpecializations.Add(objSpec);
                _strSkillSpec = "";
            }

            _blnAllowDelete = Convert.ToBoolean(objNode["allowdelete"].InnerText);
            _strAttribute = objNode["attribute"].InnerText;
            if (objNode.InnerXml.Contains("skillspecializations"))
            {
                XmlNodeList nodSpecializations = objNode.SelectNodes("skillspecializations/skillspecialization");
                foreach (XmlNode nodSpecialization in nodSpecializations)
                {
                    SkillSpecialization objSpec = new SkillSpecialization("");
                    objSpec.Load(nodSpecialization);
                    _lstSpecializations.Add(objSpec);
                }
            }
            try
            {
                _strSource = objNode["source"].InnerText;
                _strPage = objNode["page"].InnerText;
            }
            catch
            {
            }
        }