Наследование: NAnt.Core.Element
Пример #1
0
            public ConditionalConfigurator(ConditionalElement element, XmlNode elementNode, PropertyDictionary properties, FrameworkInfo targetFramework) :
                base(element, elementNode, properties, targetFramework)
            {
                Type currentType = element.GetType();

                PropertyInfo ifdefined = currentType.GetProperty("IfDefined",
                                                                 BindingFlags.NonPublic | BindingFlags.Instance);

                InitializeAttribute(ifdefined);

                if (!element.IfDefined)
                {
                    _enabled = false;
                }
                else
                {
                    PropertyInfo unlessDefined = currentType.GetProperty(
                        "UnlessDefined",
                        BindingFlags.NonPublic | BindingFlags.Instance);
                    InitializeAttribute(unlessDefined);
                    _enabled = !element.UnlessDefined;
                }

                if (!_enabled)
                {
                    // since we will not be processing other attributes or
                    // child nodes, clear these collections to avoid
                    // errors for unrecognized attributes/elements
                    UnprocessedAttributes.Clear();
                    UnprocessedChildNodes.Clear();
                }
            }
Пример #2
0
            public ConditionalConfigurator(ConditionalElement element, XmlNode elementNode, PropertyDictionary properties, FrameworkInfo targetFramework)
                : base(element, elementNode, properties, targetFramework)
            {
                Type currentType = element.GetType();

                PropertyInfo ifdefined = currentType.GetProperty("IfDefined",
                    BindingFlags.NonPublic | BindingFlags.Instance);
                InitializeAttribute(ifdefined);

                if (!element.IfDefined) {
                    _enabled = false;
                } else {
                    PropertyInfo unlessDefined = currentType.GetProperty(
                        "UnlessDefined",
                        BindingFlags.NonPublic | BindingFlags.Instance);
                    InitializeAttribute(unlessDefined);
                    _enabled = !element.UnlessDefined;
                }

                if (!_enabled) {
                    // since we will not be processing other attributes or
                    // child nodes, clear these collections to avoid
                    // errors for unrecognized attributes/elements
                    UnprocessedAttributes.Clear();
                    UnprocessedChildNodes.Clear();
                }
            }