IReadOnlyProperty IReadOnlyItem.Property(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(name); } if (Exists || _parent != AmlElement.NullElem) { var elem = _content as ILinkedElement; if (elem != null) { var prop = LinkedListOps.Find(elem, name) as IReadOnlyProperty; // The first one should be in the user's language if multiple languages // exist if (prop != null && prop.Attribute("xml:lang").Exists) { prop = LinkedListOps.FindAll(elem, name) .OfType <IReadOnlyProperty>() .FirstOrDefault(p => p.Attribute("xml:lang").Value == AmlContext.LocalizationContext.LanguageCode); } if (prop != null) { return(prop); } } if (name == "generation" && (_attr & ElementAttributes.ItemDefaultGeneration) > 0) { return(Client.Property.DefaultGeneration); } if (name == "is_current" && (_attr & ElementAttributes.ItemDefaultIsCurrent) > 0) { return(Client.Property.DefaultIsCurrent); } if (name == "is_released" && (_attr & ElementAttributes.ItemDefaultIsReleased) > 0) { return(Client.Property.DefaultIsReleased); } if (name == "major_rev" && (_attr & ElementAttributes.ItemDefaultMajorRev) > 0) { return(Client.Property.DefaultMajorRev); } if (name == "new_version" && (_attr & ElementAttributes.ItemDefaultNewVersion) > 0) { return(Client.Property.DefaultNewVersion); } if (name == "not_lockable" && (_attr & ElementAttributes.ItemDefaultNotLockable) > 0) { return(Client.Property.DefaultNotLockable); } return(new Property(this, name)); } return(Innovator.Client.Property.NullProp); }
internal Element ElementByName(string name) { var elem = _content as ILinkedElement; if (elem != null) { var result = (LinkedListOps.Find(elem, name) as Element); if (result != null) { return(result); } } return(Elements().OfType <Element>().FirstOrDefault(e => e.Name == name) ?? new AmlElement(this, name)); }
IReadOnlyAttribute IReadOnlyElement.Attribute(string name) { return((LinkedListOps.Find(_lastAttr, name) as IReadOnlyAttribute) ?? new Attribute(this, name)); }