protected AttributeCollection GetAttributes(IComponent comp) { if (_attributes != null) { return(_attributes); } bool flag = true; ArrayList arrayList = new ArrayList(); object[] customAttributes = _infoType.GetCustomAttributes(inherit: false); for (int i = 0; i < customAttributes.Length; i++) { Attribute value = (Attribute)customAttributes[i]; arrayList.Add(value); } Type baseType = _infoType.BaseType; while (baseType != null && baseType != typeof(object)) { object[] customAttributes2 = baseType.GetCustomAttributes(inherit: false); for (int j = 0; j < customAttributes2.Length; j++) { Attribute value2 = (Attribute)customAttributes2[j]; arrayList.Add(value2); } baseType = baseType.BaseType; } Type[] interfaces = _infoType.GetInterfaces(); foreach (Type componentType in interfaces) { foreach (Attribute attribute2 in TypeDescriptor.GetAttributes(componentType)) { arrayList.Add(attribute2); } } Hashtable hashtable = new Hashtable(); for (int num = arrayList.Count - 1; num >= 0; num--) { Attribute attribute = (Attribute)arrayList[num]; hashtable[attribute.TypeId] = attribute; } if (comp != null && comp.Site != null) { ITypeDescriptorFilterService typeDescriptorFilterService = (ITypeDescriptorFilterService)comp.Site.GetService(typeof(ITypeDescriptorFilterService)); if (typeDescriptorFilterService != null) { flag = typeDescriptorFilterService.FilterAttributes(comp, hashtable); } } Attribute[] array = new Attribute[hashtable.Values.Count]; hashtable.Values.CopyTo(array, 0); AttributeCollection attributeCollection = new AttributeCollection(array); if (flag) { _attributes = attributeCollection; } return(attributeCollection); }
public bool FilterAttributes(IComponent component, System.Collections.IDictionary attributes) { if (oldService != null) { oldService.FilterAttributes(component, attributes); } return(true); }
bool ITypeDescriptorFilterService.FilterAttributes(IComponent component, IDictionary attributes) { if (innerFilter != this) { return(innerFilter.FilterAttributes(component, attributes)); } return(true); }
public bool FilterAttributes(System.ComponentModel.IComponent component, System.Collections.IDictionary attributes) { if (oldService != null) { oldService.FilterAttributes(component, attributes); } // Creates a designer attribute to compare its TypeID with the TypeID of existing attributes of the component. DesignerAttribute da = new DesignerAttribute(typeof(ColorCycleButtonDesigner)); // Adds the designer attribute if the attribute collection does not contain a DesignerAttribute of the same TypeID. if (component is System.Windows.Forms.Button && attributes.Contains(da.TypeId)) { attributes[da.TypeId] = da; } return(true); }
protected AttributeCollection GetAttributes(IComponent comp) { if (_attributes != null) { return(_attributes); } bool cache = true; object[] ats = _infoType.GetCustomAttributes(true); Hashtable t = new Hashtable(); // Filter the custom attributes, so that only the top // level of the same type are left. // for (int i = ats.Length - 1; i >= 0; i--) { t [((Attribute)ats[i]).TypeId] = ats[i]; } if (comp != null && comp.Site != null) { ITypeDescriptorFilterService filter = (ITypeDescriptorFilterService)comp.Site.GetService(typeof(ITypeDescriptorFilterService)); if (filter != null) { cache = filter.FilterAttributes(comp, t); } } ArrayList atts = new ArrayList(); atts.AddRange(t.Values); AttributeCollection attCol = new AttributeCollection(atts); if (cache) { _attributes = attCol; } return(attCol); }
public bool FilterAttributes(IComponent component, System.Collections.IDictionary attributes) { return(baseServ.FilterAttributes(component, attributes)); }
public bool FilterAttributes(IComponent component, IDictionary attributes) => _originalService.FilterAttributes(component, attributes);
bool ITypeDescriptorFilterService.FilterAttributes(IComponent component, IDictionary attributes) { return(svc.FilterAttributes(component, attributes)); }