Exemple #1
0
        public void Add(List <Namespace> namespaces, DocumentedProperty association)
        {
            if (association.Property == null)
            {
                return;
            }

            var ns   = FindNamespace(association, namespaces);
            var type = FindType(ns, association);

            var propertyReturnType =
                DeclaredType.Unresolved(Identifier.FromType(association.Property.PropertyType),
                                        association.Property.PropertyType,
                                        Namespace.Unresolved(
                                            Identifier.FromNamespace(association.Property.PropertyType.Namespace)));
            var doc = Property.Unresolved(Identifier.FromProperty(association.Property, association.TargetType), type, propertyReturnType);

            ParseSummary(association, doc);
            ParseValue(association, doc);
            ParseRemarks(association, doc);
            ParseExample(association, doc);

            if (matchedAssociations.ContainsKey(association.Name))
            {
                return;
            }

            matchedAssociations.Add(association.Name, doc);
            if (type == null)
            {
                return;
            }
            type.AddProperty(doc);
        }
Exemple #2
0
 public static IHtmlString PropertyName(this ApiServices context, DocumentedProperty property)
 {
     if (property != null)
     {
         return(MvcHtmlString.Create(property.Definition.Name));
     }
     return(MvcHtmlString.Create(string.Empty));
 }
 public void Text_PlotProperties_AllHaveSummaries()
 {
     foreach (PropertyInfo info in ScottPlot.Cookbook.Locate.GetPlotProperties())
     {
         var p = new DocumentedProperty(info, LoadedXmlDocument);
         Assert.IsNotNull(p.Summary);
     }
 }
Exemple #4
0
        private string GetUrl(DocumentedProperty property)
        {
            var nsRoute       = _service.GetRoutePart(property.Type.Namespace);
            var typeRoute     = _service.GetRoutePart(property.Type);
            var propertyRoute = _service.GetRoutePart(property);

            return(string.Concat(nsRoute, "/", typeRoute, "/", propertyRoute));
        }
Exemple #5
0
 protected void AddDetailedInfo(DocumentedProperty p)
 {
     AddHeading(p.Name, 3);
     if (!string.IsNullOrWhiteSpace(p.Summary))
     {
         Add($"**Summary:** {p.Summary}");
     }
     Add($"**Name:** `{p.FullName}`");
     Add($"**Type:** `{p.Type}`");
 }
        public static IHtmlString BreadCrumb(this ApiServices context, DocumentedProperty property)
        {
            var breadcrumb = new Breadcrumb();

            breadcrumb.AppendApiRoot();
            breadcrumb.AppendNamespaces(context, property.Type.Namespace, true);
            breadcrumb.AppendType(context, property.Type, true);
            breadcrumb.AppendProperty(context, property);
            return(breadcrumb.Render());
        }
Exemple #7
0
        protected string OneLineInfo(DocumentedProperty property, string baseUrl)
        {
            string        url = Sanitize(property.Name);
            StringBuilder sb  = new StringBuilder();

            sb.Append($"<a href='{baseUrl}#{url}'><strong>{property.Name}</strong></a>");
            if (!string.IsNullOrWhiteSpace(property.Summary))
            {
                sb.Append(" - " + property.Summary);
            }
            return(sb.ToString());
        }
Exemple #8
0
        static void MatchProperty(List <IDocumentationMember> members, XmlNode node)
        {
            Identifier member = IdentifierFor.XmlString(node.Attributes["name"].Value);

            for (int i = 0; i < members.Count; i++)
            {
                var reflected = members[i] as ReflectedProperty;
                if (reflected != null && reflected.Match(member))
                {
                    members[i] = new DocumentedProperty(reflected.Name, node, reflected.Property, reflected.TargetType);
                }
            }
        }
Exemple #9
0
        private void ParseProperty(List <IDocumentationMember> members, XmlNode node)
        {
            Identifier member = Identifier.FromString(node.Attributes["name"].Value);

            for (int i = 0; i < members.Count; i++)
            {
                var propertyMember = members[i] as UndocumentedProperty;

                if (propertyMember != null && propertyMember.Match(member))
                {
                    members[i] = new DocumentedProperty(member, node, propertyMember.Property, propertyMember.TargetType);
                }
            }
        }
Exemple #10
0
 public static IHtmlString PropertyLink(this ApiServices context, DocumentedProperty property)
 {
     if (property != null)
     {
         var url = context.UrlResolver.GetUrl(property.Identity);
         if (url != null)
         {
             var writer = new HtmlTextWriter(new StringWriter());
             writer.AddAttribute(HtmlTextWriterAttribute.Href, url);
             writer.RenderBeginTag(HtmlTextWriterTag.A);
             writer.WriteEncodedText(property.Definition.Name);
             writer.RenderEndTag();
             return(MvcHtmlString.Create(writer.InnerWriter.ToString()));
         }
         return(MvcHtmlString.Create(property.Definition.Name));
     }
     return(MvcHtmlString.Create(string.Empty));
 }
 public PropertyViewModel(DocumentedProperty data)
 {
     _data = data;
 }
Exemple #12
0
 public IEncodedString Link(DocumentedProperty property)
 {
     return(Link(property.Definition));
 }
Exemple #13
0
 public PropertyViewModel(ApiContext context, DocumentedProperty property, Content parent, string title)
     : base(context, parent, title)
 {
     _property = property;
 }
 public string GetLinkPart(DocumentedProperty property)
 {
     return(string.Format("{0:X8}", property.Identity.GetHashCode()).ToLowerInvariant());
 }
Exemple #15
0
 public static void AppendProperty(this IBreadcrumbItem breadcrumb, ApiServices context, DocumentedProperty property)
 {
     breadcrumb.Append(new BreadcrumbItem(MvcHtmlString.Create(property.Definition.Name)));
 }
Exemple #16
0
 public string GetRoutePart(DocumentedProperty property)
 {
     return($"{property.Identity.GetHashCode():X8}".ToLowerInvariant());
 }