private bool TryAddLocalRoot(LocalRoot node, LocalRoot validEnclosingParent, out ConfigurationRuleViolation violation)
 {
     if (nodes.Contains(node))
     {
         violation = new DuplicateLocalRootDeclaration(node);
         return(false);
     }
     if (nodePaths.Contains(node))
     {
         violation = new DuplicateLocalRootDeclaration(node);
         return(false);
     }
     foreach (var existing in nodes)
     {
         if (node.RootUri.IsBaseOf(existing.RootUri))
         {
             violation = new OverlappingLocalRootDeclaration(node, existing);
             return(false);
         }
         if (existing == validEnclosingParent)
         {
             continue;
         }
         if (existing.RootUri.IsBaseOf(node.RootUri))
         {
             violation = new OverlappingLocalRootDeclaration(existing, node);
             return(false);
         }
     }
     nodes.Add(node);
     nodePaths.Add(node);
     violation = null;
     return(true);
 }
Ejemplo n.º 2
0
 public ConfigurationRuleViolation Record(ConfigurationRuleViolation violation)
 {
     errors.Add(violation);
     return(violation);
 }