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


C# XmlElement.SelectNodes方法代码示例

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


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

示例1: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            names = element.SelectNodes("name"),
            briefs = element.SelectNodes("brief"),
            detaileds = element.SelectNodes("detailed"),
            conditions = element.SelectNodes("condition");

        string tmpArgVal;
        foreach (XmlElement el in names)
        {
            string soundPath = "";

            tmpArgVal = el.GetAttribute("soundPath");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                soundPath = tmpArgVal;
            }
            description.setNameSoundPath(soundPath);
            description.setName(el.InnerText);
        }

        foreach (XmlElement el in briefs)
        {
            string soundPath = "";

            tmpArgVal = el.GetAttribute("soundPath");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                soundPath = tmpArgVal;
            }
            description.setDescriptionSoundPath(soundPath);
            description.setDescription(el.InnerText);
        }
        foreach (XmlElement el in detaileds)
        {
            string soundPath = "";

            tmpArgVal = el.GetAttribute("soundPath");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                soundPath = tmpArgVal;
            }
            description.setDetailedDescriptionSoundPath(soundPath);
            description.setDetailedDescription(el.InnerText);
        }
        foreach (XmlElement el in conditions)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            this.description.setConditions(currentConditions);
        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:53,代码来源:DescriptionsSubParser_.cs

示例2: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            conditions = element.SelectNodes("condition");

        string tmpArgVal;

        int x = 0, y = 0, width = 0, height = 0;

        tmpArgVal = element.GetAttribute("x");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            x = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("y");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            y = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("width");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            width = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("height");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            height = int.Parse(tmpArgVal);
        }
        barrier = new Barrier(generateId(), x, y, width, height);

        if (element.SelectSingleNode("documentation") != null)
            barrier.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement ell in conditions)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
            this.barrier.setConditions(currentConditions);
        }

        scene.addBarrier(barrier);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:43,代码来源:BarrierSubParser_.cs

示例3: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            assets,
            conditions,
            effects,
            postseffects,
            notseffect,
            defaultsinitialsposition = element.SelectNodes("default-initial-position"),
            exits = element.SelectNodes("exits/exit"),
            exitslook,
            nextsscene = element.SelectNodes("next-scene"),
            points,
            objectsrefs = element.SelectNodes("objects/object-ref"),
            charactersrefs = element.SelectNodes("characters/character-ref"),
            atrezzosrefs = element.SelectNodes("atrezzo/atrezzo-ref"),
            activesareas = element.SelectNodes("active-areas/active-area"),
            barriers = element.SelectNodes("barrier"),
            trajectorys = element.SelectNodes("trajectory");

        string tmpArgVal;

        string sceneId = "";
        bool initialScene = false;
        int playerLayer = -1;
        float playerScale = 1.0f;

        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            sceneId = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("start");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            initialScene = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("playerLayer");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            playerLayer = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("playerScale");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            playerScale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture);
        }

        scene = new Scene(sceneId);
        scene.setPlayerLayer(playerLayer);
        scene.setPlayerScale(playerScale);
        if (initialScene)
            chapter.setTargetId(sceneId);

        if (element.SelectSingleNode("name") != null)
            scene.setName(element.SelectSingleNode("name").InnerText);
        if (element.SelectSingleNode("documentation") != null)
            scene.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(tmpArgVal));
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
                currentResources.addAsset(type, path);
            }

            conditions = el.SelectNodes("condition");
            foreach (XmlElement ell in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
                currentResources.setConditions(currentConditions);
            }

            scene.addResources(currentResources);
        }

        foreach (XmlElement el in defaultsinitialsposition)
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:SceneSubParser_.cs

