예제 #1
0
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (reader.Name.EndsWith("TypeReference",
                                             StringComparison.OrdinalIgnoreCase))
                    {
                        pointedToType = ReferencesReader.ReadTypeReference(reader);
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "PointerTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
예제 #2
0
        public static Reference Read(string referenceText)
        {
            if (String.IsNullOrEmpty(referenceText))
            {
                return(null);
            }
            if (_settings == null)
            {
                _settings = new XmlReaderSettings();
                _settings.ConformanceLevel = ConformanceLevel.Fragment;
            }

            Reference reference = null;

            StringReader textReader = new StringReader(referenceText);

            using (XmlReader reader = XmlReader.Create(textReader, _settings))
            {
                reader.MoveToContent();
                Debug.Assert(reader.NodeType == XmlNodeType.Element);
                reference = ReferencesReader.ReadReference(reader);
            }

            return(reference);
        }
예제 #3
0
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            if (String.Equals(reader.Name, "MethodTemplateTypeReference",
                              StringComparison.OrdinalIgnoreCase))
            {
                string tempText = reader.GetAttribute("position");
                if (!String.IsNullOrEmpty(tempText))
                {
                    position = Int32.Parse(tempText);
                }
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "MethodTemplateTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        string tempText = reader.GetAttribute("position");
                        if (!String.IsNullOrEmpty(tempText))
                        {
                            position = Int32.Parse(tempText);
                        }
                    }
                    else if (reader.Name.IndexOf("Member", 0, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        template = ReferencesReader.ReadMemberReference(reader);
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "MethodTemplateTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
예제 #4
0
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            bool readContent = false;

            if (String.Equals(reader.Name, "ArrayTypeReference",
                              StringComparison.OrdinalIgnoreCase))
            {
                string tempText = reader.GetAttribute("rank");
                if (!String.IsNullOrEmpty(tempText))
                {
                    rank = Int32.Parse(tempText);
                }

                readContent = true;
            }

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "ArrayTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        if (readContent)
                        {
                            // It must be a nested ArrayTypeReference type...
                            elementType = ReferencesReader.ReadTypeReference(reader);
                        }
                        else
                        {
                            string tempText = reader.GetAttribute("rank");
                            if (!String.IsNullOrEmpty(tempText))
                            {
                                rank = Int32.Parse(tempText);
                            }
                            readContent = true;
                        }
                    }
                    else if (reader.Name.EndsWith("TypeReference",
                                                  StringComparison.OrdinalIgnoreCase))
                    {
                        elementType = ReferencesReader.ReadTypeReference(reader);
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "ArrayTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            if (String.Equals(reader.Name, "ExtensionMethodReference",
                              StringComparison.OrdinalIgnoreCase))
            {
                methodName = reader.GetAttribute("methodName");
            }

            parameters   = new List <Parameter>();
            templateArgs = new List <TypeReference>();

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "ExtensionMethodReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        methodName = reader.GetAttribute("methodName");
                    }
                    else if (String.Equals(reader.Name, "Parameters",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        while (reader.Read())
                        {
                            nodeType = reader.NodeType;

                            if (nodeType == XmlNodeType.Element)
                            {
                                if (String.Equals(reader.Name, "Parameter",
                                                  StringComparison.OrdinalIgnoreCase))
                                {
                                    Parameter parameter = new Parameter();
                                    parameter.ReadXml(reader);

                                    parameters.Add(parameter);
                                }
                            }
                            else if (nodeType == XmlNodeType.EndElement)
                            {
                                if (String.Equals(reader.Name, "Parameters",
                                                  StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else if (String.Equals(reader.Name, "TemplateArgs",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        while (reader.Read())
                        {
                            nodeType = reader.NodeType;

                            if (nodeType == XmlNodeType.Element)
                            {
                                if (reader.Name.EndsWith("TypeReference",
                                                         StringComparison.OrdinalIgnoreCase))
                                {
                                    TypeReference typeRef = ReferencesReader.ReadTypeReference(reader);
                                    if (typeRef != null)
                                    {
                                        templateArgs.Add(typeRef);
                                    }
                                }
                            }
                            else if (nodeType == XmlNodeType.EndElement)
                            {
                                if (String.Equals(reader.Name, "TemplateArgs",
                                                  StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "ExtensionMethodReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
        public override void ReadXml(XmlReader reader)
        {
            if (reader == null)
            {
                return;
            }

            if (String.Equals(reader.Name, "SpecializedMemberWithParametersReference",
                              StringComparison.OrdinalIgnoreCase))
            {
                prefix = reader.GetAttribute("prefix");
                member = reader.GetAttribute("member");
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            parameters = new List <TypeReference>();

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "SpecializedMemberWithParametersReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        prefix = reader.GetAttribute("prefix");
                        member = reader.GetAttribute("member");
                    }
                    else if (String.Equals(reader.Name, "SpecializedTypeReference",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        type = new SpecializedTypeReference();
                        type.ReadXml(reader);
                    }
                    else if (String.Equals(reader.Name, "Parameters",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        while (reader.Read())
                        {
                            nodeType = reader.NodeType;

                            if (nodeType == XmlNodeType.Element)
                            {
                                if (reader.Name.EndsWith("TypeReference",
                                                         StringComparison.OrdinalIgnoreCase))
                                {
                                    TypeReference typeRef = ReferencesReader.ReadTypeReference(reader);
                                    if (typeRef != null)
                                    {
                                        parameters.Add(typeRef);
                                    }
                                }
                            }
                            else if (nodeType == XmlNodeType.EndElement)
                            {
                                if (String.Equals(reader.Name, "Parameters",
                                                  StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "SpecializedMemberWithParametersReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
예제 #7
0
        public void ReadXml(XmlReader reader)
        {
            if (reader == null || reader.IsEmptyElement)
            {
                return;
            }

            arguments = new List <TypeReference>();

            XmlNodeType nodeType = XmlNodeType.None;

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

                if (nodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "SimpleTypeReference",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        template = new SimpleTypeReference();
                        template.ReadXml(reader);
                    }
                    else if (String.Equals(reader.Name, "Arguments",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        while (reader.Read())
                        {
                            nodeType = reader.NodeType;

                            if (nodeType == XmlNodeType.Element)
                            {
                                if (reader.Name.EndsWith("TypeReference",
                                                         StringComparison.OrdinalIgnoreCase))
                                {
                                    TypeReference typeRef = ReferencesReader.ReadTypeReference(reader);
                                    if (typeRef != null)
                                    {
                                        arguments.Add(typeRef);
                                    }
                                }
                            }
                            else if (nodeType == XmlNodeType.EndElement)
                            {
                                if (String.Equals(reader.Name, "Arguments",
                                                  StringComparison.OrdinalIgnoreCase))
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (nodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, "Specialization",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }