Пример #1
0
        public bool Match(XMLLuaSearchIfStatement req, IfStat real)
        {
            Logger.Debug($"if_statement");
            if (!Match(req.Block, real.Block))
            {
                return(false);
            }
            if (!Match(req.Condition, real.Condition))
            {
                return(false);
            }
            if (!Match(req.Else, real.ElseBlock))
            {
                return(false);
            }
            if (req.ElseIfs.Count != real.ElseIfs.Count)
            {
                return(false);
            }

            for (var i = 0; i < req.ElseIfs.Count; i++)
            {
                if (!Match(req.ElseIfs[i], real.ElseIfs[i]))
                {
                    return(false);
                }
            }
            SetSelectionIfSelected(real.Span, req);
            return(true);
        }
Пример #2
0
        public override void FillIn(XmlElement elem)
        {
            base.FillIn(elem);
            for (var i = 0; i < elem.ChildNodes.Count; i++)
            {
                var child = elem.ChildNodes[i];

                if (child.Name == "Condition" && child.ChildNodes.Count > 0)
                {
                    var cond = child.ChildNodes[0];
                    Condition = LuaSearchXMLTypes.GetExpression(cond.Name, cond as XmlElement);
                }
                else if (child.Name == "Block")
                {
                    Block = new XMLLuaSearchBlock();
                    Block.FillIn(child as XmlElement);
                }
                else if (child.Name == "ElseBlock")
                {
                    Else = new XMLLuaSearchBlock();
                    Else.FillIn(child as XmlElement);
                }
                else if (child.Name == "ElseIfs")
                {
                    ElseIfs = new List <XMLLuaSearchIfStatement>();
                    for (var j = 0; j < child.ChildNodes.Count; j++)
                    {
                        var innerchild = child.ChildNodes[j];

                        var ifstat = new XMLLuaSearchIfStatement();
                        ifstat.FillIn(innerchild as XmlElement);
                    }
                }
            }
        }