示例4: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            descriptionss = element.SelectNodes("description"),
            assets,
            conditions,
            actionss = element.SelectNodes("actions"),
            effects = element.SelectNodes("effect");

        string tmpArgVal;

        string parsedObjectId = "";
        bool returnsWhenDragged = true;

        Item.BehaviourType behaviour = Item.BehaviourType.NORMAL;
        long resourceTransition = 0;

        if (element.SelectSingleNode("documentation") != null)
            parsedObject.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            parsedObjectId = tmpArgVal;
        }

        tmpArgVal = element.GetAttribute("returnsWhenDragged");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            returnsWhenDragged = (tmpArgVal.Equals("yes") ? true : false);
        }

        tmpArgVal = element.GetAttribute("behaviour");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal.Equals("normal"))
            {
                behaviour = Item.BehaviourType.NORMAL;
            }
            else if (tmpArgVal.Equals("atrezzo"))
            {
                behaviour = Item.BehaviourType.ATREZZO;
            }
            else if (tmpArgVal.Equals("first-action"))
            {
                behaviour = Item.BehaviourType.FIRST_ACTION;
            }
        }

        tmpArgVal = element.GetAttribute("resources-transition-time");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            resourceTransition = long.Parse(tmpArgVal);
        }

        parsedObject = new Item(parsedObjectId);
        parsedObject.setReturnsWhenDragged(returnsWhenDragged);

        parsedObject.setResourcesTransitionTime(resourceTransition);
        parsedObject.setBehaviour(behaviour);

        descriptions = new List<Description>();
        parsedObject.setDescriptions(descriptions);

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(tmpArgVal));
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
                currentResources.addAsset(type, path);
            }

            conditions = el.SelectNodes("condition");
            foreach (XmlElement ell in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
                currentResources.setConditions(currentConditions);
            }
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:ItemSubParser_.cs

示例5: initPrintInfo

 /// <summary>
 /// 从模板信息中提取初始化打印区域信息
 /// </summary>
 /// <param name="xeTemplate"></param>
 private void initPrintInfo(XmlElement xeTemplate)
 {
     if (null == xeTemplate)
         return;
     //初始化规则信息
     XmlNodeList xnCommentList = xeTemplate.SelectNodes("//ss:Comment", this.xmlNsMgl);
     foreach (XmlNode xn in xnCommentList)
     {
         XmlElement xeComment = xn as XmlElement;
         if (null == xeComment) continue;
         PrintInfo pinfo = PrintInfo.SerialFromString(xeComment.InnerText);
         if (null == pinfo) continue;
         if (string.IsNullOrEmpty(pinfo.DbName))
             continue;
         if (this.printInfoList.Keys.Contains(pinfo.DbName))
             this.printInfoList[pinfo.DbName] = pinfo;
         else
             this.printInfoList.Add(pinfo.DbName, pinfo);
         xeComment.ParentNode.RemoveChild(xeComment);
     }
     foreach (PrintInfo p in this.printInfoList.Values)
         this.printInfos.Add(p);
     //重排打印区顺序,按照行号,列号,分组排序;同组排在一起,以最靠前的组内项为分组位置
     for (int i = 1; i < this.printInfos.Count; i++)
     {
         PrintInfo prevInfo = this.printInfos[i - 1];
         PrintInfo currInfo = this.printInfos[i];
         int indexgrp = -1, indexpos = -1;
         string grp = currInfo.GroupName;
         for (int j = 0; j < i; j++)
         {
             PrintInfo grpInfo = this.printInfos[j];
             //同组项
             if (grp == grpInfo.GroupName)
             {
                 indexgrp = j;
                 if (currInfo.PgBound.Top < grpInfo.PgBound.Top ||
                     (currInfo.PgBound.Top == grpInfo.PgBound.Top && currInfo.PgBound.Left < grpInfo.PgBound.Left))
                     break;
                 continue;
             }
             //非同组项的前一打印区
             if (indexpos > -1)
                 continue;
             if (currInfo.PgBound.Top < grpInfo.PgBound.Top ||
                 (currInfo.PgBound.Top == grpInfo.PgBound.Top && currInfo.PgBound.Left < grpInfo.PgBound.Left))
                 indexpos = j;
         }
         //重排打印顺序
         if (indexgrp > -1 && indexgrp < indexpos)
             indexpos = indexgrp;
         if (indexpos > -1 || indexgrp > -1)
         {
             this.printInfos.Remove(currInfo);
             if (indexgrp > -1 && (indexpos < 0 || indexgrp < indexpos))
                 this.printInfos.Insert(indexgrp, currInfo);
             else if (indexpos > -1)
             {
                 this.printInfos.Insert(indexpos, currInfo);
                 if (indexgrp > indexpos)
                     i = indexgrp;
             }
         }
     }//for (int i = 1; i < this.printInfos.Count; i++)
 }
开发者ID:thisisvoa,项目名称:GranityApp2.5,代码行数:69,代码来源:PrintExcel.cs

