コード例 #1
0
        public void LoadFile(string filename)
        {
            XmlDocument document = new XmlDocument();

            document.Load(filename);

            XmlNode compositeNode = document.SelectSingleNode(CompositeXPath);
            string  rootNamespace = GetNodeValue(compositeNode, "@rootNamespace");

            RootNamespace = rootNamespace;

            XmlNodeList types = document.SelectNodes(TypesXPath);

            foreach (XmlNode typeNode in types)
            {
                string typeName     = GetNodeValue(typeNode, "@name");
                string className    = GetNodeValue(typeNode, "@className");
                string theNamespace = GetNodeValue(typeNode, "@namespace");
                if (!Namespaces.Contains(theNamespace))
                {
                    Namespaces.Add(theNamespace);
                }
                CompositeType compositeType = new CompositeType(typeName, className, theNamespace);

                Type foundType = FindType(className, theNamespace);

                foreach (PropertyInfo pi in foundType.GetProperties())
                {
                    if (pi.CanRead && pi.CanWrite)
                    {
                        CompositeProperty property = new CompositeProperty(typeName, pi.Name, pi.PropertyType);
                        compositeType.Properties.Add(property);
                    }
                }

                XmlNodeList hiddenNodes = typeNode.SelectNodes(PropertiesXPath);
                foreach (XmlNode propertyNode in hiddenNodes)
                {
                    string propertyName = GetNodeValue(propertyNode, "@name");
                    string alias        = GetNodeValue(propertyNode, "@alias");
                    bool   isReadOnly   = GetBooleanNodeValue(propertyNode, "@isReadOnly");
                    bool   isHidden     = GetBooleanNodeValue(propertyNode, "@isHidden");

                    CompositeProperty property = compositeType.Properties.FindCompositeProperty(typeName, propertyName);

                    if (property != null)
                    {
                        if (!String.IsNullOrEmpty(alias))
                        {
                            property.Alias = alias;
                        }
                        property.IsReadOnly = isReadOnly;
                        property.IsHidden   = isHidden;
                    }
                }
            }
        }
コード例 #2
0
        public override bool Equals(object obj)
        {
            CompositeProperty other = obj as CompositeProperty;

            if (other == null)
            {
                return(false);
            }
            return(ParentClassName.Equals(other.ParentClassName) &&
                   PropertyName.Equals(other.PropertyName) &&
                   Type.Equals(other.Type) &&
                   FieldName.Equals(other.FieldName));
        }