Ejemplo n.º 1
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);
                    }
                }
            }
        }
        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 == "Arguments")
                {
                    Arguments = new List <string>();
                    for (var j = 0; j < child.ChildNodes.Count; j++)
                    {
                        var innerchild = child.ChildNodes[j];

                        if (innerchild is XmlElement && ((XmlElement)innerchild).Name == "Argument" && ((XmlElement)innerchild).HasAttribute("value"))
                        {
                            Arguments.Add(((XmlElement)innerchild).GetAttribute("value"));
                        }
                    }
                }
                else if (child.Name == "Body" && child.ChildNodes.Count > 0)
                {
                    var body = child.ChildNodes[0];
                    Body = new XMLLuaSearchBlock();
                    Body.FillIn(body as XmlElement);
                }
            }
        }
Ejemplo n.º 3
0
        public bool Match(XMLLuaSearchBlock req, Block real)
        {
            Logger.Debug($"block");
            if (req.Statements == null)
            {
                return(false);
            }
            if (req.Full && (req.Statements.Count != real.Statements.Count))
            {
                return(false);
            }
            if (!req.Full && req.Statements.Count == 0)
            {
                SetSelectionIfSelected(real.Span, req);
                return(true);
            }

            var j = 0;

            for (var i = 0; i < real.Statements.Count; i++)
            {
                var stat = real.Statements[i];

                if (Match(req.Statements[j], stat))
                {
                    j += 1;
                }
                else
                {
                    j = 0;
                    if (req.Full)
                    {
                        return(false);
                    }
                }

                if (j >= req.Statements.Count)
                {
                    SetSelectionIfSelected(real.Span, req);
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
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 expr = child.ChildNodes[0];
                    Condition = LuaSearchXMLTypes.GetExpression(expr.Name, expr as XmlElement);
                }
                else if (child.Name == "Block")
                {
                    Block = new XMLLuaSearchBlock();
                    Block.FillIn(child as XmlElement);
                }
            }
        }
Ejemplo n.º 5
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 == "Var" && child.ChildNodes.Count > 0)
                {
                    var @var = child.ChildNodes[0];
                    Var = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement);
                }
                else if (child.Name == "Limit" && child.ChildNodes.Count > 0)
                {
                    var @var = child.ChildNodes[0];
                    Limit = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement);
                }
                else if (child.Name == "Step" && child.ChildNodes.Count > 0)
                {
                    var @var = child.ChildNodes[0];
                    Step = LuaSearchXMLTypes.GetExpression(@var.Name, @var as XmlElement);
                }
                else if (child.Name == "Variable" && child.ChildNodes.Count > 0)
                {
                    var @var = child.ChildNodes[0];
                    if (!(@var is XmlText))
                    {
                        continue;
                    }
                    Variable = ((XmlText)@var).Value;
                }
                else if (child.Name == "Block")
                {
                    Block = new XMLLuaSearchBlock();
                    Block.FillIn(child as XmlElement);
                }
            }
        }
Ejemplo n.º 6
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 == "Variables")
                {
                    Variables = new List <string>();
                    for (var j = 0; j < child.ChildNodes.Count; j++)
                    {
                        var innerchild = child.ChildNodes[j];

                        if (innerchild is XmlElement && ((XmlElement)innerchild).Name == "Variable" && ((XmlElement)innerchild).HasAttribute("value"))
                        {
                            Variables.Add(((XmlElement)innerchild).GetAttribute("value"));
                        }
                    }
                }
                else if (child.Name == "Expressions")
                {
                    Expressions = new List <IXMLLuaSearchExpression>();
                    for (var j = 0; j < child.ChildNodes.Count; j++)
                    {
                        var innerchild = child.ChildNodes[i];

                        var expr = LuaSearchXMLTypes.GetExpression(innerchild.Name);
                        expr.FillIn(innerchild as XmlElement);
                        Expressions.Add(expr);
                    }
                }
                else if (child.Name == "Block")
                {
                    Block = new XMLLuaSearchBlock();
                    Block.FillIn(child as XmlElement);
                }
            }
        }