示例6: RefreshConfig

    public void RefreshConfig()
    {
        configdoc = XmlHelper.OpenDom( sFilePath );
            Diag.Debug("reading config.xml ...");

            XmlElement systemnode = (XmlElement)configdoc.DocumentElement.SelectSingleNode( "config");
            iDebugLevel = GetInt( systemnode, "debuglevel");
            Diag.Debug("DebugLevel " + iDebugLevel.ToString() );

            clientconfig = (XmlElement)configdoc.DocumentElement.SelectSingleNode( "client");

            XmlElement displaynode = clientconfig.SelectSingleNode("display") as XmlElement;
            windowwidth = GetInt(displaynode, "width");
            windowheight = GetInt(displaynode, "height");

            XmlElement mapconfig = clientconfig.SelectSingleNode("map") as XmlElement;
            iMapDefaultWidth = GetInt( mapconfig,"defaultwidth");
            iMapDefaultHeight = GetInt( mapconfig, "defaultheight");

            XmlElement heightmapconfig = clientconfig.SelectSingleNode("heightmap") as XmlElement;
            defaultHeightMapFilename = heightmapconfig.GetAttribute("defaultfilename" );
            minheight = GetInt( heightmapconfig, "minheight");
            maxheight = GetInt( heightmapconfig, "maxheight");

            XmlElement heighteditingconfig = clientconfig.SelectSingleNode("heightediting") as XmlElement;
            HeightEditingDefaultBrushSize = GetInt( heighteditingconfig, "defaultbrushsize");
            HeightEditingSpeed = GetDouble( heighteditingconfig, "speed");

            XmlElement slopemapconfig = clientconfig.SelectSingleNode("slopemap") as XmlElement;
            defaultSlopeMapFilename = slopemapconfig.GetAttribute("defaultfilename");
            SlopemapExportMaxSlope =  GetDouble( slopemapconfig, "exportmaxslope");
            foreach( XmlElement movementareanode in slopemapconfig.SelectNodes("movementareas/movementarea") )
            {
                double maxslope = Convert.ToDouble( movementareanode.GetAttribute("maxslope") );
                string colorstring = movementareanode.GetAttribute("color");
                Color color = new Color( 1,1,1);
                if( colorstring == "red" )
                {
                    color = new Color( 1,0,0);
                }
                else if (colorstring == "green")
                {
                    color = new Color( 0,1,0);
                }
                else if( colorstring == "blue" )
                {
                    color = new Color( 0,0,1);
                }
                movementareas.Add( new MovementAreaConfig( maxslope, color ) );
            }

            XmlElement movementconfig = clientconfig.SelectSingleNode("movement") as XmlElement;
            cameratranslatespeed =  GetDouble( movementconfig, "translatespeed");
            camerarotatespeed = GetDouble(movementconfig,"rotatespeed");

            foreach( XmlElement mappingnode in clientconfig.SelectNodes("keymappings/key") )
            {
                string sCommand = mappingnode.GetAttribute("command");
                string sKeyCodes = mappingnode.GetAttribute("keycode");
                string[] KeyCodes = sKeyCodes.Split("-".ToCharArray());
                List<string> keycodelist = new List<string>(KeyCodes);
                CommandCombos.Add( new CommandCombo( sCommand, keycodelist ) );
            }
            foreach (XmlElement mousemovenode in clientconfig.SelectNodes("mousemoveconfigs/mousemove"))
            {
                string name = mousemovenode.GetAttribute("name");
                string vertical = mousemovenode.GetAttribute("vertical");
                string horizontal = mousemovenode.GetAttribute("horizontal");
                string zoom = mousemovenode.GetAttribute("zoom");
                bool invertvertical = false;
                bool invertscroll = false;
                if (mousemovenode.HasAttribute("invertvertical") && mousemovenode.GetAttribute("invertvertical") == "yes")
                {
                    invertvertical = true;
                }
                if (mousemovenode.HasAttribute("invertscroll") && mousemovenode.GetAttribute("invertscroll") == "yes")
                {
                    invertscroll = true;
                }
                if (!MouseMoveConfigsByName.ContainsKey(name))
                {
                    MouseMoveConfigsByName.Add(name, new MouseMoveConfig(vertical, horizontal, zoom, invertvertical, invertscroll));
                }
            }

            Diag.Debug("... config.xml read");
    }
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:87,代码来源:Config.cs

