当前位置: 首页>>代码示例>>C#>>正文


C# XmlNode.TryGetField方法代码示例

本文整理汇总了C#中System.Xml.XmlNode.TryGetField方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.TryGetField方法的具体用法?C# XmlNode.TryGetField怎么用?C# XmlNode.TryGetField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.TryGetField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

		/// <summary>
		/// Load the Attribute from the XmlNode.
		/// </summary>
		/// <param name="objNode">XmlNode to load.</param>
		public void Load(XmlNode objNode)
		{
			_strAbbrev = objNode["name"].InnerText;
			_intMetatypeMin = Convert.ToInt32(objNode["metatypemin"].InnerText);
			_intMetatypeMax = Convert.ToInt32(objNode["metatypemax"].InnerText);
			_intMetatypeAugMax = Convert.ToInt32(objNode["metatypeaugmax"].InnerText);
		    
            objNode.TryGetField("base", out _intBase);
		    objNode.TryGetField("karma", out _intKarma);
            
            Value = Convert.ToInt32(objNode["value"].InnerText);
			_intAugModifier = Convert.ToInt32(objNode["augmodifier"].InnerText);

            if (_intBase == 0)
                _intBase = Value;
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:20,代码来源:clsUnique.cs

示例2: Create

		/// <summary>
		/// Create a Quality from an XmlNode and return the TreeNodes for it.
		/// </summary>
		/// <param name="objXmlQuality">XmlNode to create the object from.</param>
		/// <param name="objCharacter">Character object the Quality will be added to.</param>
		/// <param name="objQualitySource">Source of the Quality.</param>
		/// <param name="objNode">TreeNode to populate a TreeView.</param>
		/// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
		/// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
		/// <param name="strForceValue">Force a value to be selected for the Quality.</param>
		public virtual void Create(XmlNode objXmlQuality, Character objCharacter, QualitySource objQualitySource, TreeNode objNode, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes, string strForceValue = "")
		{
			_strName = objXmlQuality["name"].InnerText;
            if (objXmlQuality["metagenetic"] != null)
            {
                _strMetagenetic = objXmlQuality["metagenetic"].InnerText;
            }
			// Check for a Variable Cost.
			if (objXmlQuality["karma"].InnerText.StartsWith("Variable"))
			{
					int intMin = 0;
					int intMax = 0;
					string strCost = objXmlQuality["karma"].InnerText.Replace("Variable(", string.Empty).Replace(")", string.Empty);
					if (strCost.Contains("-"))
					{
						string[] strValues = strCost.Split('-');
						intMin = Convert.ToInt32(strValues[0]);
						intMax = Convert.ToInt32(strValues[1]);
					}
					else
						intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));

					if (intMin != 0 || intMax != 0)
					{
						frmSelectNumber frmPickNumber = new frmSelectNumber();
						if (intMax == 0)
							intMax = 1000000;
						frmPickNumber.Minimum = intMin;
						frmPickNumber.Maximum = intMax;
						frmPickNumber.Description = LanguageManager.Instance.GetString("String_SelectVariableCost").Replace("{0}", DisplayNameShort);
						frmPickNumber.AllowCancel = false;
						frmPickNumber.ShowDialog();
						_intBP = frmPickNumber.SelectedValue;
					}
			}
			else
			{ 
                _intBP = Convert.ToInt32(objXmlQuality["karma"].InnerText);
            }
            if (objXmlQuality["lp"] != null)
            {
                _intLP = Convert.ToInt32(objXmlQuality["lp"].InnerText);
            }
			_objQualityType = ConvertToQualityType(objXmlQuality["category"].InnerText);
			_objQualitySource = objQualitySource;
			if (objXmlQuality["print"] != null)
			{
				if (objXmlQuality["print"].InnerText == "no")
					_blnPrint = false;
			}
			if (objXmlQuality["implemented"] != null)
			{
				if (objXmlQuality["implemented"].InnerText == "False")
					_blnImplemented = false;
			}
			if (objXmlQuality["contributetolimit"] != null)
			{
				if (objXmlQuality["contributetolimit"].InnerText == "no")
					_blnContributeToLimit = false;
			}
			_strSource = objXmlQuality["source"].InnerText;
			_strPage = objXmlQuality["page"].InnerText;
			if (objXmlQuality["mutant"] != null)
				_strMutant = "yes";

			if (_objQualityType == QualityType.LifeModule)
			{
				objXmlQuality.TryGetField("stage", out _stage);
			}

            if(objXmlQuality["id"] != null)
                _qualiyGuid = Guid.Parse(objXmlQuality["id"].InnerText);

			if (GlobalOptions.Instance.Language != "en-us")
			{
				XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
				XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
				if (objQualityNode != null)
				{
					if (objQualityNode["translate"] != null)
						_strAltName = objQualityNode["translate"].InnerText;
					if (objQualityNode["altpage"] != null)
						_strAltPage = objQualityNode["altpage"].InnerText;
				}
			}

			// Add Weapons if applicable.
			if (objXmlQuality.InnerXml.Contains("<addweapon>"))
			{
				XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");
//.........这里部分代码省略.........
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:101,代码来源:clsUnique.cs

示例3: Load

 public void Load(XmlNode objXmlData)
 {
     objXmlData.TryGetField("name", out name);
     objXmlData.TryGetField("category", out category);
     foreach (XmlNode objXmlLevel in objXmlData.SelectNodes("effects/level"))
     {
         clsDrugEffect objDrugEffect = new clsDrugEffect();
         foreach (XmlNode objXmlEffect in objXmlLevel.SelectNodes("*"))
         {
             string effectName;
             int effectValue;
             objXmlEffect.TryGetField("name", out effectName, null);
             objXmlEffect.TryGetField("value", out effectValue, 1);
             switch (objXmlEffect.Name)
             {
                 case "attribute":
                     if (effectName != null)
                         objDrugEffect.attributes[effectName] = effectValue;
                     break;
                 case "limit":
                     if (effectName != null)
                         objDrugEffect.limits[effectName] = effectValue;
                     break;
                 case "quality":
                     objDrugEffect.qualities.Add(objXmlEffect.InnerText);
                     break;
                 case "info":
                     objDrugEffect.infos.Add(objXmlEffect.InnerText);
                     break;
                 case "initiative":
                     objDrugEffect.ini = int.Parse(objXmlEffect.InnerText);
                     break;
                 case "initiativedice":
                     objDrugEffect.iniDice = int.Parse(objXmlEffect.InnerText);
                     break;
                 case "crashdamage":
                     objDrugEffect.crashDamage = int.Parse(objXmlEffect.InnerText);
                     break;
                 case "speed":
                     objDrugEffect.speed = int.Parse(objXmlEffect.InnerText);
                     break;
                 case "duration":
                     objDrugEffect.duration = int.Parse(objXmlEffect.InnerText);
                     break;
                 default:
                     Log.Warning(info: string.Format("Unknown drug effect %s in component %s", objXmlEffect.Name, effectName));
                     break;
             }
         }
         effects.Add(objDrugEffect);
     }
     objXmlData.TryGetField("availability", out availability);
     objXmlData.TryGetField("cost", out cost);
     objXmlData.TryGetField("rating", out addictionRating);
     objXmlData.TryGetField("threshold", out addictionThreshold);
     objXmlData.TryGetField("source", out source);
     objXmlData.TryGetField("page", out page);
 }
开发者ID:AMDX9,项目名称:chummer5a,代码行数:58,代码来源:frmCreateCustomDrug.cs

示例4: Load

        public void Load(XmlNode node)
        {
            node.TryGetField("name", out _name);
            Type = node["type"].InnerText;
            node.TryGetField(GlobalOptions.Instance.Language, out _translated);

            LoadSuggestedSpecializations(_name);
        }
开发者ID:Rockzo,项目名称:chummer5a,代码行数:8,代码来源:KnowledgeSkill.cs

示例5: Load

        /// <summary>
        /// Load the Gear from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public new void Load(XmlNode objNode, bool blnCopy = false)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strCategory = objNode["category"].InnerText;
            objNode.TryGetField("armorcapacity", out _strArmorCapacity).ToString();
            _intMaxRating = Convert.ToInt32(objNode["maxrating"].InnerText);
            _intRating = Convert.ToInt32(objNode["rating"].InnerText);
            _intQty = Convert.ToInt32(objNode["qty"].InnerText);
            _strAvail = objNode["avail"].InnerText;
            _strCost = objNode["cost"].InnerText;
            _strExtra = objNode["extra"].InnerText;
            objNode.TryGetField("overclocked", out _strOverclocked);
            objNode.TryGetField("bonded", out _blnBonded);
            objNode.TryGetField("equipped", out _blnEquipped);
            objNode.TryGetField("homenode", out _blnHomeNode);
            _nodBonus = objNode["bonus"];
            _strSource = objNode["source"].InnerText;
            objNode.TryGetField("page", out _strPage);
            _intDeviceRating = Convert.ToInt32(objNode["devicerating"].InnerText);
            objNode.TryGetField("attack", out _intAttack);
            objNode.TryGetField("sleaze", out _intSleaze);
            objNode.TryGetField("dataprocessing", out _intDataProcessing);
            objNode.TryGetField("firewall", out _intFirewall);
            objNode.TryGetField("gearname", out _strGearName);

            if (objNode.InnerXml.Contains("<gear>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("children/gear");
                foreach (XmlNode nodChild in nodChildren)
                {
                    switch (nodChild["category"].InnerText)
                    {
                        case "Commlinks":
                        case "Commlink Accessories":
                        case "Cyberdecks":
                        case "Rigger Command Consoles":
                            Commlink objCommlink = new Commlink(_objCharacter);
                            objCommlink.Load(nodChild, blnCopy);
                            objCommlink.Parent = this;
                            _objChildren.Add(objCommlink);
                            break;
                        default:
                            Gear objGear = new Gear(_objCharacter);
                            objGear.Load(nodChild, blnCopy);
                            objGear.Parent = this;
                            _objChildren.Add(objGear);
                            break;
                    }
                }
            }
            objNode.TryGetField("location", out _strLocation);
            objNode.TryGetField("notes", out _strNotes);
            objNode.TryGetField("discountedcost", out _blnDiscountCost);
            objNode.TryGetField("active", out _blnActiveCommlink);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("gear.xml");
                XmlNode objGearNode = objXmlDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + _strName + "\"]");
                if (objGearNode != null)
                {
                    if (objGearNode["translate"] != null)
                        _strAltName = objGearNode["translate"].InnerText;
                    if (objGearNode["altpage"] != null)
                        _strAltPage = objGearNode["altpage"].InnerText;
                }

                if (_strAltName.StartsWith("Stacked Focus"))
                    _strAltName = _strAltName.Replace("Stacked Focus", LanguageManager.Instance.GetString("String_StackedFocus"));

                objGearNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objGearNode != null)
                {
                    if (objGearNode.Attributes["translate"] != null)
                        _strAltCategory = objGearNode.Attributes["translate"].InnerText;
                }

                if (_strAltCategory.StartsWith("Stacked Focus"))
                    _strAltCategory = _strAltCategory.Replace("Stacked Focus", LanguageManager.Instance.GetString("String_StackedFocus"));
            }

            if (blnCopy)
            {
                _guiID = Guid.NewGuid();
                _strLocation = string.Empty;
                _blnHomeNode = false;
            }
        }
