Exemple #1
0
        private static TypeNameSet ParseTypeNameSet(XElement rootElement, string elementName)
        {
            var typeNameSet = new TypeNameSet();

            foreach (var xElement in rootElement.Elements(elementName))
            {
                var typeName = GetAttributeValue(xElement, TypeNameAttributeName);
                if (typeName == null)
                {
                    throw new Exception($"{GetLineInfo(xElement)}'{TypeNameAttributeName}' attribute missing.");
                }

                if (!string.IsNullOrWhiteSpace(typeName))
                {
                    typeNameSet.Add(typeName.Trim());
                }
            }

            return(typeNameSet);
        }
 public AnalyzerConfigBuilder AddVisibleTypesByNamespace(Namespace ns, TypeNameSet typeNameSet)
 {
     VisibleTypesByNamespace.AddOrUnion <Namespace, TypeNameSet, string>(ns, typeNameSet);
     return(this);
 }
 public AnalyzerConfigBuilder AddAllowRule(NamespaceDependencyRule namespaceDependencyRule, TypeNameSet typeNameSet = null)
 {
     AllowRules.AddOrUnion <NamespaceDependencyRule, TypeNameSet, string>(namespaceDependencyRule, typeNameSet);
     return(this);
 }