Esempio n. 1
0
        public void AddPlatformNode(XmlReader platformReader, string file)
        {
            XmlReader subtree = platformReader.ReadSubtree();

            while (subtree.Read())
            {
                if ((subtree.NodeType == XmlNodeType.Element) && (subtree.Name == "namespace"))
                {
                    string namespaceName = subtree.GetAttribute("name");

                    NamespaceFilter namespaceFilter;
                    if (!namespaceFilters.TryGetValue(namespaceName, out namespaceFilter))
                    {
                        namespaceFilter = new NamespaceFilter(subtree, file);
                    }
                    else
                    {
                        // if the version already has a filter for this namespace, add the data from the current namespace node
                        // unless the namespace node has a different @include value, in which case log a warning
                        string nsIncludeAttr = subtree.GetAttribute("include");
                        bool   nsIncluded    = Convert.ToBoolean(String.IsNullOrEmpty(nsIncludeAttr) ? "true" : nsIncludeAttr,
                                                                 CultureInfo.InvariantCulture);
                        if (nsIncluded != namespaceFilter.Included)
                        {
                            // write warning message about conflicting filters
                            // ISSUE: how to invoke WriteMessage from here
                            Console.Write("");
                        }
                        else
                        {
                            namespaceFilter.AddNamespaceNode(subtree, file);
                        }
                    }
                    namespaceFilters.Remove(namespaceName);
                    namespaceFilters.Add(namespaceName, namespaceFilter);
                }
            }
            subtree.Close();
        }
Esempio n. 2
0
        public void AddPlatformNode(XmlReader platformReader, string file)
        {
            XmlReader subtree = platformReader.ReadSubtree();
            while (subtree.Read())
            {
                if ((subtree.NodeType == XmlNodeType.Element) && (subtree.Name == "namespace"))
                {
                    string namespaceName = subtree.GetAttribute("name");

                    NamespaceFilter namespaceFilter;
                    if (!namespaceFilters.TryGetValue(namespaceName, out namespaceFilter))
                    {
                        namespaceFilter = new NamespaceFilter(subtree, file);
                    }
                    else
                    {
                        // if the version already has a filter for this namespace, add the data from the current namespace node
                        // unless the namespace node has a different @include value, in which case log a warning
                        string nsIncludeAttr = subtree.GetAttribute("include");
                        bool nsIncluded = Convert.ToBoolean(String.IsNullOrEmpty(nsIncludeAttr) ? "true" : nsIncludeAttr,
                            CultureInfo.InvariantCulture);
                        if (nsIncluded != namespaceFilter.Included)
                        {
                            // write warning message about conflicting filters
                            // ISSUE: how to invoke WriteMessage from here
                            Console.Write("");
                        }
                        else
                        {
                            namespaceFilter.AddNamespaceNode(subtree, file);
                        }
                    
                    }
                    namespaceFilters.Remove(namespaceName);
                    namespaceFilters.Add(namespaceName, namespaceFilter);
                }
            }
            subtree.Close();
        }