开发者ID:Rockzo,项目名称:chummer5a,代码行数:93,代码来源:Commlink.cs

示例6: Load

        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, bool blnCopy = false)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strCategory = objNode["category"].InnerText;
            _strA = objNode["armor"].InnerText;
            _strAvail = objNode["avail"].InnerText;
            _strCost = objNode["cost"].InnerText;
            _strSource = objNode["source"].InnerText;
            objNode.TryGetField("armoroverride", out _strO);
            objNode.TryGetField("armorcapacity", out _strArmorCapacity);
            objNode.TryGetField("rating", out _intRating);
            objNode.TryGetField("maxrating", out _intMaxRating);
            objNode.TryGetField("page", out _strPage);
            objNode.TryGetField("armorname", out _strArmorName);
            objNode.TryGetField("equipped", out _blnEquipped);
            objNode.TryGetField("extra", out _strExtra);
            objNode.TryGetField("damage", out _intDamage);
            objNode.TryGetField("location", out _strLocation);
            objNode.TryGetField("notes", out _strNotes);
            objNode.TryGetField("discountedcost", out _blnDiscountCost);
            try
            {
                _nodBonus = objNode["bonus"];
            }
            catch { }
            if (objNode.InnerXml.Contains("armormods"))
            {
                XmlNodeList nodMods = objNode.SelectNodes("armormods/armormod");
                foreach (XmlNode nodMod in nodMods)
                {
                    ArmorMod objMod = new ArmorMod(_objCharacter);
                    objMod.Load(nodMod, blnCopy);
                    objMod.Parent = this;
                    _lstArmorMods.Add(objMod);
                }
            }
            if (objNode.InnerXml.Contains("gears"))
            {
                XmlNodeList nodGears = objNode.SelectNodes("gears/gear");
                foreach (XmlNode nodGear in nodGears)
                {
                    switch (nodGear["category"].InnerText)
                    {
                        case "Commlinks":
                        case "Commlink Accessories":
                        case "Cyberdecks":
                        case "Rigger Command Consoles":
                            Commlink objCommlink = new Commlink(_objCharacter);
                            objCommlink.Load(nodGear, blnCopy);
                            _lstGear.Add(objCommlink);
                            break;
                        default:
                            Gear objGear = new Gear(_objCharacter);
                            objGear.Load(nodGear, blnCopy);
                            _lstGear.Add(objGear);
                            break;
                    }
                }
            }

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlArmorDocument = XmlManager.Instance.Load("armor.xml");
                XmlNode objArmorNode = objXmlArmorDocument.SelectSingleNode("/chummer/armors/armor[name = \"" + _strName + "\"]");
                if (objArmorNode != null)
                {
                    if (objArmorNode["translate"] != null)
                        _strAltName = objArmorNode["translate"].InnerText;
                    if (objArmorNode["altpage"] != null)
                        _strAltPage = objArmorNode["altpage"].InnerText;
                }

                objArmorNode = objXmlArmorDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objArmorNode != null)
                {
                    if (objArmorNode.Attributes["translate"] != null)
                        _strAltCategory = objArmorNode.Attributes["translate"].InnerText;
                }
            }

            if (blnCopy)
            {
                _guiID = Guid.NewGuid();
                _strLocation = string.Empty;
            }
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:91,代码来源:Armor.cs

