Beispiel #1
0
        private void DisplayNodeDetails(FormsXMLParserNode node)
        {
            selectedNode           = node;
            nodeDetailName.Text    = node.Name;
            nodeDetailContent.Text = node.Content;

            menuYPos = 155 + nodeDetailContent.Height;
            int i = 0;

            ClearAttrRows();
            foreach (var attr in node.attributes)
            {
                MakeAttrRow(attr.Key, attr.Value, i);
                i++;
            }
        }
Beispiel #2
0
        private List <FormsXMLParserNode> GetTreeNodes(FormsXMLParserNode rootNode)
        {
            List <FormsXMLParserNode> nodes    = new List <FormsXMLParserNode>();
            List <FormsXMLParserNode> children = new List <FormsXMLParserNode>();

            foreach (var child in rootNode.Children)
            {
                children.AddRange(GetTreeNodes(child));
            }

            /*
             * string attrString = "";
             * foreach(var obj in rootNode.attributes)
             *      attrString += string.Format(" {0}=\"{1}\"", obj.Key, obj.Value);
             *
             * string nodeText = string.Format("{0} ({1} ): {2}", rootNode.name, attrString, rootNode.content);
             */
            nodes.Add(rootNode);
            nodes.AddRange(children.ToArray());

            return(nodes);
        }
Beispiel #3
0
        private bool FilterNode(FormsXMLParserNode node, string query, Regex reQuery)
        {
            bool match = false;

            // node.ShowChild();

            foreach (var child in node.Children)
            {
                if (FilterNode(child, query, reQuery))
                {
                    match = true;
                }
            }

            if (!match && filterElements.Checked)
            {
                if (reQuery != null)
                {
                    match = MatchString(reQuery, node.name);
                }
                else
                {
                    match = MatchString(query, node.name);
                }
            }
            if (!match && filterContent.Checked)
            {
                if (reQuery != null)
                {
                    match = MatchString(reQuery, node.content);
                }
                else
                {
                    match = MatchString(query, node.content);
                }
            }
            if (!match && filterAttrKeys.Checked && filterAttrVals.Checked)
            {
                foreach (var attr in node.attributes)
                {
                    if (reQuery != null)
                    {
                        match = MatchString(reQuery, attr.Key);
                    }
                    else
                    {
                        match = MatchString(query, attr.Key);
                    }
                    if (match)
                    {
                        break;
                    }
                    if (reQuery != null)
                    {
                        match = MatchString(reQuery, attr.Value);
                    }
                    else
                    {
                        match = MatchString(query, attr.Value);
                    }
                    if (match)
                    {
                        break;
                    }
                }
            }
            else if (!match && filterAttrKeys.Checked)
            {
                foreach (var key in node.attributes.Keys)
                {
                    if (reQuery != null)
                    {
                        match = MatchString(reQuery, key);
                    }
                    else
                    {
                        match = MatchString(query, key);
                    }
                    if (match)
                    {
                        break;
                    }
                }
            }
            else if (!match && filterAttrVals.Checked)
            {
                foreach (var val in node.attributes.Values)
                {
                    if (reQuery != null)
                    {
                        match = MatchString(reQuery, val);
                    }
                    else
                    {
                        match = MatchString(query, val);
                    }
                    if (match)
                    {
                        break;
                    }
                }
            }

            if (!match && node.Parent != null)
            {
                // ((FormsXMLParserNode) node.Parent).HideChild(node);
                node.ForeColor = Color.White;
                // node.Collapse();
            }
            else
            {
                node.ForeColor = Color.Black;
            }

            return(match);
        }