示例7: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            nodes = element.SelectNodes("node"),
            sides = element.SelectNodes("side"),
            initialnodes = element.SelectNodes("initialnode");

        string tmpArgVal;

        foreach (XmlElement el in nodes)
        {
            int x = 0, y = 0;
            float scale = 1.0f;

            string id = "";

            tmpArgVal = el.GetAttribute("x");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                x = int.Parse(tmpArgVal);
            }
            tmpArgVal = el.GetAttribute("y");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                y = int.Parse(tmpArgVal);
            }
            tmpArgVal = el.GetAttribute("id");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                id = tmpArgVal;
            }
            tmpArgVal = el.GetAttribute("scale");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                scale = float.Parse(tmpArgVal, CultureInfo.InvariantCulture);
            }
            trajectory.addNode(id, x, y, scale);
        }

        foreach (XmlElement el in sides)
        {
            string idStart = "";
            string idEnd = "";
            int length = -1;

            tmpArgVal = el.GetAttribute("idStart");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                idStart = tmpArgVal;
            }
            tmpArgVal = el.GetAttribute("idEnd");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                idEnd = tmpArgVal;
            }
            tmpArgVal = el.GetAttribute("length");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                length = int.Parse(tmpArgVal);
            }

            trajectory.addSide(idStart, idEnd, length);
        }

        foreach (XmlElement el in initialnodes)
        {
            string id = "";

            tmpArgVal = el.GetAttribute("id");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                id = tmpArgVal;
            }

            trajectory.setInitial(id);
        }

        if (trajectory.getNodes().Count != 0)
        {
            trajectory.deleteUnconnectedNodes();
            scene.setTrajectory(trajectory);

        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:84,代码来源:TrajectorySubParser_.cs

示例8: BuildDataString

    /*
var data = [
    {
        label: 'node1',
        children: [
            { label: 'child1' },
            { label: 'child2' }
        ]
    },
    {
        label: 'node2',
        children: [
            { label: 'child3' }
        ]
    }
];
     * * */
    static void BuildDataString(XmlElement parent,
        string strBaseDir,
        StringBuilder text)
    {
        if (parent.Name == "dir" || parent.Name == "report")
        {
            string strLink = parent.GetAttribute("link");

            string strName = parent.GetAttribute("name");
            if (parent.Name == "dir")
            {
                // strName = GetDisplayTimeString(strName);
            }
            else
                strName = "□ " + strName;
#if NO
            if (Path.GetExtension(strLink) == ".xlsx" == true)
                strName += " (Excel)";
#endif

            text.Append(" { \"label\" : " + BuildJSONString(strName) + " ");

            if (string.IsNullOrEmpty(strLink) == false
                && string.IsNullOrEmpty(strBaseDir) == false)
            {
                strLink = Path.Combine(strBaseDir, CutLinkHead(strLink));
            }

            // .rml 修改为 .html
            if (string.Compare(Path.GetExtension(strLink), ".rml", true) == 0)
                strLink = Path.Combine(Path.GetDirectoryName(strLink), Path.GetFileNameWithoutExtension(strLink) + ".html").Replace("\\", "/");

            if (parent.Name == "report")
                text.Append(" , \"url\" : " + BuildJSONString(strLink) + " ");
            if (parent.Name == "dir" && string.IsNullOrEmpty(strLink) == false)
            {
                // TODO: 直接给出能便于找到 131 的 index.xml 的线索路径
                // link=".\201401\table_131"
                // text.Append(" , \"start\" : " + BuildJSONString(strLink));
                text.Append(" , \"id\" : " + BuildJSONString(strLink));
                text.Append(" , \"load_on_demand\" : true ");
            }
        }

        List<XmlElement> children = new List<XmlElement>();

        XmlNodeList nodes = parent.SelectNodes("report");
        foreach (XmlElement node in nodes)
        {
            children.Add(node);
        }

        {
            List<XmlElement> temp = new List<XmlElement>();
            nodes = parent.SelectNodes("dir");
            if (nodes.Count > 0)
            {
                foreach (XmlElement node in nodes)
                {
                    temp.Add(node);
                }
                temp.Reverse();
                children.AddRange(temp);
            }
        }

        if (children.Count > 0)
        {
            if (parent.Name == "dir" || parent.Name == "report")
                text.Append(", \"children\" :");

            if (parent.Name == "dir" || parent.Name == "report")
                text.Append("[ ");
            int i = 0;
            foreach (XmlElement child in children)
            {
                if (i > 0)
                    text.Append(", ");
                BuildDataString(child, strBaseDir, text);
                i++;
            }
            if (parent.Name == "dir" || parent.Name == "report")
                text.Append(" ]");
//.........这里部分代码省略.........
开发者ID:renyh1013,项目名称:dp2,代码行数:101,代码来源:Report.aspx.cs

示例9: WriteNodeRaw

	public static void WriteNodeRaw(XmlElement node, string method, XmlTextWriter output) {
		if (node.Name == "string") {
			output.WriteString(node.InnerText + "\n");
			return;
		} else if (node.Name == "Text") {
			output.WriteString(node.Value);
			return;
		} else if (node.Name == "Attribute") {
			output.WriteAttributeString(node.GetAttribute("Name"), "", node.InnerText);
			return;
		} else if (node.Name != "Element") {
			output.WriteStartElement(node.Name);
		} else {
			output.WriteStartElement(node.GetAttribute("Name"));
		}

		foreach (XmlNode child in node.SelectNodes("@*|*")) {
			if (child is XmlAttribute && child.Name == "Status")
				continue;
			child.WriteTo(output);
		}
		
		if (node.FirstChild is XmlText)
			output.WriteString(node.FirstChild.Value);
		
		output.WriteEndElement();
	}
开发者ID:xxjeng,项目名称:nuxleus,代码行数:27,代码来源:XmlDiff.cs

示例10: buildTargets

    /*
    private void buildTargets() {
        if (destinations.Count != 0) {
            foreach (var dest in destinations) {
                AreaGeometry.create (dest.GetAttribute ("name"), parsePoints (dest));
            }
        }
    }

    private void buildSources() {
        if (origins.Count != 0) {
            foreach (var origin in origins) {
                AreaGeometry.create (origin.GetAttribute ("name"), parsePoints (origin));
            }
        }
    }

    private void buildObstacles() {
        if (openWalls.Count != 0) {
            foreach (var wall in openWalls) {
                WallExtrudeGeometry.create (wall.GetAttribute ("name"), parsePoints (wall), height,-0.2f);
            }
        }
        if (obstacles.Count != 0) {
            foreach (var obstacle in obstacles) {
                ObstacleExtrudeGeometry.create (obstacle.GetAttribute ("name"), parsePoints (obstacle), height);
            }
        }
        if (walls.Count != 0) {
            foreach (var wall in walls) {
                ObstacleExtrudeGeometry.create (wall.GetAttribute ("name"), parsePoints (wall), height);
            }
        }
    }

    private void buildOtherObjects() {
        if (waitingZones.Count != 0) {
            foreach (var zone in waitingZones) {
                AreaGeometry.create (zone.GetAttribute ("name"), parsePoints (zone));
            }
        }
        if (scaledAreas.Count != 0) {
            foreach (var area in scaledAreas) {
                AreaGeometry.create (area.GetAttribute ("name"), parsePoints (area));
            }
        }
        if (queuingAreas.Count != 0) {
            foreach (var queue in queuingAreas) {
                AreaGeometry.create (queue.GetAttribute ("name"), parsePoints (queue));
            }
        }
    }
    */
    // Parse an XmlElement full of <point> XmlElements into a coordinate list
    private static List<Vector2> parsePoints(XmlElement polyPoints)
    {
        List<Vector2> list = new List<Vector2>();

        foreach(XmlElement point in polyPoints.SelectNodes("point")) {
            float x;
            float y;
            if (float.TryParse(point.GetAttribute("x"), out x) && float.TryParse(point.GetAttribute("y"), out y)) {
                list.Add(new Vector2(x, y));
            }
        }

        return list;
    }
开发者ID:benjaminaaron,项目名称:SumoVizUnity_ModSem,代码行数:68,代码来源:FileLoaderXML.cs

示例11: parseResources

    private ResourcesUni parseResources(XmlElement resources)
    {
        XmlNodeList assets, conditions;
        string tmpArgVal = "";

        currentResources = new ResourcesUni();

        tmpArgVal = resources.GetAttribute("name");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            currentResources.setName(tmpArgVal);
        }

        assets = resources.SelectNodes("asset");
        foreach (XmlElement asset in assets)
        {
            string type = "";
            string path = "";

            tmpArgVal = asset.GetAttribute("type");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                type = tmpArgVal;
            }
            tmpArgVal = asset.GetAttribute("uri");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                path = tmpArgVal;
            }
            currentResources.addAsset(type, path);
        }

        conditions = resources.SelectNodes("condition");
        foreach (XmlElement condition in conditions)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(condition);
            currentResources.setConditions(currentConditions);
        }

        return currentResources;
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:42,代码来源:ActionsSubParser_.cs

