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


C# XmlTextReader.IsStartElement方法代码示例

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


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

示例1: GetText

    public static string GetText(string key)
    {
        XmlTextReader reader = new XmlTextReader(new StringReader(copySource.text));

        string outString = "";

        // replace "EN" with language code, once implemented

        while(reader.Read()){
            if (reader.IsStartElement(key)){
                reader.ReadToFollowing("EN");
                outString = reader.ReadElementContentAsString("EN", reader.NamespaceURI);
            }
        }

        return outString;
    }
开发者ID:chorgan93,项目名称:selfportraitoftheartist,代码行数:17,代码来源:TextSource.cs

示例2: ReadLocale

    private void ReadLocale(XmlTextReader reader)
    {
        TransfluentUtility util = TransfluentUtility.GetInstance();

        while (reader.Read())
        {
            if (reader.IsStartElement())
            {
                //util.AddMessage("Start locale entry element: " + reader.Name);

                if (reader.Name.Equals("id"))
                {
                    string id = reader.ReadString();
                    if (!int.TryParse(id, out m_languageId))
                        util.AddError("Couldn't parse language id from '" + id + "'");
                }
                if (reader.Name.Equals("code"))
                    m_languageCode = reader.ReadString();
                if (reader.Name.Equals("name"))
                    m_languageName = reader.ReadString();
                if (reader.Name.Equals("texts"))
                    ReadTexts(reader);
            }
            else if (reader.Name.Equals("locale"))
            {
                // Done reading locale
                //util.AddMessage("End of locale");
                break;
            }
            else
                util.AddWarning("Unexpected element closed: " + reader.Name);
        }

        if (m_languageId == -1)
            util.AddError("Couldn't parse language id");
        if (m_languageCode == null)
            util.AddError("Couldn't parse language code");
        if (m_languageName == null)
            util.AddError("Couldn't parse language name");
        if (m_texts.Count == 0)
            util.AddWarning("No texts parsed or found");
    }
开发者ID:greendogs,项目名称:Transfluent-Unity,代码行数:42,代码来源:TransfluentLozalization.cs

示例3: LoadItems

    public List<House.Item> LoadItems(string toRead, List<House.Item> list)
    {
        House.Item temp = new House.Item();
        House.Item temp1;

        int i = 0;
        using (XmlReader reader = new XmlTextReader(new System.IO.StringReader(toRead)))
        {
            while (reader.Read())
            {
                // Only detect start elements.
                if (reader.IsStartElement())
                {
                    // Get element name and switch on it.
                    switch (reader.Name)
                    {
                        case "Item":
                            temp1 = list[i];
                            temp.usage = temp1.usage;
                            temp.state = temp1.state;

                            break;
                        case "Type":
                            if (reader.Read())
                            {
                                temp.type = int.Parse(reader.Value.Trim());
                            }
                            break;
                        case "ID":
                            if (reader.Read())
                            {
                                temp.id = int.Parse(reader.Value.Trim());
                            }
                            break;
                        case "Name":
                            if (reader.Read())
                            {
                                temp.name = reader.Value.Trim();
                            }
                            break;
                        case "PositionX":
                            if (reader.Read())
                            {
                                temp.position.x = int.Parse(reader.Value.Trim());
                            }
                            break;
                        case "PositionY":
                            if (reader.Read())
                            {
                                temp.position.y = int.Parse(reader.Value.Trim());
                            }
                            break;
                        case "Floor":
                            if (reader.Read())
                            {
                                temp.floor = int.Parse(reader.Value.Trim());
                            }
                            list[i] = temp;
                            i++;
                            break;
                    }
                }
            }
        }
        return list;
    }
开发者ID:JonasMH,项目名称:Teknologi13Client,代码行数:66,代码来源:LoadHouse.cs

