Inheritance: System.Attribute
Exemple #1
0
        public override bool Equals(object value)
        {
            if (this == value)
            {
                return(true);
            }
            ReadOnlyAttribute attribute = value as ReadOnlyAttribute;

            return((attribute != null) && (attribute.IsReadOnly == this.IsReadOnly));
        }
        /// <internalonly/>
        /// <devdoc>
        /// </devdoc>
        public override bool Equals(object value)
        {
            if (this == value)
            {
                return(true);
            }

            ReadOnlyAttribute other = value as ReadOnlyAttribute;

            return(other != null && other.IsReadOnly == IsReadOnly);
        }
        private void ScanAnalysisServicesObjectForPropertiesWithNonDefaultValue(object o, string FriendlyPath)
        {
            if (o == null)
            {
                return;
            }

            PropertyInfo[] properties = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance);
            foreach (PropertyInfo prop in properties)
            {
                if (!prop.CanWrite || !prop.CanRead)
                {
                    continue;
                }

                object[] attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.DefaultValueAttribute), true);
                System.ComponentModel.DefaultValueAttribute defaultAttr = (System.ComponentModel.DefaultValueAttribute)(attrs.Length > 0 ? attrs[0] : null);
                if (defaultAttr == null)
                {
                    continue;                      //only show properties with defaults
                }
                attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.BrowsableAttribute), true);
                System.ComponentModel.BrowsableAttribute browsableAttr = (System.ComponentModel.BrowsableAttribute)(attrs.Length > 0 ? attrs[0] : null);
                if (browsableAttr != null && !browsableAttr.Browsable)
                {
                    continue;                                                    //don't show attributes marked not browsable
                }
                attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.ReadOnlyAttribute), true);
                System.ComponentModel.ReadOnlyAttribute readOnlyAttr = (System.ComponentModel.ReadOnlyAttribute)(attrs.Length > 0 ? attrs[0] : null);
                if (readOnlyAttr != null && readOnlyAttr.IsReadOnly)
                {
                    continue;                                                  //don't show attributes marked read only
                }
                if (prop.PropertyType.Namespace != "System" && !prop.PropertyType.IsPrimitive && !prop.PropertyType.IsValueType && !prop.PropertyType.IsEnum)
                {
                    object v = prop.GetValue(o, null);
                    if (v != null)
                    {
                        ScanAnalysisServicesObjectForPropertiesWithNonDefaultValue(v, FriendlyPath + " > " + prop.Name);
                    }
                    continue;
                }

                object value = prop.GetValue(o, null);
                if (defaultAttr.Value != null && !defaultAttr.Value.Equals(value))
                {
                    string sValue = (value == null ? string.Empty : value.ToString());
                    this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath, prop.Name, defaultAttr.Value.ToString(), sValue));
                }
            }
        }
 protected override Attribute OnEvaluateComplete(object value)
 {
     Attribute output;
     try
     {
         // check if value is provided
         if (value == null)
             value = true; // assume default
         // create attribute
         output = new BrowsableAttribute((bool) value);
     }
     catch
     {
         output = new ReadOnlyAttribute(true);
     }
     return output;
 }
        public ObjectPropertyDescriptor(MemberDescriptor descr, IContext context, IPropertyMap propertyMap, object obj, Attribute[] attrs)
            : base(descr, attrs)
        {
            this.realPropertyDescriptor = (PropertyDescriptor) descr;
            this.name = propertyMap.Name;
            this.displayName = propertyMap.Name;

            Attribute[] attribs = new Attribute[descr.Attributes.Count + 4];

            int i = 0;
            foreach (Attribute attrib in descr.Attributes)
            {
                attribs[i] = attrib;
                i++;
            }
            attribs[i] = new DescriptionAttribute(propertyMap.Name + " is a property.");
            attribs[i + 1] = new CategoryAttribute("");
            attribs[i + 2] = new DefaultValueAttribute(context.ObjectManager.GetOriginalPropertyValue(obj, propertyMap.Name));
            attribs[i + 3] = new ReadOnlyAttribute(propertyMap.IsReadOnly);

            attributes = new AttributeCollection(attribs);
        }
        public WrappedProperty(MemberDescriptor descr, PropertyView propertyView, Attribute[] attrs)
            : base(descr, attrs)
        {
            this.realPropertyDescriptor = (PropertyDescriptor) descr;
            this.name = propertyView.Name;
            this.displayName = propertyView.DisplayName;

            Attribute[] attribs = new Attribute[descr.Attributes.Count + 4];

            int i = 0;
            foreach (Attribute attrib in descr.Attributes)
            {
                attribs[i] = attrib;
                i++;
            }
            attribs[i] = new DescriptionAttribute(propertyView.Description);
            attribs[i + 1] = new CategoryAttribute(propertyView.Category);
            attribs[i + 2] = new DescriptionAttribute(propertyView.Description);
            attribs[i + 3] = new ReadOnlyAttribute(propertyView.IsReadOnly);

            attributes = new AttributeCollection(attribs);
        }
 public void SetIsReadOnly(bool isReadOnly)
 {
     var attr = (ReadOnlyAttribute)attributes.FirstOrDefault(a => a is ReadOnlyAttribute);
     if (attr != null)
     {
         attributes.RemoveAll(a => a is ReadOnlyAttribute);
     }
     attr = new ReadOnlyAttribute(isReadOnly);
     attributes.Add(attr);
 }