示例12: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            endsgame = element.SelectNodes("end-game"),
            nextsscene = element.SelectNodes("next-scene"),
            resourcess = element.SelectNodes("resources"),
            descriptionss = element.SelectNodes("description"),
            assets,
            conditions = element.SelectNodes("condition"),
            effects = element.SelectNodes("effect"),
            postseffects = element.SelectNodes("post-effect");

        string tmpArgVal;

        string slidesceneId = "";
        bool initialScene = false;
        string idTarget = "";
        int x = int.MinValue, y = int.MinValue;
        int transitionType = 0, transitionTime = 0;
        string next = "go-back";
        bool canSkip = true;

        tmpArgVal = element.GetAttribute("id");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            slidesceneId = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("start");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            initialScene = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("idTarget");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            idTarget = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("destinyX");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            x = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("destinyY");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            y = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("transitionType");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            transitionType = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("transitionTime");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            transitionTime = int.Parse(tmpArgVal);
        }
        tmpArgVal = element.GetAttribute("next");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            next = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("canSkip");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            canSkip = tmpArgVal.Equals("yes");
        }
        if (element.Name.Equals("slidescene"))
            cutscene = new Slidescene(slidesceneId);
        else
            cutscene = new Videoscene(slidesceneId);
        if (initialScene)
            chapter.setTargetId(slidesceneId);

        cutscene.setTargetId(idTarget);
        cutscene.setPositionX(x);
        cutscene.setPositionY(y);
        cutscene.setTransitionType((NextSceneEnumTransitionType) transitionType);
        cutscene.setTransitionTime(transitionTime);

        if(element.SelectSingleNode("name")!= null)
             cutscene.setName(element.SelectSingleNode("name").InnerText);
        if (element.SelectSingleNode("documentation") != null)
            cutscene.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement ell in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(ell);
            cutscene.setEffects(currentEffects);
        }

        if (cutscene is Videoscene)
            ((Videoscene) cutscene).setCanSkip(canSkip);

        if (next.Equals("go-back"))
        {
            cutscene.setNext(Cutscene.GOBACK);
        }
        else if (next.Equals("new-scene"))
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:CutsceneSubParser_.cs

