Exemple #1
0
        private static bool AttributeNameMatches(string attributeName, AttributeNode attrNode)
        {
            if (attributeName is null)
            {
                return(false);
            }

            return(Regex.IsMatch(attrNode.TypeName, $@"^(\w+?\.)*{attributeName.RemoveEnd("Attribute")}(Attribute)?$"));
        }
Exemple #2
0
        public static AttributeNode FindAttribute(ParseNodeList attributeNodes, string attributeName)
        {
            if (attributeNodes == null || attributeNodes.Count == 0)
            {
                return(null);
            }

            foreach (ParseNode parseNode in attributeNodes)
            {
                AttributeNode attrNode = parseNode as AttributeNode;

                if (AttributeNameMatches(attributeName, attrNode))
                {
                    return(attrNode);
                }
            }

            return(null);
        }