示例4: LoadStandardOperatingProcedure

    public void LoadStandardOperatingProcedure(String xmlToLoadFileName)
    {
        if (File.Exists(ServerPath + SopFolder + xmlToLoadFileName))
        {
            var data = new List<StandardOperatingProcedureData>();
            using (XmlTextReader reader = new XmlTextReader(ServerPath + SopFolder + xmlToLoadFileName))
            {
                string ID = null;
                string title = null;
                bool? isMetadata = null;
                bool? isRequired = null;
                string value = null;
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "SOPTitle":
                                if (reader.Read())
                                {
                                    this.Title = reader.Value.Trim();
                                }
                                break;

                            case "ID":
                                if (reader.Read())
                                {
                                    ID = reader.Value.Trim();
                                }
                                break;

                            case "Title":
                                if (reader.Read())
                                {
                                    title = reader.Value.Trim();
                                }
                                break;

                            case "IsMetadata":
                                if (reader.Read())
                                {
                                    switch (reader.Value.Trim().ToLower())
                                    {
                                        case "false":
                                            isMetadata = false;
                                            break;

                                        case "true":
                                            isMetadata = true;
                                            break;

                                        default:
                                            throw new FileFormatException("Error: True/false incorrectly specified for field IsMetadata of data ID " + ID + " in " + xmlToLoadFileName + ".");
                                    }
                                }
                                break;

                            case "IsRequired":
                                if (reader.Read())
                                {
                                    switch (reader.Value.Trim().ToLower())
                                    {
                                        case "false":
                                            isRequired = false;
                                            break;

                                        case "true":
                                            isRequired = true;
                                            break;

                                        default:
                                            throw new FileFormatException("Error: True/false incorrectly specified for field IsRequired of data ID " + ID + " in " + xmlToLoadFileName + ".");
                                    }
                                }
                                break;

                            case "Value":
                                if (reader.Read() && reader.NodeType == XmlNodeType.CDATA)
                                {
                                    value = reader.Value;
                                }
                                break;

                            default:
                                break;
                        }
                    }
                    if (!String.IsNullOrWhiteSpace(ID) && !String.IsNullOrEmpty(title) && isMetadata != null && isRequired != null && value != null)
                    {
                        data.Add(new StandardOperatingProcedureData(ID, title, (bool)isMetadata, (bool)isRequired, value));
                        ID = null;
                        title = null;
                        isMetadata = null;
                        isRequired = null;
                        value = null;
                    }
                }
            }
            this.Data = data;
//.........这里部分代码省略.........
开发者ID:michaelbmorris,项目名称:StandardOperatingProcedureManager,代码行数:101,代码来源:StandardOperatingProcedure.cs