Exemple #8
0
        public ParameterList GetParameters(string name, object obj)
        {
            var parameterList = new ParameterList() {Name = name};
            var pred = new Predicate<Attribute>(a =>
            {
                var t = a.GetType();
                return t.FullName.Contains("ComponentModel") && t.Name != "PropertyTabAttribute" && t.Name != "ToolboxItemAttribute";
            });
            foreach (var info in obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                if (info.CanRead && info.GetCustomAttribute(typeof(TypeConverterAttribute)) == null)
                {
                    var list = info.GetCustomAttributes().Where(p => pred(p)).ToList();
                    if (!info.CanWrite)
                    {
                        var item = new ReadOnlyAttribute(true);
                        if (!list.Contains(item))
                            list.Add(item);
                    }
                    parameterList.Add(new Parameter(info.Name, info.GetValue(obj), info.PropertyType.AssemblyQualifiedName, list.ToArray()));
                }
            }
            var fields = obj.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public).Where(f => f.GetCustomAttribute(typeof(TypeConverterAttribute)) == null);
            foreach (var param in fields.Select(f => new Parameter(f.Name, f.GetValue(obj), f.FieldType.AssemblyQualifiedName, f.GetCustomAttributes().Where(a => pred(a)).ToArray())))
                parameterList.Add(param);

            return parameterList;
        }
        private void ScanIntegrationServicesExecutableForPropertiesWithNonDefaultValue(DtsObject o, string FriendlyPath)
        {
            if (o == null)
            {
                return;
            }

            if (packageDefault == null)
            {
                packageDefault = new Package();
            }

            DtsObject defaultObject;

            if (o is Package)
            {
                defaultObject = packageDefault;
            }
            else if (o is IDTSName)
            {
                if (dictCachedDtsObjects.ContainsKey(((IDTSName)o).CreationName))
                {
                    defaultObject = dictCachedDtsObjects[((IDTSName)o).CreationName];
                }
                else if (o is DtsEventHandler)
                {
                    defaultObject = (DtsObject)packageDefault.EventHandlers.Add(((IDTSName)o).CreationName);
                    dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject);
                }
                else if (o is ConnectionManager)
                {
                    defaultObject = (DtsObject)packageDefault.Connections.Add(((IDTSName)o).CreationName);
                    dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject);
                }
                else
                {
                    defaultObject = packageDefault.Executables.Add(((IDTSName)o).CreationName);
                    dictCachedDtsObjects.Add(((IDTSName)o).CreationName, defaultObject);
                }
            }
            else
            {
                throw new Exception("Object " + o.GetType().FullName + " does not implement IDTSName.");
            }

            PropertyInfo[] properties = o.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance);
            foreach (PropertyInfo prop in properties)
            {
                if (!prop.CanWrite || !prop.CanRead)
                {
                    continue;
                }

                //SSIS objects don't have a DefaultValueAttribute, which is wy we have to create a new control flow object (defaultObject) above and compare properties from this object to that object

                object[] attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.BrowsableAttribute), true);
                System.ComponentModel.BrowsableAttribute browsableAttr = (System.ComponentModel.BrowsableAttribute)(attrs.Length > 0 ? attrs[0] : null);
                if (browsableAttr != null && !browsableAttr.Browsable)
                {
                    continue;                                                    //don't show attributes marked not browsable
                }
                attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.ReadOnlyAttribute), true);
                System.ComponentModel.ReadOnlyAttribute readOnlyAttr = (System.ComponentModel.ReadOnlyAttribute)(attrs.Length > 0 ? attrs[0] : null);
                if (readOnlyAttr != null && readOnlyAttr.IsReadOnly)
                {
                    continue;                                                  //don't show attributes marked read only
                }
                if (prop.PropertyType.Namespace != "System" && !prop.PropertyType.IsPrimitive && !prop.PropertyType.IsValueType && !prop.PropertyType.IsEnum)
                {
                    continue;
                }
                if (prop.PropertyType == typeof(DateTime))
                {
                    continue;
                }
                if (prop.PropertyType == typeof(string))
                {
                    continue;
                }
                if (prop.Name == "VersionBuild")
                {
                    continue;
                }
                if (prop.Name == "VersionMajor")
                {
                    continue;
                }
                if (prop.Name == "VersionMinor")
                {
                    continue;
                }
                if (prop.Name == "PackageType")
                {
                    continue;
                }

                object value        = prop.GetValue(o, null);
                object defaultValue = prop.GetValue(defaultObject, null);
                if (defaultValue != null && !defaultValue.Equals(value))
                {
                    string sValue = (value == null ? string.Empty : value.ToString());
                    this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath, prop.Name, defaultValue.ToString(), sValue));
                }
            }

            if (o is IDTSObjectHost)
            {
                IDTSObjectHost host = (IDTSObjectHost)o;
                if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)
                {
                    properties = typeof(Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe).GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance);
                }
                else if (host.InnerObject is IDTSConnectionManagerDatabaseParametersXX)
                {
                    properties = typeof(IDTSConnectionManagerDatabaseParametersXX).GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance);
                }
                else //probably won't turn up any properties because reflection on a COM object Type doesn't work
                {
                    properties = host.InnerObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance);
                }

                foreach (PropertyInfo prop in properties)
                {
                    if (!prop.CanWrite || !prop.CanRead)
                    {
                        continue;
                    }

                    object[] attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.BrowsableAttribute), true);
                    System.ComponentModel.BrowsableAttribute browsableAttr = (System.ComponentModel.BrowsableAttribute)(attrs.Length > 0 ? attrs[0] : null);
                    if (browsableAttr != null && !browsableAttr.Browsable)
                    {
                        continue;                                                    //don't show attributes marked not browsable
                    }
                    attrs = prop.GetCustomAttributes(typeof(System.ComponentModel.ReadOnlyAttribute), true);
                    System.ComponentModel.ReadOnlyAttribute readOnlyAttr = (System.ComponentModel.ReadOnlyAttribute)(attrs.Length > 0 ? attrs[0] : null);
                    if (readOnlyAttr != null && readOnlyAttr.IsReadOnly)
                    {
                        continue;                                                  //don't show attributes marked read only
                    }
                    if (prop.PropertyType.Namespace != "System" && !prop.PropertyType.IsPrimitive && !prop.PropertyType.IsValueType && !prop.PropertyType.IsEnum)
                    {
                        continue;
                    }
                    if (prop.PropertyType == typeof(DateTime))
                    {
                        continue;
                    }
                    if (prop.PropertyType == typeof(string))
                    {
                        continue;
                    }
                    if (prop.Name == "VersionBuild")
                    {
                        continue;
                    }
                    if (prop.Name == "VersionMajor")
                    {
                        continue;
                    }
                    if (prop.Name == "VersionMinor")
                    {
                        continue;
                    }
                    if (prop.Name == "PackageType")
                    {
                        continue;
                    }
                    if (prop.Name.StartsWith("IDTS"))
                    {
                        continue;
                    }

                    object value;
                    object defaultValue;
                    if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)
                    {
                        try
                        {
                            value = host.InnerObject.GetType().InvokeMember(prop.Name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, host.InnerObject, null);
                        }
                        catch
                        {
                            continue;
                        }
                        try
                        {
                            defaultValue = ((IDTSObjectHost)defaultObject).InnerObject.GetType().InvokeMember(prop.Name, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, ((IDTSObjectHost)defaultObject).InnerObject, null);
                        }
                        catch
                        {
                            defaultValue = null;
                        }
                    }
                    else
                    {
                        value        = prop.GetValue(host.InnerObject, null);
                        defaultValue = prop.GetValue(((IDTSObjectHost)defaultObject).InnerObject, null);
                    }
                    if (defaultValue != null && !defaultValue.Equals(value))
                    {
                        string sValue = (value == null ? string.Empty : value.ToString());
                        this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath, prop.Name, defaultValue.ToString(), sValue));
                    }
                }

                //scan data flow transforms
                if (host.InnerObject is Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)
                {
                    Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe pipe        = (Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)host.InnerObject;
                    Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe defaultPipe = (Microsoft.SqlServer.Dts.Pipeline.Wrapper.MainPipe)((IDTSObjectHost)defaultObject).InnerObject;
                    foreach (IDTSComponentMetaDataXX transform in pipe.ComponentMetaDataCollection)
                    {
                        IDTSComponentMetaDataXX defaultTransform = defaultPipe.ComponentMetaDataCollection.New();
                        defaultTransform.ComponentClassID = transform.ComponentClassID;
                        CManagedComponentWrapper defaultInst = defaultTransform.Instantiate();
                        try
                        {
                            defaultInst.ProvideComponentProperties();
                        }
                        catch
                        {
                            continue; //if there's a corrupt package (or if you don't have the component installed on your laptop?) then this might fail... so just move on
                        }

                        if (!transform.ValidateExternalMetadata) //this property isn't in the CustomPropertyCollection, so we have to check it manually
                        {
                            this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, "ValidateExternalMetadata", "True", "False"));
                        }
                        foreach (IDTSOutputXX output in transform.OutputCollection) //check for error row dispositions
                        {
                            if (output.ErrorRowDisposition == DTSRowDisposition.RD_IgnoreFailure)
                            {
                                this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name + "\\" + output.Name, "ErrorRowDisposition", "FailComponent", "IgnoreFailure"));
                            }
                            if (output.TruncationRowDisposition == DTSRowDisposition.RD_IgnoreFailure)
                            {
                                this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name + "\\" + output.Name, "TruncationRowDisposition", "FailComponent", "IgnoreFailure"));
                            }
                        }

                        Microsoft.DataTransformationServices.Design.PipelinePropertiesWrapper propWrapper = new Microsoft.DataTransformationServices.Design.PipelinePropertiesWrapper(transform, transform, 0);

                        foreach (IDTSCustomPropertyXX prop in transform.CustomPropertyCollection)
                        {
                            System.ComponentModel.PropertyDescriptor propDesc = (System.ComponentModel.PropertyDescriptor)propWrapper.GetType().InvokeMember("CreateCustomPropertyPropertyDescriptor", BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance, null, propWrapper, new object[] { prop });
                            if (propDesc == null)
                            {
                                continue;
                            }
                            if (propDesc.IsReadOnly)
                            {
                                continue;
                            }
                            if (!propDesc.IsBrowsable)
                            {
                                continue;
                            }
                            if (prop.Value is string)
                            {
                                continue;
                            }
                            if (prop.Value is DateTime)
                            {
                                continue;
                            }
                            IDTSCustomPropertyXX defaultProp;
                            try
                            {
                                defaultProp = defaultTransform.CustomPropertyCollection[prop.Name];
                            }
                            catch
                            {
                                if (prop.Name == "PreCompile" && bool.Equals(prop.Value, false)) //this property doesn't show up in the new script component we created to determine defaults, so we have to check it manually
                                {
                                    this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, prop.Name, "True", "False"));
                                }
                                continue;
                            }

                            System.ComponentModel.ITypeDescriptorContext context = new PipelinePropertyContext(transform, propDesc);
                            string sValue        = propDesc.Converter.ConvertToString(context, prop.Value);        //gets nice text descriptions for enums on component properties
                            string sDefaultValue = propDesc.Converter.ConvertToString(context, defaultProp.Value); //gets nice text descriptions for enums on component properties
                            if (sValue == sDefaultValue)
                            {
                                continue;
                            }

                            this.listNonDefaultProperties.Add(new NonDefaultProperty(this.DatabaseName, FriendlyPath + "\\" + transform.Name, prop.Name, sDefaultValue, sValue));
                        }

                        defaultPipe.ComponentMetaDataCollection.RemoveObjectByID(defaultTransform.ID);
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of <see cref="T:Dataweb.NShape.Advanced.PropertyDescriptorDg" />
        /// </summary>
        public PropertyDescriptorDg(IPropertyController controller, PropertyDescriptor descriptor, Attribute[] attributes)
            : base(descriptor.Name, attributes)
        {
            this.descriptor = descriptor;
            this.controller = controller;

            // We have to store the attributes and return their values in the appropriate
            // methods because if we don't, modifying the readonly attribute will not work
            browsableAttr = Attributes[typeof(BrowsableAttribute)] as BrowsableAttribute;
            readOnlyAttr = Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute;
            descriptionAttr = Attributes[typeof(DescriptionAttribute)] as DescriptionAttribute;
            permissionAttr = descriptor.Attributes[typeof(RequiredPermissionAttribute)] as RequiredPermissionAttribute;
        }
        private void ProcessProperties(PropertyInfo[] properties)
        {
            foreach (PropertyInfo property in properties)
            {
                List<Attribute> additionalAttributes = new List<Attribute>();

                #region determine if the property should be displayed
                BrowsableAttribute[] batt = property.GetCustomAttributes(typeof(BrowsableAttribute), true) as BrowsableAttribute[];
                if (batt == null || batt.Length == 0 || batt[0].Browsable == false)
                    continue; // skip the rest of the property processing
                additionalAttributes.Add(batt[0]);
                #endregion
                #region determine if the property has a friendly name
                string propertyName = property.Name;
                NameAttribute[] natt = property.GetCustomAttributes(typeof(NameAttribute), true) as NameAttribute[];
                if (natt != null && natt.Length > 0 && natt[0].Name != null && natt[0].Name.Length > 0)
                    propertyName = natt[0].Name;
                #endregion

                Type propertyType = property.PropertyType;
                string category = null, description = null, typeEditorName = null, typeConverterName = null;
                object defaultValue = null;
                bool isReadOnly = false;
                #region determine if the property is read-only
                MethodInfo miGetProp = property.GetGetMethod(true);
                MethodInfo miSetProp = property.GetSetMethod(true);
                if (miSetProp == null)
                {
                    ReadOnlyAttribute ro = new ReadOnlyAttribute(true);
                    isReadOnly = true;
                    additionalAttributes.Add(ro);
                }
                #endregion
                #region determine if it has a Category
                CategoryAttribute[] catt = property.GetCustomAttributes(typeof(CategoryAttribute), true) as CategoryAttribute[];
                if (catt != null && catt.Length > 0)
                    category = catt[0].Category;
                #endregion
                #region determine if it has a Description
                DescriptionAttribute[] datt = property.GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
                if (datt != null && datt.Length > 0)
                    description = datt[0].Description;
                #endregion
                #region determine if it has a default value
                DefaultValueAttribute[] dvatt = property.GetCustomAttributes(typeof(DefaultValueAttribute), true) as DefaultValueAttribute[];
                if (dvatt != null && dvatt.Length > 0)
                    defaultValue = dvatt[0].Value;
                #endregion
                #region determine if it has a type editor
                EditorAttribute[] eatt = property.GetCustomAttributes(typeof(EditorAttribute), true) as EditorAttribute[];
                if (eatt != null && eatt.Length > 0)
                    typeEditorName = eatt[0].EditorTypeName;
                #endregion
                #region determine if it has a type converter
                TypeConverterAttribute[] tcatt = property.GetCustomAttributes(typeof(TypeConverterAttribute), true) as TypeConverterAttribute[];
                if (tcatt != null && tcatt.Length > 0)
                    typeConverterName = tcatt[0].ConverterTypeName;
                #endregion

                List<Attribute> otherAttributes = CheckForAdditionalAttributes(property.GetCustomAttributes(true));

                additionalAttributes.AddRange(otherAttributes);

                PropertyDescriptorEx pdex = new PropertyDescriptorEx(propertyName, property.Name, category, defaultValue, description,
                    typeEditorName, typeConverterName, propertyType, isReadOnly, additionalAttributes.ToArray(), miGetProp, miSetProp, this);

                this.m_descriptors.Add(propertyName, pdex);
 
            }
        }