示例13: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            initscondition = element.SelectNodes("init-condition"),
            endscondition = element.SelectNodes("end-condition"),
            effects = element.SelectNodes("effect"),
            postseffect = element.SelectNodes("post-effect");

        string tmpArgVal;

        string time = "";
        bool usesEndCondition = true;
        bool runsInLoop = true;
        bool multipleStarts = true;
        bool countDown = false, showWhenStopped = false, showTime = false;
        string displayName = "timer";

        tmpArgVal = element.GetAttribute("time");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            time = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("usesEndCondition");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            usesEndCondition = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("runsInLoop");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            runsInLoop = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("multipleStarts");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            multipleStarts = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showTime");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showTime = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("displayName");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            displayName = tmpArgVal;
        }
        tmpArgVal = element.GetAttribute("countDown");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            countDown = tmpArgVal.Equals("yes");
        }
        tmpArgVal = element.GetAttribute("showWhenStopped");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            showWhenStopped = tmpArgVal.Equals("yes");
        }

        timer = new Timer(long.Parse(time));
        timer.setRunsInLoop(runsInLoop);
        timer.setUsesEndCondition(usesEndCondition);
        timer.setMultipleStarts(multipleStarts);
        timer.setShowTime(showTime);
        timer.setDisplayName(displayName);
        timer.setCountDown(countDown);
        timer.setShowWhenStopped(showWhenStopped);

        if (element.SelectSingleNode("documentation") != null)
            timer.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in initscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setInitCond(currentConditions);
        }

        foreach (XmlElement el in endscondition)
        {
            currentConditions = new Conditions();
            new ConditionSubParser_(currentConditions, chapter).ParseElement(el);
            timer.setEndCond(currentConditions);
        }

        foreach (XmlElement el in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setEffects(currentEffects);
        }

        foreach (XmlElement el in postseffect)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
            timer.setPostEffects(currentEffects);
        }

        chapter.addTimer(timer);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:100,代码来源:TimerSubParser_.cs

