Exemplo n.º 1
0
        public static MemberReference ReadMemberReference(XmlReader reader)
        {
            if (reader == null || reader.NodeType != XmlNodeType.Element)
            {
                return(null);
            }

            switch (reader.Name)
            {
            // For the MemberReference(s)...
            case "SimpleMemberReference":
                SimpleMemberReference simpleMemberReference = new SimpleMemberReference();
                simpleMemberReference.ReadXml(reader);
                return(simpleMemberReference);

            case "SpecializedMemberReference":
                SpecializedMemberReference specializedMemberReference = new SpecializedMemberReference();
                specializedMemberReference.ReadXml(reader);
                return(specializedMemberReference);

            case "SpecializedMemberWithParametersReference":
                SpecializedMemberWithParametersReference specializedMemberWithParametersReference
                    = new SpecializedMemberWithParametersReference();
                specializedMemberWithParametersReference.ReadXml(reader);
                return(specializedMemberWithParametersReference);
            }

            return(null);
        }
Exemplo n.º 2
0
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null || reader.IsEmptyElement)
            {
                return;
            }

            XmlNodeType nodeType = XmlNodeType.None;

            while (reader.Read())
            {
                nodeType = reader.NodeType;

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "SimpleMemberReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        member = new SimpleMemberReference();
                        member.ReadXml(reader);
                    }
                    else if (String.Equals(reader.Name, "SpecializedTypeReference",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        type = new SpecializedTypeReference();
                        type.ReadXml(reader);
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "SpecializedMemberReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public static Reference ReadReference(XmlReader reader)
        {
            if (reader == null || reader.NodeType != XmlNodeType.Element)
            {
                return(null);
            }

            switch (reader.Name)
            {
            case "InvalidReference":
                InvalidReference invalidReference = new InvalidReference();
                invalidReference.ReadXml(reader);
                return(invalidReference);

            case "NamespaceReference":
                NamespaceReference namespaceReference = new NamespaceReference();
                namespaceReference.ReadXml(reader);
                return(namespaceReference);

            case "ExtensionMethodReference":
                ExtensionMethodReference extensionMethodReference = new ExtensionMethodReference();
                extensionMethodReference.ReadXml(reader);
                return(extensionMethodReference);

            // For the MemberReference(s)...
            case "SimpleMemberReference":
                SimpleMemberReference simpleMemberReference = new SimpleMemberReference();
                simpleMemberReference.ReadXml(reader);
                return(simpleMemberReference);

            case "SpecializedMemberReference":
                SpecializedMemberReference specializedMemberReference = new SpecializedMemberReference();
                specializedMemberReference.ReadXml(reader);
                return(specializedMemberReference);

            case "SpecializedMemberWithParametersReference":
                SpecializedMemberWithParametersReference specializedMemberWithParametersReference
                    = new SpecializedMemberWithParametersReference();
                specializedMemberWithParametersReference.ReadXml(reader);
                return(specializedMemberWithParametersReference);

            // For the TypeReference(s)...
            case "SimpleTypeReference":
                SimpleTypeReference simpleTypeReference = new SimpleTypeReference();
                simpleTypeReference.ReadXml(reader);
                return(simpleTypeReference);

            case "SpecializedTypeReference":
                SpecializedTypeReference specializedTypeReference = new SpecializedTypeReference();
                specializedTypeReference.ReadXml(reader);
                return(specializedTypeReference);

            case "ArrayTypeReference":
                ArrayTypeReference arrayTypeReference = new ArrayTypeReference();
                arrayTypeReference.ReadXml(reader);
                return(arrayTypeReference);

            case "ReferenceTypeReference":
                ReferenceTypeReference referenceTypeReference = new ReferenceTypeReference();
                referenceTypeReference.ReadXml(reader);
                return(referenceTypeReference);

            case "PointerTypeReference":
                PointerTypeReference pointerTypeReference = new PointerTypeReference();
                pointerTypeReference.ReadXml(reader);
                return(pointerTypeReference);

            // For the TemplateTypeReference(s)...
            case "IndexedTemplateTypeReference":
                IndexedTemplateTypeReference indexedTemplateTypeReference =
                    new IndexedTemplateTypeReference();
                indexedTemplateTypeReference.ReadXml(reader);
                return(indexedTemplateTypeReference);

            case "NamedTemplateTypeReference":
                NamedTemplateTypeReference namedTemplateTypeReference = new NamedTemplateTypeReference();
                namedTemplateTypeReference.ReadXml(reader);
                return(namedTemplateTypeReference);

            case "TypeTemplateTypeReference":
                TypeTemplateTypeReference typeTemplateTypeReference = new TypeTemplateTypeReference();
                typeTemplateTypeReference.ReadXml(reader);
                return(typeTemplateTypeReference);

            case "MethodTemplateTypeReference":
                MethodTemplateTypeReference methodTemplateTypeReference = new MethodTemplateTypeReference();
                methodTemplateTypeReference.ReadXml(reader);
                return(methodTemplateTypeReference);
            }

            return(null);
        }