コード例 #1
0
 public void printProperty(DoxProperty dp, bool detailed)
 {
     printMember(dp, detailed);
 }
コード例 #2
0
        /// <summary>
        /// Parse the properties.
        /// </summary>
        /// <param name="propertys">Array of the propoerties</param>
        /// <param name="dc">The base classifier, where the properties are.</param>
        private void parseProperty(PropertyInfo[] propertys, DoxClassifier dc)
        {
            foreach (PropertyInfo property in propertys)
            {
                DoxProperty dp = new DoxProperty();
                if(property.Name.First().Equals('<')|| property.Name.Contains("<>"))
                {
                    continue;
                }
                dp.Name = property.Name;
                dp.Identifier = dc.Name.Replace('+','.') + '.' + dp.Name;
                dp.Sealed = property.PropertyType.IsSealed;
                if (property.PropertyType.GenericTypeArguments.Length > 0)
                {
                    String type = property.PropertyType.Name.Substring(0, property.PropertyType.Name.Length - 2);
                    type = type + '<';
                    bool first = true;
                    foreach (var item in property.PropertyType.GenericTypeArguments)
                    {
                        if (first)
                        {
                            type = type + item.Name;
                            first = false;
                        }
                        else
                        {
                            type = type + ", " + item.Name;
                        }
                    }
                    type = type + '>';
                    dp.Definition = type;
                }
                else
                {
                    dp.Definition = property.PropertyType.Name;
                }
                String[] attributes = property.PropertyType.Attributes.ToString().Replace(" ", string.Empty).Split(',');
                foreach (string attr in attributes)
                {
                    switch (attr)
                    {
                        case "Public":
                        case "NestedPublic":
                            dp.ProtectionKind = ProtectionKind.Public;
                            break;
                        case "Protected":
                            dp.ProtectionKind = ProtectionKind.Protected;
                            break;
                        case "NestedPrivate":
                        case "Private":
                            dp.ProtectionKind = ProtectionKind.Private;
                            break;
                        case "Abstract":
                            dp.VirtualKind = VirtualKind.Abstract;
                            break;
                        case "Serializable":
                        case "Sealed":
                        case "AutoLayout":
                        case "AnsiClass":
                        case "Class":
                        case "SequentialLayout":
                        case "ClassSemanticsMask":
                        case "HasSecurity":
                        case "BeforeFieldInit":
                            break;
                        default:
                            this.Log(LogKind.Warning, attr + " can't be processed as attribute of attributes.");
                            break;
                    }
                }
                dc.Members.Add(dp);
                //String briefDescription = getDescription(dp.Identifier, DescriptionType.Brief);
                //String detailedDescription = getDescription(dp.Identifier, DescriptionType.Detailed);
                MemberIndex mi = new MemberIndex();
                mi.Identifier = dp.Identifier;
                mi.Kind = dp.Kind;
                mi.Member = dp;
                mi.Name = dp.Name;
                try
                {
                    this.Model.MemberRefs.Add(dp.Identifier, dp);
                    this.Index.MemberIndexRefs.Add(dp.Identifier, mi);
                }
                catch(ArgumentException ae)
                {
                    this.Log(LogKind.Error, ae.Message + " " + mi.Identifier);
                }

            }
        }