Ejemplo n.º 1
0
        private void WriteSimpleMember(SimpleMemberReference member, DisplayOptions options, XmlWriter writer, Dictionary <IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            MemberTarget target = targets[member.Id] as MemberTarget;

            if (target != null)
            {
                WriteMemberTarget(target, options, writer, dictionary);
            }
            else
            {
                TextReferenceUtilities.WriteSimpleMemberReference(member, options, writer, this);
            }
        }
Ejemplo n.º 2
0
        private void WriteSimpleType(SimpleTypeReference simple, DisplayOptions options, bool showOuterType, XmlWriter writer)
        {
            TypeTarget type = targets[simple.Id] as TypeTarget;

            if (type != null)
            {
                WriteTypeTarget(type, options, showOuterType, writer);
            }
            else
            {
                TextReferenceUtilities.WriteSimpleTypeReference(simple, options, writer);
            }
        }
        private static EnumerationTarget CreateEnumerationTarget(XPathNavigator api)
        {
            string typeId = (string)api.Evaluate(topicIdExpression);
            string file   = (string)api.Evaluate(topicFileExpression);

            // Create target
            List <MemberTarget> members      = new List <MemberTarget>();
            XPathNodeIterator   elementNodes = api.Select("elements/element");

            foreach (XPathNavigator elementNode in elementNodes)
            {
                string memberId = elementNode.GetAttribute("api", String.Empty);

                // Try to get name from attribute on element node
                string memberName = elementNode.GetAttribute("name", String.Empty);

                if (String.IsNullOrEmpty(memberName))
                {
                    // If we can't do that, try to get the name by searching the file for the <api> element of
                    // that member.
                    XPathNavigator memberApi = api.SelectSingleNode(String.Format(CultureInfo.InvariantCulture,
                                                                                  "following-sibling::api[@id='{0}']", memberId));

                    if (memberApi != null)
                    {
                        memberName = (string)memberApi.Evaluate(apiNameExpression);
                    }
                    else
                    {
                        // If all else fails, get the name by parsing the identifier
                        string arguments;
                        string type;

                        TextReferenceUtilities.DecomposeMemberIdentifier(memberId, out type, out memberName,
                                                                         out arguments);
                    }
                }

                MemberTarget member = new MemberTarget();

                member.Id             = memberId;                        // Get Id from element
                member.File           = file;                            // Get file from type file
                member.Name           = memberName;                      // Get name from element
                member.ContainingType = new SimpleTypeReference(typeId); // Get containing type from this type
                members.Add(member);
            }

            return(new EnumerationTarget(members));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Write out a namespace reference
        /// </summary>
        /// <param name="spaceReference">The namespace reference information</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteNamespace(NamespaceReference spaceReference, XmlWriter writer)
        {
            if (spaceReference == null)
            {
                throw new ArgumentNullException("spaceReference");
            }

            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            NamespaceTarget spaceTarget = targets[spaceReference.Id] as NamespaceTarget;

            if (spaceTarget != null)
            {
                WriteNamespaceTarget(spaceTarget, writer);
            }
            else
            {
                TextReferenceUtilities.WriteNamespaceReference(spaceReference, writer);
            }
        }