示例14: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            smtpsconfigs = element.SelectNodes("smtp-config"),
            assessmentsrule = element.SelectNodes("assessment-rule"),
            timedsssessmentsrule = element.SelectNodes("timed-assessment-rule"),
            conditions,
            initsconditions,
            endsconditions,
            setpropertys,
            assessEffects;

        string tmpArgVal;

        tmpArgVal = element.GetAttribute("show-report-at-end");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setShowReportAtEnd(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("send-to-email");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal == null || tmpArgVal.Length < 1)
            {
                profile.setEmail("");
                profile.setSendByEmail(false);
            }
            else
            {
                profile.setEmail(tmpArgVal);
                profile.setSendByEmail(true);
            }
        }

        tmpArgVal = element.GetAttribute("scorm12");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setScorm12(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("scorm2004");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setScorm2004(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("name");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setName(tmpArgVal);
        }

        foreach (XmlElement ell in smtpsconfigs)
        {
            tmpArgVal = element.GetAttribute("smtp-ssl");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpSSL(tmpArgVal.Equals("yes"));
            }
            tmpArgVal = element.GetAttribute("smtp-server");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpServer(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-port");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpPort(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-user");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpUser(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-pwd");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpPwd(tmpArgVal);
            }
        }

        foreach (XmlElement ell in assessmentsrule)
        {

            string id = null;
            int importance = 0;
            bool repeatRule = false;

            tmpArgVal = element.GetAttribute("id");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                id = tmpArgVal;
            }
            tmpArgVal = element.GetAttribute("importance");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                for (int j = 0; j < AssessmentRule.N_IMPORTANCE_VALUES; j++)
                    if (tmpArgVal.Equals(AssessmentRule.IMPORTANCE_VALUES[j]))
                        importance = j;
//.........这里部分代码省略.........
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:101,代码来源:AssessmentSubParser_.cs

示例15: ParseElement

    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            resourcess = element.SelectNodes("resources"),
            descriptionss = element.SelectNodes("description"),
            assets,
            conditions,
            effects = element.SelectNodes("effect");

        string tmpArgVal;

        string atrezzoId = element.GetAttribute("id");
        atrezzo = new Atrezzo(atrezzoId);

        descriptions = new List<Description>();
        atrezzo.setDescriptions(descriptions);

        if (element.SelectSingleNode("documentation") != null)
            atrezzo.setDocumentation(element.SelectSingleNode("documentation").InnerText);

        foreach (XmlElement el in resourcess)
        {
            currentResources = new ResourcesUni();
            tmpArgVal = el.GetAttribute("name");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                currentResources.setName(el.GetAttribute(tmpArgVal));
            }

            assets = el.SelectNodes("asset");
            foreach (XmlElement ell in assets)
            {
                string type = "";
                string path = "";

                tmpArgVal = ell.GetAttribute("type");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    type = tmpArgVal;
                }
                tmpArgVal = ell.GetAttribute("uri");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    path = tmpArgVal;
                }
                currentResources.addAsset(type, path);
            }

            conditions = el.SelectNodes("condition");
            foreach (XmlElement ell in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell);
                currentResources.setConditions(currentConditions);
            }

            atrezzo.addResources(currentResources);
        }

        foreach (XmlElement el in descriptionss)
        {
            description = new Description();
            new DescriptionsSubParser_(description, chapter).ParseElement(el);
            this.descriptions.Add(description);
        }

        foreach (XmlElement el in effects)
        {
            currentEffects = new Effects();
            new EffectSubParser_(currentEffects, chapter).ParseElement(el);
        }

        chapter.addAtrezzo(atrezzo);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:74,代码来源:AtrezzoSubParser_.cs


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