Exemple #12
0
        public WidgetProps ParseXml(string xmlfilename)
        {
            WidgetProps props = null;
            string elemType = "";
            string elemName = "";
            object elemValue = null;
            string elemCategory = "";
            string elemDesc = "";
            bool elemBrowsable = true;
            bool elemReadOnly = false;
            string elemEditor = "";
            string elemTypeConv = "";

            // Parse XML file
            System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
            System.IO.Stream str = a.GetManifestResourceStream("mkdb.Properties.wxprops.xsd");
            xsd_settings = new XmlReaderSettings();
            xsd_settings.ValidationType = ValidationType.Schema;
            xsd_settings.Schemas.Add("wxprops", new XmlTextReader(str));
            // xsd_settings.Schemas.Add("props", xsdfilename);

            using (r = XmlReader.Create(xmlfilename, xsd_settings))
              			while (r.Read())
              			{
                switch (r.NodeType)
                {
              				case XmlNodeType.Element:
                        if (r.Name == "Catalog")
                        {
                            // Set Name
                            if (props == null)
                            {
                                props = new WidgetProps();
                            }
                            props.Name = r["Name"];
                            // this.name = r["Name"];
                            // this.basecontainername = r["Base"];
                        }
                        if (r.Name == "Category")
                        {
                            elemCategory = GetElemString(r);
                        }
                        if (r.Name == "Property")
                        {
                            // Parse the data...
                            elemType = "";
                            elemName = r["Name"];
                            elemValue = null;
                            elemDesc = "";
                            elemBrowsable = true;
                            elemReadOnly = false;
                            elemEditor = "";
                            elemTypeConv = "";
                        }
                        if (r.Name == "Type") elemType = GetElemString(r);
                        if (r.Name == "Description") elemDesc = GetElemString(r);
                        if (r.Name == "Editor") elemEditor = GetElemString(r);
                        if (r.Name == "TypeConverter") elemTypeConv = GetElemString(r);
                        if (r.Name == "Value") GetElemValue(r, elemType, out elemValue);
                        break;
              				case XmlNodeType.EndElement:
                        if (r.Name == "Property")
                        {
                            // We should have all the info...
                            // build this GenericProperty
                            int attCount = 2;
                            if (elemEditor != "") attCount++;
                            if (elemTypeConv != "") attCount++;
                            Attribute[] attr = new Attribute[attCount];
                            attr[0] = new BrowsableAttribute(elemBrowsable);
                            attr[1] = new ReadOnlyAttribute(elemReadOnly);
                            attCount = 2;
                            if (elemEditor != "")
                            {
                                attr[attCount++] = new EditorAttribute(elemEditor, "UITypeEditor");
                            }
                            if (elemTypeConv != "")
                            {
                                attr[attCount++] = new TypeConverterAttribute(elemTypeConv);
                            }
                            if (elemValue == null)
                            {
                                GetElemDefault(r, elemType, elemValue);
                            }
                            props.Properties.AddProperty(new GenericProperty(elemName, elemValue, elemCategory,
                                                                             elemDesc, attr));
                        }
                        if (r.Name == "Category")
                        {
                            elemCategory = "";
                        }
                        break;

              				case XmlNodeType.Text:
              				case XmlNodeType.CDATA:
              				case XmlNodeType.Comment:
              				case XmlNodeType.XmlDeclaration:
                        break;

              				case XmlNodeType.DocumentType:
                        break;

              				default: break;
                }
              			}
            _wplist.Add(props);
            return props;
        }