示例7: Load

        /// <summary>
        /// Load the Vehicle from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, bool blnCopy = false)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strCategory = objNode["category"].InnerText;
            //Some vehicles have different Offroad Handling speeds. If so, we want to split this up for use with mods and such later.
            if (objNode["handling"].InnerText.Contains('/'))
            {
                _intHandling = Convert.ToInt32(objNode["handling"].InnerText.Split('/')[0]);
                _intOffroadHandling = Convert.ToInt32(objNode["handling"].InnerText.Split('/')[1]);
            }
            else
            {
                _intHandling = Convert.ToInt32(objNode["handling"].InnerText);
                if (objNode.InnerXml.Contains("offroadhandling"))
                {
                    _intOffroadHandling = Convert.ToInt32(objNode["offroadhandling"].InnerText);
                }
            }
            _intAccel = Convert.ToInt32(objNode["accel"].InnerText);
            objNode.TryGetField("seats", out _intSeats);
            _intSpeed = Convert.ToInt32(objNode["speed"].InnerText);
            _intPilot = Convert.ToInt32(objNode["pilot"].InnerText);
            _intBody = Convert.ToInt32(objNode["body"].InnerText);
            _intArmor = Convert.ToInt32(objNode["armor"].InnerText);
            _intSensor = Convert.ToInt32(objNode["sensor"].InnerText);
            objNode.TryGetField("devicerating", out _intDeviceRating);
            _strAvail = objNode["avail"].InnerText;
            _strCost = objNode["cost"].InnerText;
            objNode.TryGetField("addslots", out _intAddSlots);
            objNode.TryGetField("modslots", out _intModSlots);
            _strSource = objNode["source"].InnerText;
            objNode.TryGetField("page", out _strPage);
            objNode.TryGetField("matrixcmfilled", out _intMatrixCMFilled);
            objNode.TryGetField("physicalcmfilled", out _intPhysicalCMFilled);
            objNode.TryGetField("vehiclename", out _strVehicleName);
            objNode.TryGetField("homenode", out _blnHomeNode);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
                XmlNode objVehicleNode = objXmlDocument.SelectSingleNode("/chummer/vehicles/vehicle[name = \"" + _strName + "\"]");
                if (objVehicleNode != null)
                {
                    if (objVehicleNode["translate"] != null)
                        _strAltName = objVehicleNode["translate"].InnerText;
                    if (objVehicleNode["altpage"] != null)
                        _strAltPage = objVehicleNode["altpage"].InnerText;
                }

                objVehicleNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objVehicleNode != null)
                {
                    if (objVehicleNode.Attributes["translate"] != null)
                        _strAltCategory = objVehicleNode.Attributes["translate"].InnerText;
                }
            }

            if (objNode.InnerXml.Contains("<mods>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("mods/mod");
                foreach (XmlNode nodChild in nodChildren)
                {
                    VehicleMod objMod = new VehicleMod(_objCharacter);
                    objMod.Load(nodChild, blnCopy);
                    _lstVehicleMods.Add(objMod);
                }
            }

            if (objNode.InnerXml.Contains("<gears>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("gears/gear");
                foreach (XmlNode nodChild in nodChildren)
                {
                    switch (nodChild["category"].InnerText)
                    {
                        case "Commlinks":
                        case "Commlink Accessories":
                        case "Cyberdecks":
                        case "Rigger Command Consoles":
                            Commlink objCommlink = new Commlink(_objCharacter);
                            objCommlink.Load(nodChild, blnCopy);
                            _lstGear.Add(objCommlink);
                            break;
                        default:
                            Gear objGear = new Gear(_objCharacter);
                            objGear.Load(nodChild, blnCopy);
                            _lstGear.Add(objGear);
                            break;
                    }
                }
            }

            if (objNode.InnerXml.Contains("<weapons>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("weapons/weapon");
//.........这里部分代码省略.........
开发者ID:Rockzo,项目名称:chummer5a,代码行数:101,代码来源:Vehicle.cs

示例8: Load

        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        /// <param name="blnCopy">Whether another node is being copied.</param>
        public void Load(XmlNode objNode, bool blnCopy = false)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strMount = objNode["mount"].InnerText;
            _strRC = objNode["rc"].InnerText;
            objNode.TryGetField("rating", out _intRating,0);
            objNode.TryGetField("rcgroup", out _intRCGroup, 0);
            objNode.TryGetField("accuracy", out _intAccuracy, 0);
            objNode.TryGetField("rating", out _intRating, 0);
            objNode.TryGetField("rating", out _intRating, 0);
            objNode.TryGetField("conceal", out _strConceal, "0");
            objNode.TryGetField("rcdeployable", out _blnDeployable);
            _strAvail = objNode["avail"].InnerText;
            _strCost = objNode["cost"].InnerText;
            _blnIncludedInWeapon = Convert.ToBoolean(objNode["included"].InnerText);
            objNode.TryGetField("installed", out _blnInstalled, true);
            try
            {
                _nodAllowGear = objNode["allowgear"];
            }
            catch
            {
            }
            _strSource = objNode["source"].InnerText;

            objNode.TryGetField("page", out _strPage, "0");
            objNode.TryGetField("dicepool", out _strDicePool, "0");

            if (objNode.InnerXml.Contains("ammoslots"))
            {
                objNode.TryGetField("ammoslots", out _intAmmoSlots, 0);  //TODO: Might work if 0 -> 1
            }

            if (objNode.InnerXml.Contains("<gears>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("gears/gear");
                foreach (XmlNode nodChild in nodChildren)
                {
                    switch (nodChild["category"].InnerText)
                    {
                        case "Commlinks":
                        case "Commlink Accessories":
                        case "Cyberdecks":
                        case "Rigger Command Consoles":
                            Commlink objCommlink = new Commlink(_objCharacter);
                            objCommlink.Load(nodChild, blnCopy);
                            _lstGear.Add(objCommlink);
                            break;
                        default:
                            Gear objGear = new Gear(_objCharacter);
                            objGear.Load(nodChild, blnCopy);
                            _lstGear.Add(objGear);
                            break;
                    }
                }
            }
            objNode.TryGetField("notes", out _strNotes, "");
            objNode.TryGetField("discountedcost", out _blnDiscountCost, false);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
                XmlNode objAccessoryNode = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + _strName + "\"]");
                if (objAccessoryNode != null)
                {
                    if (objAccessoryNode["translate"] != null)
                        _strAltName = objAccessoryNode["translate"].InnerText;
                    if (objAccessoryNode["altpage"] != null)
                        _strAltPage = objAccessoryNode["altpage"].InnerText;
                }
            }
            if (objNode["damage"] != null)
            {
                _strDamage = objNode["damage"].InnerText;
            }
            if (objNode["damagetype"] != null)
            {
                _strDamageType = objNode["damagetype"].InnerText;
            }
            if (objNode["damagereplace"] != null)
            {
                _strDamageReplace = objNode["damagereplace"].InnerText;
            }
            if (objNode["firemode"] != null)
            {
                _strFireMode = objNode["firemode"].InnerText;
            }
            if (objNode["firemodereplace"] != null)
            {
                _strFireModeReplace = objNode["firemodereplace"].InnerText;
            }

            if (objNode["ap"] != null)
            {
//.........这里部分代码省略.........
开发者ID:argo2445,项目名称:chummer5a,代码行数:101,代码来源:WeaponAccessory.cs

示例9: Create

        /// Create a Weapon Accessory from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlAccessory">XmlNode to create the object from.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="strMount">Mount slot that the Weapon Accessory will consume.</param>
        /// <param name="intRating">Rating of the Weapon Accessory.</param>
        public void Create(XmlNode objXmlAccessory, TreeNode objNode, string strMount, int intRating)
        {
            _strName = objXmlAccessory["name"].InnerText;
            _strMount = strMount;
            _intRating = intRating;
            _strAvail = objXmlAccessory["avail"].InnerText;
            _strCost = objXmlAccessory["cost"].InnerText;
            _strSource = objXmlAccessory["source"].InnerText;
            _strPage = objXmlAccessory["page"].InnerText;
            _nodAllowGear = objXmlAccessory["allowgear"];
            objXmlAccessory.TryGetField("rc", out _strRC, "");
            objXmlAccessory.TryGetField("rcdeployable", out _blnDeployable);
            objXmlAccessory.TryGetField("rcgroup", out _intRCGroup);
            objXmlAccessory.TryGetField("conceal", out _strConceal, "");
            objXmlAccessory.TryGetField("ammoslots", out _intAmmoSlots);
            objXmlAccessory.TryGetField("ammoreplace", out _strAmmoReplace, "");
            objXmlAccessory.TryGetField("accuracy", out _intAccuracy);
            objXmlAccessory.TryGetField("dicepool", out _strDicePool,"");
            objXmlAccessory.TryGetField("damagetype", out _strDamageType,"");
            objXmlAccessory.TryGetField("damage", out _strDamage, "");
            objXmlAccessory.TryGetField("damagereplace", out _strDamageReplace, "");
            objXmlAccessory.TryGetField("firemode", out _strFireMode, "");
            objXmlAccessory.TryGetField("firemodereplace", out _strFireModeReplace, "");
            objXmlAccessory.TryGetField("ap", out _strAP,"");
            objXmlAccessory.TryGetField("apreplace", out _strAPReplace,"");
            objXmlAccessory.TryGetField("addmode", out _strAddMode,"");
            objXmlAccessory.TryGetField("fullburst", out _intFullBurst);
            objXmlAccessory.TryGetField("suppressive", out _intSuppressive);
            objXmlAccessory.TryGetField("rangebonus", out _intRangeBonus);
            objXmlAccessory.TryGetField("extra", out _strExtra, "");
            objXmlAccessory.TryGetField("ammobonus", out _intAmmoBonus);
            objXmlAccessory.TryGetField("accessorycostmultiplier", out _intAccessoryCostMultiplier);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
                XmlNode objAccessoryNode = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + _strName + "\"]");
                if (objAccessoryNode != null)
                {
                    if (objAccessoryNode["translate"] != null)
                        _strAltName = objAccessoryNode["translate"].InnerText;
                    if (objAccessoryNode["altpage"] != null)
                        _strAltPage = objAccessoryNode["altpage"].InnerText;
                }
            }

            objNode.Text = DisplayName;
            objNode.Tag = _guiID.ToString();
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:54,代码来源:WeaponAccessory.cs

示例10: Create

        /// <summary>
        /// Create a Quality from an XmlNode and return the TreeNodes for it.
        /// </summary>
        /// <param name="objXmlQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the Quality will be added to.</param>
        /// <param name="objQualitySource">Source of the Quality.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="objWeapons">List of Weapons that should be added to the Character.</param>
        /// <param name="objWeaponNodes">List of TreeNodes to represent the Weapons added.</param>
        /// <param name="strForceValue">Force a value to be selected for the Quality.</param>
        public virtual void Create(XmlNode objXmlQuality, Character objCharacter, QualitySource objQualitySource, TreeNode objNode, List<Weapon> objWeapons, List<TreeNode> objWeaponNodes, string strForceValue = "")
        {
            _strName = objXmlQuality["name"].InnerText;
            if (objXmlQuality["metagenetic"] != null)
            {
                _strMetagenetic = objXmlQuality["metagenetic"].InnerText;
            }
            if (objXmlQuality["karma"] != null)
            {
                _intBP = Convert.ToInt32(objXmlQuality["karma"].InnerText);
            }
            if (objXmlQuality["lp"] != null)
            {
                _intLP = Convert.ToInt32(objXmlQuality["lp"].InnerText);
            }
            _objQualityType = ConvertToQualityType(objXmlQuality["category"].InnerText);
            _objQualitySource = objQualitySource;
            if (objXmlQuality["print"] != null)
            {
                if (objXmlQuality["print"].InnerText == "no")
                    _blnPrint = false;
            }
            if (objXmlQuality["contributetolimit"] != null)
            {
                if (objXmlQuality["contributetolimit"].InnerText == "no")
                    _blnContributeToLimit = false;
            }
            _strSource = objXmlQuality["source"].InnerText;
            _strPage = objXmlQuality["page"].InnerText;
            if (objXmlQuality["mutant"] != null)
                _strMutant = "yes";

            if (_objQualityType == QualityType.LifeModule)
            {
                objXmlQuality.TryGetField("stage", out _stage);
            }

            if(objXmlQuality["id"] != null)
                _qualiyGuid = Guid.Parse(objXmlQuality["id"].InnerText);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("qualities.xml");
                XmlNode objQualityNode = objXmlDocument.SelectSingleNode("/chummer/qualities/quality[name = \"" + _strName + "\"]");
                if (objQualityNode != null)
                {
                    if (objQualityNode["translate"] != null)
                        _strAltName = objQualityNode["translate"].InnerText;
                    if (objQualityNode["altpage"] != null)
                        _strAltPage = objQualityNode["altpage"].InnerText;
                }
            }

            // Add Weapons if applicable.
            if (objXmlQuality.InnerXml.Contains("<addweapon>"))
            {
                XmlDocument objXmlWeaponDocument = XmlManager.Instance.Load("weapons.xml");

                // More than one Weapon can be added, so loop through all occurrences.
                foreach (XmlNode objXmlAddWeapon in objXmlQuality.SelectNodes("addweapon"))
                {
                    XmlNode objXmlWeapon = objXmlWeaponDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objXmlAddWeapon.InnerText + "\" and starts-with(category, \"Quality\")]");

                    TreeNode objGearWeaponNode = new TreeNode();
                    Weapon objGearWeapon = new Weapon(objCharacter);
                    objGearWeapon.Create(objXmlWeapon, objCharacter, objGearWeaponNode, null, null, null);
                    objGearWeaponNode.ForeColor = SystemColors.GrayText;
                    objWeaponNodes.Add(objGearWeaponNode);
                    objWeapons.Add(objGearWeapon);

                    _guiWeaponID = Guid.Parse(objGearWeapon.InternalId);
                }
            }

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlQuality.InnerXml.Contains("<bonus>"))
            {
                ImprovementManager objImprovementManager = new ImprovementManager(objCharacter);
                objImprovementManager.ForcedValue = strForceValue;
                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Quality, _guiID.ToString(), objXmlQuality["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (objImprovementManager.SelectedValue != "")
                {
                    _strExtra = objImprovementManager.SelectedValue;
                    objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }
//.........这里部分代码省略.........
开发者ID:lillyyuri,项目名称:chummer5a,代码行数:101,代码来源:clsUnique.cs

示例11: Load

        /// <summary>
        /// Load the VehicleMod from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, bool blnCopy = false)
        {
            _guiID = Guid.Parse(objNode["guid"].InnerText);
            _strName = objNode["name"].InnerText;
            _strCategory = objNode["category"].InnerText;
            _strLimit = objNode["limit"].InnerText;
            _strSlots = objNode["slots"].InnerText;
            _intRating = Convert.ToInt32(objNode["rating"].InnerText);
            _strMaxRating = objNode["maxrating"].InnerText;
            objNode.TryGetField("weaponmountcategories", out _strWeaponMountCategories);
            objNode.TryGetField("response", out _intResponse);
            objNode.TryGetField("system", out _intSystem);
            objNode.TryGetField("firewall", out _intFirewall);
            objNode.TryGetField("signal", out _intSignal);
            objNode.TryGetField("pilot", out _intPilot);
            objNode.TryGetField("page", out _strPage);
            _strAvail = objNode["avail"].InnerText;
            _strCost = objNode["cost"].InnerText;
            _strSource = objNode["source"].InnerText;
            _blnIncludeInVehicle = Convert.ToBoolean(objNode["included"].InnerText);
            objNode.TryGetField("installed", out _blnInstalled);
            objNode.TryGetField("subsystems", out _strSubsystems);

            if (objNode.InnerXml.Contains("<weapons>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("weapons/weapon");
                foreach (XmlNode nodChild in nodChildren)
                {
                    Weapon objWeapon = new Weapon(_objCharacter);
                    objWeapon.Load(nodChild, blnCopy);
                    _lstVehicleWeapons.Add(objWeapon);
                }
            }
            if (objNode.InnerXml.Contains("<cyberwares>"))
            {
                XmlNodeList nodChildren = objNode.SelectNodes("cyberwares/cyberware");
                foreach (XmlNode nodChild in nodChildren)
                {
                    Cyberware objCyberware = new Cyberware(_objCharacter);
                    objCyberware.Load(nodChild, blnCopy);
                    _lstCyberware.Add(objCyberware);
                }
            }

            try
            {
                _nodBonus = objNode["bonus"];
            }
            catch
            {
            }
            objNode.TryGetField("notes", out _strNotes);
            objNode.TryGetField("discountedcost", out _blnDiscountCost);
            objNode.TryGetField("extra", out _strExtra);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
                XmlNode objModNode = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + _strName + "\"]");
                if (objModNode != null)
                {
                    if (objModNode["translate"] != null)
                        _strAltName = objModNode["translate"].InnerText;
                    if (objModNode["altpage"] != null)
                        _strAltPage = objModNode["altpage"].InnerText;
                }

                objModNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objModNode != null)
                {
                    if (objModNode.Attributes["translate"] != null)
                        _strAltCategory = objModNode.Attributes["translate"].InnerText;
                }
            }

            if (blnCopy)
            {
                _guiID = Guid.NewGuid();
            }
        }
开发者ID:Rockzo,项目名称:chummer5a,代码行数:84,代码来源:VehicleMod.cs

示例12: Create

        /// Create a Vehicle Modification from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlMod">XmlNode to create the object from.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="intRating">Selected Rating for the Gear.</param>
        public void Create(XmlNode objXmlMod, TreeNode objNode, int intRating)
        {
            _strName = objXmlMod["name"].InnerText;
            _strCategory = objXmlMod["category"].InnerText;
            objXmlMod.TryGetField("limit", out _strLimit);
            objXmlMod.TryGetField("slots", out _strSlots);
            if (intRating != 0)
            {
                _intRating = Convert.ToInt32(intRating);
            }
            if (objXmlMod["rating"] != null)
                _strMaxRating = objXmlMod["rating"].InnerText;
            else
                _strMaxRating = "0";
            objXmlMod.TryGetField("response", out _intResponse);
            objXmlMod.TryGetField("system", out _intSystem);
            objXmlMod.TryGetField("firewall", out _intFirewall);
            objXmlMod.TryGetField("signal", out _intSignal);
            objXmlMod.TryGetField("pilot", out _intPilot);
            objXmlMod.TryGetField("weaponmountcategories", out _strWeaponMountCategories);
            // Add Subsytem information if applicable.
            if (objXmlMod.InnerXml.Contains("subsystems"))
            {
                string strSubsystem = "";
                foreach (XmlNode objXmlSubsystem in objXmlMod.SelectNodes("subsystems/subsystem"))
                {
                    strSubsystem += objXmlSubsystem.InnerText + ",";
                }
                _strSubsystems = strSubsystem;
            }
            _strAvail = objXmlMod["avail"].InnerText;

            // Check for a Variable Cost.
            if (objXmlMod["cost"] != null)
            {
                if (objXmlMod["cost"].InnerText.StartsWith("Variable"))
                {
                    int intMin = 0;
                    int intMax = 0;
                    string strCost = objXmlMod["cost"].InnerText.Replace("Variable(", string.Empty).Replace(")", string.Empty);
                    if (strCost.Contains("-"))
                    {
                        string[] strValues = strCost.Split('-');
                        intMin = Convert.ToInt32(strValues[0]);
                        intMax = Convert.ToInt32(strValues[1]);
                    }
                    else
                        intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));

                    if (intMin != 0 || intMax != 0)
                    {
                        frmSelectNumber frmPickNumber = new frmSelectNumber();
                        if (intMax == 0)
                            intMax = 1000000;
                        frmPickNumber.Minimum = intMin;
                        frmPickNumber.Maximum = intMax;
                        frmPickNumber.Description = LanguageManager.Instance.GetString("String_SelectVariableCost").Replace("{0}", DisplayNameShort);
                        frmPickNumber.AllowCancel = false;
                        frmPickNumber.ShowDialog();
                        _strCost = frmPickNumber.SelectedValue.ToString();
                    }
                }
                else
                    _strCost = objXmlMod["cost"].InnerText;
            }

            _strSource = objXmlMod["source"].InnerText;
            _strPage = objXmlMod["page"].InnerText;
            if (objXmlMod["bonus"] != null)
                _nodBonus = objXmlMod["bonus"];

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");
                XmlNode objModNode = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + _strName + "\"]");
                if (objModNode != null)
                {
                    if (objModNode["translate"] != null)
                        _strAltName = objModNode["translate"].InnerText;
                    if (objModNode["altpage"] != null)
                        _strAltPage = objModNode["altpage"].InnerText;
                }

                objModNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objModNode != null)
                {
                    if (objModNode.Attributes["translate"] != null)
                        _strAltCategory = objModNode.Attributes["translate"].InnerText;
                }
            }

            objNode.Text = DisplayName;
            objNode.Tag = _guiID.ToString();
        }
