AoMBrgEditor.PssgNode.HasAttribute C# (CSharp) Méthode

HasAttribute() public méthode

Determines whether the current node has an attribute with the specified id.
public HasAttribute ( int attributeID ) : bool
attributeID int The id of the attribute to find.
Résultat bool
        public bool HasAttribute(int attributeID)
        {
            return attributes.Count(x => x.Value.id == attributeID) > 0;
        }

Same methods

PssgNode::HasAttribute ( string attributeName ) : bool

Usage Example

Exemple #1
0
 public PssgAttribute AddAttribute(PssgNode parentNode, int attributeID, object data)
 {
     if (parentNode == null)
     {
         return null;
     }
     if (parentNode.attributes == null)
     {
         parentNode.attributes = new Dictionary<string, PssgAttribute>();
     }
     else if (parentNode.HasAttribute(attributeID))
     {
         parentNode[attributeID].data = data;
         return parentNode[attributeID];
     }
     else if (parentNode.attributes.ContainsKey(attributeInfo[attributeID - 1].name))
     {
         return null;
     }
     PssgAttribute newAttr = new PssgAttribute(attributeID, data, this, parentNode);
     parentNode.attributes.Add(newAttr.Name, newAttr);
     return newAttr;
 }