PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(this.Target);

            if (this.propsToHide != null && this.propsToHide.Length > 0)
            {
                List <PropertyDescriptor> list = new List <PropertyDescriptor>();
                for (int i = 0; i < propertyDescriptorCollection.Count; i++)
                {
                    PropertyDescriptor prop = propertyDescriptorCollection[i];
                    ExtenderControlPropertyAttribute extenderControlPropertyAttribute = (ExtenderControlPropertyAttribute)prop.Attributes[typeof(ExtenderControlPropertyAttribute)];
                    if (extenderControlPropertyAttribute != null)
                    {
                        ExtenderVisiblePropertyAttribute extenderVisiblePropertyAttribute = (ExtenderVisiblePropertyAttribute)prop.Attributes[typeof(ExtenderVisiblePropertyAttribute)];
                        if (extenderVisiblePropertyAttribute != null && extenderVisiblePropertyAttribute.Value)
                        {
                            int num = Array.FindIndex <string>(this.propsToHide, (string s) => s == prop.Name);
                            if (num == -1)
                            {
                                IDReferencePropertyAttribute idreferencePropertyAttribute = (IDReferencePropertyAttribute)prop.Attributes[typeof(IDReferencePropertyAttribute)];
                                Attribute attribute = prop.Attributes[typeof(TypeConverterAttribute)];
                                if (idreferencePropertyAttribute != null && !idreferencePropertyAttribute.IsDefaultAttribute())
                                {
                                    Type type = typeof(TypedControlIDConverter <Control>).GetGenericTypeDefinition();
                                    type = type.MakeGenericType(new Type[]
                                    {
                                        idreferencePropertyAttribute.ReferencedControlType
                                    });
                                    attribute = new TypeConverterAttribute(type);
                                }
                                prop = TypeDescriptor.CreateProperty(prop.ComponentType, prop, new Attribute[]
                                {
                                    BrowsableAttribute.Yes,
                                    attribute
                                });
                                list.Add(prop);
                            }
                        }
                    }
                }
                propertyDescriptorCollection = new PropertyDescriptorCollection(list.ToArray());
            }
            return(propertyDescriptorCollection);
        }
        PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
        {
            // we'll walk the extenders properties looking for the ones marked as ExtenderControl properties.
            // for those, we'll make them visible, then add them to the list.
            //

            PropertyDescriptorCollection propCollection = TypeDescriptor.GetProperties(this.Target);

            if (_propsToHide != null && _propsToHide.Length > 0)
            {
                List <PropertyDescriptor> props = new List <PropertyDescriptor>();

                for (int i = 0; i < propCollection.Count; i++)
                {
                    PropertyDescriptor prop = propCollection[i];

                    ScriptControlPropertyAttribute extenderPropAttr = (ScriptControlPropertyAttribute)prop.Attributes[typeof(ScriptControlPropertyAttribute)];

                    if (extenderPropAttr == null)
                    {
                        continue;
                    }

                    ExtenderVisiblePropertyAttribute evpa = (ExtenderVisiblePropertyAttribute)prop.Attributes[typeof(ExtenderVisiblePropertyAttribute)];

                    if (evpa == null || !evpa.Value)
                    {
                        // if there isn't an ExtenderVisiblePropertyAttribute on here (the designer adds this),
                        // then we shouldn't process it.  Usually this means the developer marked it as Browsable.False.
                        //
                        continue;
                    }

                    // if the name is in the list, remove browsable from the name.
                    //
                    int index = Array.FindIndex <string>(_propsToHide,
                                                         delegate(string s) {
                        return(s == prop.Name);
                    }
                                                         );

                    if (index != -1)
                    {
                        continue;
                    }

                    // add the drop down if it is selectable.
                    //
                    IDReferencePropertyAttribute controlRefAttr = (IDReferencePropertyAttribute)prop.Attributes[typeof(IDReferencePropertyAttribute)];

                    Attribute tca = prop.Attributes[typeof(TypeConverterAttribute)];

                    if (controlRefAttr != null && !controlRefAttr.IsDefaultAttribute())
                    {
                        Type t = typeof(TypedControlIDConverter <Control>).GetGenericTypeDefinition();

                        t = t.MakeGenericType(controlRefAttr.ReferencedControlType);

                        tca = new TypeConverterAttribute(t);
                    }

                    prop = TypeDescriptor.CreateProperty(prop.ComponentType, prop, BrowsableAttribute.Yes, tca);

                    // add it to the list.
                    //
                    props.Add(prop);
                }

                propCollection = new PropertyDescriptorCollection(props.ToArray());
            }
            return(propCollection);
        }