예제 #1
0
        public void AddCaseOrDefault(XMLSwitchCase switchItem)
        {
            if (switchCase.Count >= maxCount)
            {
                return;
            }

            if (switchItem is XMLDefault)
            {
                switchCase.Add(switchItem);
            }

            else if (switchItem is XMLCase)
            {
                XMLDefault xmlDefault = switchCase[switchCase.Count - 1] as XMLDefault;
                if (xmlDefault != null)
                {
                    switchCase.RemoveAt(switchCase.Count - 1);
                    switchCase.Add(switchItem);
                    switchCase.Add(xmlDefault);
                }
                else if (xmlDefault == null)
                {
                    switchCase.Add(switchItem);
                }
                else
                {
                }
            }
            else
            {
            }
        }
예제 #2
0
        public XMLSwitchNode GetXMLSwitchData()
        {
            XMLSwitchNode xmlNode = new XMLSwitchNode();

            xmlNode.nodeID    = BlockID;
            xmlNode.nodeType  = GetNodeType;
            xmlNode.nodeTitle = GetBlockTitle;
            xmlNode.xmlSwitch = new XMLSwitch();
            xmlNode.xmlSwitch.comparerType = GetSwitchType;
            xmlNode.xmlSwitch.name         = GetSwitchName;

            xmlNode.xmlSwitch.switchCase = new List <XMLSwitchCase>();

            foreach (ExecuteSwitchPoint point in executePoints)
            {
                if (point.GetPointPosition == ExecutePoint.PointPosition.ExecutePoint_Left)
                {
                    continue;
                }

                if (point.GetHasLineState)
                {
                    if (point.GetSwitchPointType == ExecuteSwitchPoint.SwitchPointType.Case)
                    {
                        ExecuteCasePoint casePoint = point as ExecuteCasePoint;
                        XMLCase          caseItem  = new XMLCase()
                        {
                            caseValue = casePoint.CaseValue,
                            nextID    = point.GetLineData.GetRightExecutePointInfo.blockID
                        };

                        xmlNode.xmlSwitch.switchCase.Add(caseItem);
                    }
                    else if (point.GetSwitchPointType == ExecuteSwitchPoint.SwitchPointType.Default)
                    {
                        XMLDefault defaultItem = new XMLDefault()
                        {
                            nextID = point.GetLineData.GetRightExecutePointInfo.blockID
                        };

                        xmlNode.xmlSwitch.switchCase.Add(defaultItem);
                    }
                }
            }

            return(xmlNode);
        }