Esempio n. 1
0
        private static UMLAttributeCollection GetProperties(Type type)
        {
            UMLAttributeCollection attributes = new UMLAttributeCollection();

            foreach (PropertyInfo property in type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
            {
                if (property.DeclaringType == type && !property.IsSpecialName)
                {
                    MethodInfo methodInfo = property.GetGetMethod(true);

                    if (methodInfo != null)
                    {
                        UMLAttribute attribute = new UMLAttribute();
                        attribute.Name = property.Name;
                        attribute.Type = property.PropertyType.Name;
                                                
                        if (methodInfo.IsPublic)
                        {
                            attribute.Visibility = Visibility.Public;
                        }
                        if (methodInfo.IsPrivate)
                        {
                            attribute.Visibility = Visibility.Private;
                        }
                        if (methodInfo.IsFamily)
                        {
                            attribute.Visibility = Visibility.Protected;
                        }
                        attributes.Add(attribute);
                    }

                }
            }
            return attributes;
        }
Esempio n. 2
0
        private static UMLAttributeCollection GetStaticAndConstants(Type type)
        {
            UMLAttributeCollection attributes = new UMLAttributeCollection();

            foreach (FieldInfo filed in type.GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                if (filed.DeclaringType == type && !filed.IsSpecialName)
                {
                    UMLAttribute attribute = new UMLAttribute();
                    attribute.Name = filed.Name;
                    attribute.Type = filed.FieldType.Name;
                    attributes.Add(attribute);
                }
            }
            return attributes;
        }