Ejemplo n.º 1
0
        public Type(string moduleName, TypeDefinition type)
        {
            td = type;

            Name      = GetName(type);
            LinkName  = GetName(type, false, true);
            Title     = moduleName + " Documentation - " + Name;
            Namespace = GetNamespace(type);
            Copyright = "This documentation was generated using <a href=\"https://github.com/seaeagle1/XDG\">XDG</a>.";

            CSharpDecl = CSharpTypeDecl(type);

            XmlNode doc = Xdg.FindXmlDoc(type);

            if (doc != null)
            {
                Summary = doc.GetElementContent("summary");
                Remarks = doc.GetElementContent("remarks");
            }

            Methods = new List <Method>();
            foreach (MethodDefinition m in type.Methods)
            {
                if ((!m.IsPublic && !m.IsFamily) || m.IsSetter || m.IsGetter)
                {
                    continue;
                }

                Methods.Add(new Method(m));
            }
            Methods.Sort(new Comparison <Method>((Method a, Method b) => { return(a.Name.CompareTo(b.Name)); }));

            Properties = new List <Property>();
            foreach (PropertyDefinition m in type.Properties)
            {
                bool isPublic = false;
                if (m.GetMethod != null && (m.GetMethod.IsPublic || m.GetMethod.IsFamily))
                {
                    isPublic = true;
                }
                if (m.SetMethod != null && (m.SetMethod.IsPublic || m.SetMethod.IsFamily))
                {
                    isPublic = true;
                }

                if (!isPublic)
                {
                    continue;
                }

                Properties.Add(new Property(m));
            }
            Properties.Sort(new Comparison <Property>((Property a, Property b) => { return(a.Name.CompareTo(b.Name)); }));
        }
Ejemplo n.º 2
0
        public Property(PropertyDefinition def)
        {
            Name = def.Name;
            Type = def.PropertyType.ToXdgUrl();

            XmlNode doc = Xdg.FindXmlDoc(def);

            if (doc != null)
            {
                Summary = doc.GetElementContent("summary");
            }
        }
Ejemplo n.º 3
0
        public Method(MethodDefinition method)
        {
            Name          = method.Name;
            NameWithTypes = BuildNameWithTypes(method);
            if (method.IsPublic)
            {
                Access = "public";
            }
            else if (method.IsFamily)
            {
                Access = "protected";
            }

            if (method.ReturnType.FullName != "System.Void")
            {
                ReturnType = method.ReturnType.ToXdgUrl();
            }

            XmlNode doc = Xdg.FindXmlDoc(method);

            if (doc != null)
            {
                Summary    = doc.GetElementContent("summary");
                Remarks    = doc.GetElementContent("remarks");
                ReturnDocs = doc.GetElementContent("returns");
            }

            Parameters = new List <Parameter>();
            foreach (ParameterDefinition p in method.Parameters)
            {
                Parameter param = new Parameter();
                param.Name = p.Name;
                param.Type = p.ParameterType.ToXdgUrl();

                if (doc != null)
                {
                    param.Doc = doc.GetElementContent("param[@name=\"" + p.Name + "\"]");
                }

                Parameters.Add(param);
            }
        }