public bool Check(XmlLocationType locationType, string name) { if (locationType.HasFlag(XmlLocationType.Element)) { if (ElementAllowedNames.Contains(name)) { return(true); } } if (locationType.HasFlag(XmlLocationType.Attribute)) { if (AttributeAllowedNames.Contains(name)) { return(true); } } return(false); }
public void AddLocation(XmlLocationAttribute locationAttribute) { if (locationAttribute.LocationType.HasFlag(XmlLocationType.Element)) { ElementAllowedNames.AddRange(locationAttribute.AllowedNames); ElementAllowedNames.AddCaseVariantsForFirstChar(); ElementAllowedNames.Sort(); } if (locationAttribute.LocationType.HasFlag(XmlLocationType.Attribute)) { AttributeAllowedNames.AddRange(locationAttribute.AllowedNames); AttributeAllowedNames.AddCaseVariantsForFirstChar(); AttributeAllowedNames.Sort(); } if (locationAttribute.LocationType.HasFlag(XmlLocationType.Value)) { CouldBeValue = true; } }
//public override int GetHashCode() //{ // return _key.GetHashCode(); //} //public override bool Equals(object obj) //{ // var r = obj as ConfigComplexLocation; // if (r == null) return false; // return string.Compare(_key, r._key) == 0; //} public override string ToString() { return($"Property xml location:\n{ElementAllowedNames.ToStringWithList("\t- Element: ")}{AttributeAllowedNames.ToStringWithList("\t- Attribute: ")}\t- Could be value: {CouldBeValue}"); }
public void AddLocation(List <string> allowedElementNames) { ElementAllowedNames.AddRange(allowedElementNames); ElementAllowedNames.AddCaseVariantsForFirstChar(); ElementAllowedNames.Sort(); }