コード例 #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;

            _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 란에 추가.
                }
            }
        }