Пример #1
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc = xDoc;  XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);

            NowLoading = this;
            _matchItem = XmlMatchItem.NowLoading;

            foreach (XmlNode child in rootNode.ChildNodes)
            {
                if (child.Name.Equals("Condition"))
                {
                    XmlNode      condNode = XmlHandlers.XmlGetter.FirstChild(child);
                    XmlCondition cond     = XmlCondition.New(condNode.Name);
                    cond.LoadXml(xDoc, condNode, refLoad);
                    _condition = cond;
                }
                else if (child.Name.Equals("Component"))
                {
                    XmlMatchComponent comp = new XmlMatchComponent();
                    comp.LoadXml(xDoc, child);
                    _components.Add(comp);
                }
            }
            if (_condition == null)
            {
                _condition = XmlCondition.New(XmlConditionTypes.True);                     //default condition
            }
        }
Пример #2
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc      = xDoc;  XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            NowLoading = this;

            XmlNode commonMatchItem = XmlGetter.Child(rootNode, "CommonMatches");

            XmlMatchItem commonMatches = new XmlMatchItem();

            commonMatches.LoadXml(xDoc, commonMatchItem);

            XmlNodeList matchItems = XmlGetter.Children(rootNode, "MatchItem");

            foreach (XmlNode matchItem in matchItems)
            {
                String targetTemplate = XmlGetter.Attribute(matchItem, "TargetTemplate");
                if (targetTemplate.Length == 0)
                {
                    throw new Exception("MatchItem Tag에 TargetTemplate 속성이 없습니다.");
                }
                XmlMatchItem item = new XmlMatchItem();
                item.LoadXml(xDoc, matchItem);
                foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Init))
                {
                    item.GetMatchDataList(XmlMatchItem.ActiveTimes.Init).Add(matchData);
                }
                foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Send))
                {
                    item.GetMatchDataList(XmlMatchItem.ActiveTimes.Send).Add(matchData);
                }
                foreach (XmlMatchData matchData in commonMatches.GetMatchDataList(XmlMatchItem.ActiveTimes.Recv))
                {
                    item.GetMatchDataList(XmlMatchItem.ActiveTimes.Recv).Add(matchData);
                }
                _matchItems.Add(targetTemplate, item);
            }
        }
Пример #3
0
        public void LoadXml(XmlDocument xDoc, XmlNode rootNode, Boolean refLoad = false)
        {
            if (rootNode == null)
            {
                return;
            }
            _xDoc      = xDoc;  XmlControlHandler.GetDefaultXmlItemAttributes(rootNode, xDoc, this);
            NowLoading = this;

            _targetTemplate = XmlGetter.Attribute(rootNode, "TargetTemplate");


            foreach (XmlNode match in rootNode.ChildNodes)
            {
                String fieldName = XmlGetter.Attribute(match, "FieldName");
                if (fieldName.Length == 0)
                {
                    throw new Exception(rootNode.Name + "MatchItem [TargetTemplate:" + _targetTemplate + "]/Match 태그에는 FieldName이 반드시 들어가야 합니다. 형식예: Info.Name 혹은 Command.Header.id");
                }

                String             activeTimesText = XmlGetter.Attribute(match, "ActiveTimes");
                List <ActiveTimes> activeTimes     = getActiveTimes(activeTimesText);
                if (activeTimes.Count == 0)
                {
                    activeTimes.Add(ActiveTimes.Init);
                }

                XmlMatchData data = new XmlMatchData(activeTimes, fieldName);
                data.LoadXml(xDoc, match, refLoad);

                _fieldToMatchData.Add(fieldName, data); //field->match 란에 추가

                for (int i = 0; i < activeTimes.Count; i++)
                {
                    _activeTimeToMatchData[activeTimes[i]].Add(data); //activeTime->Match 란에 추가.
                }
            }
        }