开发者ID:Rockzo,项目名称:chummer5a,代码行数:98,代码来源:VehicleMod.cs

示例13: Create

        /// Create a Lifestyle from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlLifestyle">XmlNode to create the object from.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        public void Create(XmlNode objXmlLifestyle, TreeNode objNode)
        {
            _strName = objXmlLifestyle["name"].InnerText;
            _intCost = Convert.ToInt32(objXmlLifestyle["cost"].InnerText);
            _intDice = Convert.ToInt32(objXmlLifestyle["dice"].InnerText);
            _intMultiplier = Convert.ToInt32(objXmlLifestyle["multiplier"].InnerText);
            _strSource = objXmlLifestyle["source"].InnerText;
            _strPage = objXmlLifestyle["page"].InnerText;
            if (!objXmlLifestyle.TryGetField<Guid>("id", Guid.TryParse, out _sourceID))
            {
                Log.Warning(new object[] { "Missing id field for lifestyle xmlnode", objXmlLifestyle});

                if (System.Diagnostics.Debugger.IsAttached)
                    System.Diagnostics.Debugger.Break();
            }

            objNode.Text = DisplayName;
            objNode.Tag = _guiID;
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:22,代码来源:Lifestyle.cs

示例14: Load

        /// <summary>
        /// Load the CharacterAttribute from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode, bool blnCopy = false)
        {
            //Can't out property and no backing field
            Guid source;
            if (objNode.TryGetField<Guid>("sourceid", Guid.TryParse, out source))
            {
                SourceID = source;
            }

            objNode.TryGetField<Guid>("guid", Guid.TryParse, out _guiID);

            //If not present something gone totaly wrong, throw something
            if
                (
                !objNode.TryGetField("name", out _strName) ||
                !objNode.TryGetField("cost", out _intCost) ||
                !objNode.TryGetField("dice", out _intDice) ||
                !objNode.TryGetField("multiplier", out _intMultiplier) ||
                !objNode.TryGetField("months", out _intMonths)
                )
            {
                throw new ArgumentNullException("One or more of name, cost, dice, multiplier or months is missing");
            }

            objNode.TryGetField("area", out _intArea);
            objNode.TryGetField("security", out _intSecurity);
            objNode.TryGetField("comforts", out _intComforts);
            objNode.TryGetField("roommates", out _intRoommates);
            objNode.TryGetField("percentage", out _intPercentage);
            objNode.TryGetField("lifestylename", out _strLifestyleName);
            if (!objNode.TryGetField("purchased", out _blnPurchased))
            {
                throw new ArgumentNullException("purchased");
            }

            if (objNode.TryGetField("baselifestyle", out _strBaseLifestyle))
            {
                if (_strBaseLifestyle == "Middle")
                    _strBaseLifestyle = "Medium";
            }

            if (!objNode.TryGetField("source", out _strSource))
            {
                throw new ArgumentNullException("source");
            }
            objNode.TryGetField("trustfund", out _blnTrustFund);
            objNode.TryGetField("page", out _strPage);

            // Lifestyle Qualities
            XmlNodeList objXmlNodeList = objNode.SelectNodes("lifestylequalities/lifestylequality");
            foreach (XmlNode objXmlQuality in objXmlNodeList)
            {
                LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);
                objQuality.Load(objXmlQuality);
                _lstLifestyleQualities.Add(objQuality);
            }

            // Free Grids provided by the Lifestyle
            objXmlNodeList = objNode.SelectNodes("freegrids/lifestylequality");
            foreach (XmlNode objXmlQuality in objXmlNodeList)
            {
                LifestyleQuality objQuality = new LifestyleQuality(_objCharacter);
                objQuality.Load(objXmlQuality);
                _lstLifestyleQualities.Add(objQuality);
            }

            objNode.TryGetField("notes", out _strNotes);

            String strtemp;
            if (objNode.TryGetField("type", out strtemp))
            {
                _objType = ConverToLifestyleType(strtemp);
            }

            try
            {
                _strNotes = objNode["notes"].InnerText;
            }
            catch
            {
            }

            try
            {
                _objType = ConverToLifestyleType(objNode["type"].InnerText);
            }
            catch
            {
            }

            if (blnCopy)
            {
                _guiID = Guid.NewGuid();
                _intMonths = 0;
            }
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:100,代码来源:Lifestyle.cs

示例15: Create

        /// Create a Commlink from an XmlNode and return the TreeNodes for it.
        /// <param name="objXmlGear">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character the Gear is being added to.</param>
        /// <param name="objNode">TreeNode to populate a TreeView.</param>
        /// <param name="intRating">Gear Rating.</param>
        /// <param name="blnAddImprovements">Whether or not Improvements should be added to the character.</param>
        /// <param name="blnCreateChildren">Whether or not child Gear should be created.</param>
        public void Create(XmlNode objXmlGear, Character objCharacter, TreeNode objNode, int intRating, bool blnAddImprovements = true, bool blnCreateChildren = true)
        {
            _strName = objXmlGear["name"].InnerText;
            _strCategory = objXmlGear["category"].InnerText;
            _strAvail = objXmlGear["avail"].InnerText;
            objXmlGear.TryGetField("cost", out _strCost);
            objXmlGear.TryGetField("cost3", out _strCost3, "");
            objXmlGear.TryGetField("cost6", out _strCost6, "");
            objXmlGear.TryGetField("cost10", out _strCost10, "");
            objXmlGear.TryGetField("armorcapacity", out _strArmorCapacity);
            _nodBonus = objXmlGear["bonus"];
            _intMaxRating = Convert.ToInt32(objXmlGear["rating"].InnerText);
            _intRating = intRating;
            _strSource = objXmlGear["source"].InnerText;
            _strPage = objXmlGear["page"].InnerText;
            _intDeviceRating = Convert.ToInt32(objXmlGear["devicerating"].InnerText);

            _intAttack = Convert.ToInt32(objXmlGear["attack"].InnerText);
            _intSleaze= Convert.ToInt32(objXmlGear["sleaze"].InnerText);
            _intDataProcessing = Convert.ToInt32(objXmlGear["dataprocessing"].InnerText);
            _intFirewall = Convert.ToInt32(objXmlGear["firewall"].InnerText);

            if (GlobalOptions.Instance.Language != "en-us")
            {
                XmlDocument objXmlDocument = XmlManager.Instance.Load("gear.xml");
                XmlNode objGearNode = objXmlDocument.SelectSingleNode("/chummer/gears/gear[name = \"" + _strName + "\"]");
                if (objGearNode != null)
                {
                    if (objGearNode["translate"] != null)
                        _strAltName = objGearNode["translate"].InnerText;
                    if (objGearNode["altpage"] != null)
                        _strAltPage = objGearNode["altpage"].InnerText;
                }

                if (_strAltName.StartsWith("Stacked Focus"))
                    _strAltName = _strAltName.Replace("Stacked Focus", LanguageManager.Instance.GetString("String_StackedFocus"));

                objGearNode = objXmlDocument.SelectSingleNode("/chummer/categories/category[. = \"" + _strCategory + "\"]");
                if (objGearNode != null)
                {
                    if (objGearNode.Attributes["translate"] != null)
                        _strAltCategory = objGearNode.Attributes["translate"].InnerText;
                }

                if (_strAltCategory.StartsWith("Stacked Focus"))
                    _strAltCategory = _strAltCategory.Replace("Stacked Focus", LanguageManager.Instance.GetString("String_StackedFocus"));
            }

            string strSource = _guiID.ToString();

            objNode.Text = DisplayNameShort;
            objNode.Tag = _guiID.ToString();

            // If the item grants a bonus, pass the information to the Improvement Manager.
            if (objXmlGear["bonus"] != null)
            {
                ImprovementManager objImprovementManager;
                if (blnAddImprovements)
                    objImprovementManager = new ImprovementManager(objCharacter);
                else
                    objImprovementManager = new ImprovementManager(null);

                if (!objImprovementManager.CreateImprovements(Improvement.ImprovementSource.Gear, strSource, objXmlGear["bonus"], false, 1, DisplayNameShort))
                {
                    _guiID = Guid.Empty;
                    return;
                }
                if (objImprovementManager.SelectedValue != "")
                {
                    _strExtra = objImprovementManager.SelectedValue;
                    objNode.Text += " (" + objImprovementManager.SelectedValue + ")";
                }
            }

            // Check to see if there are any child elements.
            if (objXmlGear.InnerXml.Contains("<gears>") && blnCreateChildren)
            {
                // Create Gear using whatever information we're given.
                foreach (XmlNode objXmlChild in objXmlGear.SelectNodes("gears/gear"))
                {
                    Gear objChild = new Gear(_objCharacter);
                    TreeNode objChildNode = new TreeNode();
                    objChild.Name = objXmlChild["name"].InnerText;
                    objChild.Category = objXmlChild["category"].InnerText;
                    objChild.Avail = "0";
                    objChild.Cost = "0";
                    objChild.Source = _strSource;
                    objChild.Page = _strPage;
                    objChild.Parent = this;
                    _objChildren.Add(objChild);

                    objChildNode.Text = objChild.DisplayName;
                    objChildNode.Tag = objChild.InternalId;
//.........这里部分代码省略.........
开发者ID:Rockzo,项目名称:chummer5a,代码行数:101,代码来源:Commlink.cs


注:本文中的System.Xml.XmlNode.TryGetField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。