Пример #1
0
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            ArrayList props = new ArrayList();

            foreach (XmlNode propertyNode in propertyNodes)
            {
                ArrayList attrs = new ArrayList();

                // Add default attributes Category, TypeConverter and Description
                attrs.Add(new CategoryAttribute("WXS Attribute"));
                attrs.Add(new TypeConverterAttribute(typeof(StringConverter)));

                XmlNodeList subNodes = propertyNode.SelectNodes("*", WixFiles.WxsNsmgr);
                if (subNodes.Count >= 1)
                {
                    if (subNodes.Count == 1)
                    {
                        attrs.Add(new EditorAttribute(typeof(SearchElementTypeEditor), typeof(UITypeEditor)));
                    }

                    // Make Attribute array
                    Attribute[] attrArray = (Attribute[])attrs.ToArray(typeof(Attribute));

                    // Create and add PropertyDescriptor
                    PropertySearchElementPropertyDescriptor pd = new PropertySearchElementPropertyDescriptor(wixFiles, propertyNode,
                                                                                                             propertyNode.Attributes["Id"].Value, attrArray);

                    props.Add(pd);
                }
                else
                {
                    // Make Attribute array
                    Attribute[] attrArray = (Attribute[])attrs.ToArray(typeof(Attribute));

                    // Create and add PropertyDescriptor
                    PropertyElementPropertyDescriptor pd =
                        new PropertyElementPropertyDescriptor(wixFiles, propertyNode,
                                                              propertyNode.Attributes["Id"].Value, attrArray);
                    props.Add(pd);
                }
            }

            PropertyDescriptor[] propArray = props.ToArray(typeof(PropertyDescriptor)) as PropertyDescriptor[];

            return(new PropertyDescriptorCollection(propArray));
        }
Пример #2
0
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            ArrayList props = new ArrayList();

            foreach(XmlNode propertyNode in propertyNodes) {
                ArrayList attrs = new ArrayList();

                // Add default attributes Category, TypeConverter and Description
                attrs.Add(new CategoryAttribute("WXS Attribute"));
                attrs.Add(new TypeConverterAttribute(typeof(StringConverter)));

                XmlNodeList subNodes = propertyNode.SelectNodes("*", WixFiles.WxsNsmgr);
                if (subNodes.Count >= 1) {
                    if (subNodes.Count == 1) {
                        attrs.Add(new EditorAttribute(typeof(SearchElementTypeEditor), typeof(UITypeEditor)));
                    }

                    // Make Attribute array
                    Attribute[] attrArray = (Attribute[])attrs.ToArray(typeof(Attribute));

                    // Create and add PropertyDescriptor
                    PropertySearchElementPropertyDescriptor pd = new PropertySearchElementPropertyDescriptor (wixFiles, propertyNode,
                        propertyNode.Attributes["Id"].Value, attrArray);

                    props.Add(pd);
                } else {
                    // Make Attribute array
                    Attribute[] attrArray = (Attribute[])attrs.ToArray(typeof(Attribute));

                    // Create and add PropertyDescriptor
                    PropertyElementPropertyDescriptor pd =
                        new PropertyElementPropertyDescriptor (wixFiles, propertyNode,
                            propertyNode.Attributes["Id"].Value, attrArray);
                    props.Add(pd);
                }
            }

            PropertyDescriptor[] propArray = props.ToArray(typeof(PropertyDescriptor)) as PropertyDescriptor[];

            return new PropertyDescriptorCollection(propArray);
        }