示例5: LoadData

    public void LoadData()
    {
        int setIndex = 0;

        if (!File.Exists(savePath))
        {
            Debug.Log("PlayerInfo.xml not found @ " + savePath);
            return;
        }
        else
        {
            Debug.Log("Loading PlayerInfo.xml @ \n" + savePath);
        }

        XmlReader reader = new XmlTextReader (savePath);

        items.Clear();

        while (reader.Read())
        {
            if (reader.IsStartElement() && reader.NodeType == XmlNodeType.Element)
            {
                switch (reader.Name)
                {
                    case "bDisplayTutorial":
                    {
                        bDisplayTutorial = bool.Parse(reader.ReadElementString());
                        break;
                    }
                    case "CurrentScene":
                    {
                        currentScene = reader.ReadElementString();
                        break;
                    }
                    case "PlayerPos":
                    {
                        float x = float.Parse(reader.GetAttribute(0));
                        float y = float.Parse(reader.GetAttribute(1));
                        float z = float.Parse(reader.GetAttribute(2));

                        playerPos = new Vector3 (x, y, z);
                        break;
                    }
                    case "CameraPos":
                    {
                        float x = float.Parse(reader.GetAttribute(0));
                        float y = float.Parse(reader.GetAttribute(1));
                        float z = float.Parse(reader.GetAttribute(2));

                        cameraPos = new Vector3 (x, y, z);
                        break;
                    }
                    case "Item":
                    {
                        items.Add(new Item());
                        setIndex = items.Count - 1;
                        break;
                    }
                    case "ItemName":
                    {
                        items[setIndex].itemName = reader.ReadElementString();
                        break;
                    }
                    case "ItemID":
                    {
                        items[setIndex].itemID = int.Parse(reader.ReadElementString());
                        break;
                    }
                    case "ItemDescription":
                    {
                        items[setIndex].itemDescription = reader.ReadElementString();
                        break;
                    }
                    case "SpriteName":
                    {
                        items[setIndex].spriteName = reader.ReadElementString();
                        break;
                    }
                    case "HasItem":
                    {
                        items[setIndex].hasItem = bool.Parse(reader.ReadElementString());
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
        }
    }
开发者ID:jcabe4,项目名称:Reignite,代码行数:91,代码来源:PlayerInformation.cs

示例6: GetCharacterInfo


//.........这里部分代码省略.........
			char_info.vert.width /= FontScale;
			char_info.vert.height /= FontScale;
			char_info.width /= FontScale;

			if (font_char_info.width == 0)
				// Invisible character info returned because character is not contained within the font
				Debug.LogWarning("Character '" + GetHumanReadableCharacterString(m_character) + "' not found. Check that font '" + m_font.name + "' supports this character.");

			return true;
		}
#endif

		if (m_font_data_file != null)
		{
			if (m_custom_font_data == null || !m_font_data_file.name.Equals(m_current_font_data_file_name))
				// Setup m_custom_font_data for the custom font.
#if !UNITY_WINRT
				if (m_font_data_file.text.Substring(0, 5).Equals("<?xml"))
				{
					// Text file is in xml format

					m_current_font_data_file_name = m_font_data_file.name;
					m_custom_font_data = new CustomFontCharacterData();

					var reader = new XmlTextReader(new StringReader(m_font_data_file.text));

					var texture_width = 0;
					var texture_height = 0;
					int uv_x, uv_y;
					float width, height, xoffset, yoffset, xadvance;
					CustomCharacterInfo character_info;

					while (reader.Read())
						if (reader.IsStartElement())
							if (reader.Name.Equals("common"))
							{
								texture_width = int.Parse(reader.GetAttribute("scaleW"));
								texture_height = int.Parse(reader.GetAttribute("scaleH"));

								m_font_baseline = int.Parse(reader.GetAttribute("base"));
							}
							else if (reader.Name.Equals("char"))
							{
								uv_x = int.Parse(reader.GetAttribute("x"));
								uv_y = int.Parse(reader.GetAttribute("y"));
								width = float.Parse(reader.GetAttribute("width"));
								height = float.Parse(reader.GetAttribute("height"));
								xoffset = float.Parse(reader.GetAttribute("xoffset"));
								yoffset = float.Parse(reader.GetAttribute("yoffset"));
								xadvance = float.Parse(reader.GetAttribute("xadvance"));

								character_info = new CustomCharacterInfo();
								character_info.flipped = false;
								character_info.uv = new Rect(uv_x / (float)texture_width, 1 - (uv_y / (float)texture_height) - height / texture_height, width / texture_width, height / texture_height);
								character_info.vert = new Rect(xoffset, -yoffset, width, -height);
								character_info.width = xadvance;

								m_custom_font_data.m_character_infos.Add(int.Parse(reader.GetAttribute("id")), character_info);
							}
				}
				else
#endif
					if (m_font_data_file.text.Substring(0, 4).Equals("info"))
					{
						// Plain txt format
						m_current_font_data_file_name = m_font_data_file.name;
开发者ID:jporter19,项目名称:TeamStyle16_3D,代码行数:67,代码来源:EffectManager.cs

示例7: Load

	// Use this for initialization
	public static void Load () {
		using(XmlTextReader reader = new XmlTextReader("strijps"))
//		using (XmlReader reader = XmlReader.Create("Assets/Maps/andorra"))
		{
			while (reader.Read())
			{
				// Only detect start elements.
				if (reader.IsStartElement())
				{
					//Debug.Log (reader.Name);
					// Get element name and switch on it.
					switch (reader.Name)
					{
					case "osm":
						// Detect this element.
						break;
					case "bounds":
						break;
					case "node":
						long nodeId = long.Parse (reader ["id"]);
						float lat = float.Parse (reader ["lat"]);
						float lon = float.Parse (reader ["lon"]);

						List<OsmTag> nodeTags = new List<OsmTag> ();
						XmlReader nodeSubtree = reader.ReadSubtree ();
						readNodeSubtree (nodeSubtree, nodeTags);
						OsmNode node = new OsmNode (nodeId, nodeTags, lon, lat);
						Data.Instance.nodes.Add (nodeId, node);
						break;
					case "tag":
						break;
					case "member": 
						break;
					case "nd":
						break;
					case "way":
						long wayId = long.Parse (reader ["id"]);
						List<OsmTag> wayTags = new List<OsmTag> ();
						List<OsmNodeReference> wayNodes = new List<OsmNodeReference> ();
						XmlReader waySubtree = reader.ReadSubtree ();
						readWaySubtree (waySubtree, wayNodes, wayTags);
						OsmWay way = new OsmWay (wayId, wayTags, wayNodes);
						foreach (OsmTag tag in wayTags) {
							if (tag.getKey () == "building") {
								Data.Instance.buildings.Add (wayId, new OsmBuilding (wayId, wayTags, wayNodes));
							}
							if (tag.getKey () == "highway") {
								Data.Instance.streets.Add (wayId, new OsmStreet (wayId, wayTags, wayNodes));
							}
							if (tag.getKey () == "landuse" || tag.getKey() == "natural"  ){ //|| tag.getKey() == "surface") {
								if (!Data.Instance.surfaces.ContainsKey(wayId))
									Data.Instance.surfaces.Add (wayId, new OsmSurface (wayId, wayTags, wayNodes, tag.getValue()));
							}
						}
						Data.Instance.ways.Add(wayId, way);
						break;
					case "relation": 
						long relationId = long.Parse (reader ["id"]);
						List<OsmRelationMember> members = new List<OsmRelationMember> ();
						List<OsmTag> relationTags = new List<OsmTag> ();
						XmlReader relationSubtree = reader.ReadSubtree ();
						readRelationSubtree (relationSubtree, members, relationTags);
						OsmRelation relation = new OsmRelation (relationId, relationTags, members);
						Data.Instance.relations.Add(relationId, relation);
						break;
					default:
						Debug.Log (reader.Name);
						break;
					}


				}
			}
		}
		foreach(long key in Data.Instance.ways.Keys)
		{
			OsmWay w = (OsmWay) Data.Instance.ways[key];
			for(int i = 0; i < w.getNumberOfNodes(); i++) {
				OsmNodeReference nodeRef = w.getNodeReference (i);
				if (!Data.Instance.nodes.ContainsKey (nodeRef.getId ()))
					continue;
				OsmNode n = (OsmNode) Data.Instance.nodes [nodeRef.getId()];
				n.addContainedIn (w);
				nodeRef.setLattitudeAndLongitude (n.getLatitude (), n.getLongitude ());
			}
		}
		Debug.Log ("Nodes: " + Data.Instance.nodes.Count);
		Debug.Log ("Ways: " + Data.Instance.ways.Count);
		Debug.Log ("Relations: " + Data.Instance.relations.Count);
		Debug.Log("Buildings: " + Data.Instance.buildings.Count);
		Debug.Log("Streets: " + Data.Instance.streets.Count);
			
		Debug.Log ("Done");
		Data.Instance.dataLoaded = true;
	}
开发者ID:Zilarion,项目名称:2IMV10-Procedural-city-generation,代码行数:96,代码来源:LoadData.cs

示例8: LoadFromXML

	public void LoadFromXML(System.IO.Stream oStream)
	{
		xtr = new System.Xml.XmlTextReader(oStream);

		while (xtr.Read())
		{
			if (xtr.IsStartElement())
			{
				if ((xtr.LocalName.ToUpper() == "TREEVIEWSTYLES") && (this.TreeViewStyle))
					LoadObject(oTV, xtr.ReadInnerXml(), oTV.Style.NodeStyle);

				if ((xtr.LocalName.ToUpper() == "TREEVIEWCONTENT") && (this.TreeViewContent))
					LoadNodes(oTV, xtr.ReadInnerXml());
			}
		}
	}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:16,代码来源:TreeViewXML.cs

示例9: LoadFileDesc

 // Load language file description
 private string LoadFileDesc(string File)
 {
     XmlTextReader xmlr = new XmlTextReader(File);
     xmlr.WhitespaceHandling = WhitespaceHandling.None;
     try {
         while (!xmlr.EOF) {
             xmlr.Read();
             if (xmlr.IsStartElement() && xmlr.Name == "ew-language")
                 return xmlr.GetAttribute("desc");
         }
     }	finally {
         xmlr.Close();
     }
     return "";
 }
开发者ID:sxsistemax,项目名称:ControlVehicular,代码行数:16,代码来源:aspxfn9.cs

示例10: LoadNodes

	private void LoadNodes(object objParent, string sXML)
	{
		if (sXML.Length == 0) return;

		XmlTextReader tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);

		while (tr.ReadState != ReadState.EndOfFile)
		{

			while (tr.Read())
				if (tr.IsStartElement()) break;

			string ElementName = tr.LocalName;

			if (ElementName.Length == 0) break;

			switch (ElementName.ToUpper())
			{
				case "BEHAVIOR" :

					for (int i = 0; i < tr.AttributeCount; i++)
					{						

						tr.MoveToAttribute(i);						

						SetProperty(oTV, tr.Name, tr.Value);

					}
					
					break;

				case "NODE" :

					while (tr.ReadState != ReadState.EndOfFile)
					{
						if (tr.LocalName.ToUpper() == "NODE")
						{
							Node n = null;

							string s = tr.ReadOuterXml();

							if (s.Length > 0)
							{
								n = LoadNode(s);
					
								if (n != null) oTV.Nodes.Add(n);
							}
						}
						else tr.Read();
					}

					break;
			}

		}
	}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:56,代码来源:TreeViewXML.cs

示例11: ReadTexts

    private void ReadTexts(XmlTextReader reader)
    {
        TransfluentUtility util = TransfluentUtility.GetInstance();

        while (reader.Read())
        {
            if (reader.IsStartElement())
            {
                if (reader.Name.Equals("text"))
                {
                    //util.AddMessage("Text entry found");
                    ReadText(reader);
                }
                else
                    util.AddWarning("Unexpected element started: " + reader.Name);
            }
            else if (reader.Name.Equals("texts"))
            {
                // Done reading texts
                //util.AddMessage("End of texts");
                break;
            }
            else
                util.AddWarning("Unexpected element closed: " + reader.Name);
        }
    }
开发者ID:greendogs,项目名称:Transfluent-Unity,代码行数:26,代码来源:TransfluentLozalization.cs

示例12: ReadXML

    private void ReadXML(string filePath)
    {
        TransfluentUtility util = TransfluentUtility.GetInstance();

        //util.AddWarning("Reading " + filePath);

        XmlTextReader reader = new XmlTextReader(filePath);

        while (reader.Read())
        {
            if (reader.IsStartElement())
            {
                if (reader.IsEmptyElement)
                    util.AddMessage("Empty element: " + reader.Name);
                else
                {
                    if (reader.Name.Equals("locale"))
                        ReadLocale(reader);
                    else
                        util.AddMessage("Start of an element: " + reader.Name);
                }
            }
            else
            {
                util.AddMessage("End of an element: " + reader.Name);
            }
        }

        util.AddMessage("Done reading " + filePath + "\nLanguage Id=" + m_languageId + ", Code='" + m_languageCode + "', Name='" + m_languageName + "', Found " + m_texts.Count + " text entries");
    }
开发者ID:greendogs,项目名称:Transfluent-Unity,代码行数:30,代码来源:TransfluentLozalization.cs

示例13: ReadText

    private void ReadText(XmlTextReader reader)
    {
        TransfluentUtility util = TransfluentUtility.GetInstance();

        string textId = null;
        string textString = null;

        while (reader.Read())
        {
            if (reader.IsStartElement())
            {
                //util.AddMessage("Start text entry element: " + reader.Name);

                if (reader.Name.Equals("textId"))
                    textId = reader.ReadString();
                else if (reader.Name.Equals("textString"))
                    textString = reader.ReadString();
                else
                    util.AddWarning("Unexpected element started: " + reader.Name);
            }
            else if (reader.Name.Equals("text"))
            {
                // Done reading this element
                //util.AddMessage("End of text entry");
                break;
            }
            else
                util.AddWarning("Unexpected element closed: " + reader.Name);
        }

        if (textId != null && textString != null)
        {
            //util.AddMessage("XML: Found text entry: Id='" + textId + "', String='" + textString + "'");
            m_texts.Add(textId, textString);
        }
        else
            util.AddError("XML: Error reading text entry: Id='" + textId + "', String='" + textString + "'");
    }
开发者ID:greendogs,项目名称:Transfluent-Unity,代码行数:38,代码来源:TransfluentLozalization.cs

示例14: LoadData

    //Used for loading saved player information
    public void LoadData()
    {
        XMLFileManager.DecryptFile(savePath);

        XmlReader reader = new XmlTextReader(savePath);
        while(reader.Read())
        {
            if(reader.IsStartElement() && reader.NodeType == XmlNodeType.Element)
            {
                switch(reader.Name)
                {
                    case "deviceID":
                        deviceID = reader.ReadElementString();
                        break;
                    case "ship":
                        ship = reader.ReadElementString();
                        break;
                    case "playerPosition":
                        string[] positions = reader.ReadElementString().Split(',');
                        transform.position = new Vector2(float.Parse(positions[0]), float.Parse(positions[1]) );
                        break;
                    case "maxHealth":
                        maxHealth = int.Parse(reader.ReadElementString());
                        break;
                    case "currentHealth":
                        currentHealth = int.Parse(reader.ReadElementString());
                        break;
                    case "maxShields":
                        maxShields = int.Parse(reader.ReadElementString());
                        break;
                    case "currentShields":
                        currentShields = int.Parse(reader.ReadElementString());
                        break;
                    case "shieldRechargeDelay":
                        shieldRechargeDelay = int.Parse(reader.ReadElementString());
                        break;
                    case "shieldRechargeRate":
                        shieldRechargeRate = int.Parse(reader.ReadElementString());
                        break;
                    case "maxFuel":
                        maxFuel = float.Parse(reader.ReadElementString());
                        break;
                    case "currentFuel":
                        currentFuel = float.Parse(reader.ReadElementString());
                        break;
                    case "fuelConsumptionRate":
                        fuelConsumptionRate = float.Parse(reader.ReadElementString());
                        break;
                    case "acceleration":
                        acceleration = float.Parse(reader.ReadElementString());
                        break;
                    case "speed":
                        speed = float.Parse(reader.ReadElementString());
                        break;
                    case "maxSpeed":
                        maxSpeed = float.Parse(reader.ReadElementString());
                        break;
                    case "thrusterDelay":
                        thrusterDelay = float.Parse(reader.ReadElementString());
                        break;
                    case "rotationSpeed":
                        rotationSpeed = float.Parse(reader.ReadElementString());
                        break;
                    case "currentWeapon":
                        WeaponManager.Instance.ChangeStartUpAmmoType( (WeaponManager.ammoType)Enum.Parse(typeof(WeaponManager.ammoType),reader.ReadElementString()));
                        break;
                    case "currentMaxAmmo":
                        WeaponManager.Instance.MaxAmmo = float.Parse(reader.ReadElementString());
                        break;
                    case "currentAmmo":
                        WeaponManager.Instance.CurrentAmmo = float.Parse(reader.ReadElementString());
                        break;
                    case "beam_MAX":
                        WeaponManager.Instance.totalMaxAmmo[WeaponManager.ammoType.beam] = float.Parse(reader.ReadElementString());
                        break;
                    case "chaser_MAX":
                        WeaponManager.Instance.totalMaxAmmo[WeaponManager.ammoType.chaser] = float.Parse(reader.ReadElementString());
                        break;
                    case "standard_MAX":
                        WeaponManager.Instance.totalMaxAmmo[WeaponManager.ammoType.standard] = float.Parse(reader.ReadElementString());
                        break;
                    case "beam_CURRENT":
                        WeaponManager.Instance.totalCurrentAmmo[WeaponManager.ammoType.beam] = float.Parse(reader.ReadElementString());
                        break;
                    case "chaser_CURRENT":
                        WeaponManager.Instance.totalCurrentAmmo[WeaponManager.ammoType.chaser] = float.Parse(reader.ReadElementString());
                        break;
                    case "standard_CURRENT":
                        WeaponManager.Instance.totalCurrentAmmo[WeaponManager.ammoType.standard] = float.Parse(reader.ReadElementString());
                        break;
                    default:
                        Debug.Log(reader.Name);
                        break;
                }
            }
        }

        reader.Close();

//.........这里部分代码省略.........
开发者ID:Jetblacktsunami,项目名称:CSE455-Salvage,代码行数:101,代码来源:PlayerInformation.cs

示例15: LoadNode

	private Node LoadNode(string sXML)
	{
		Node ReturnedNode = null;

		if (sXML.Length == 0) return ReturnedNode;

		ReturnedNode = new Node();
		ReturnedNode.TreeView = oTV;

		XmlTextReader tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);		

		while (tr.Read())
			if (tr.IsStartElement()) break;

		//nastavi atributy nodu
		for (int i = 0; i < tr.AttributeCount; i++)
		{

			tr.MoveToAttribute(i);

			SetProperty(ReturnedNode, tr.Name, tr.Value);

		}

		bool NextElement = true;


		while (NextElement)
		{
			while (tr.Read())
				if (tr.IsStartElement()) break;

			string ElementName = tr.LocalName;

			if (ElementName.Length == 0) break;

			switch (ElementName.ToUpper())
			{
				case "TEXT" :
					string s = this.LoadMultiLineText(tr.ReadString());
					
					SetProperty(ReturnedNode, "Text", s);

					break;

				case "FLAG" :
					for (int i = 0; i < tr.AttributeCount; i++)
					{
						tr.MoveToAttribute(i);

						SetProperty(ReturnedNode.Flag, tr.Name, tr.Value);
					}
					break;

				case "NODESTYLE" :
					this.LoadObject(ReturnedNode, tr.ReadOuterXml(), ReturnedNode.NodeStyle);
					break;

				case "NODE" :				
					Node n = LoadNode(tr.ReadOuterXml());					
					if (n != null)
					{
						ReturnedNode.Nodes.Add(n);
						//n.Parent = ReturnedNode;
						//n.TreeView = ReturnedNode.TreeView;
					}
					break;

			}
		}

		return ReturnedNode;
	}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:73,代码来源:TreeViewXML.cs


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