public override IEnumerable <NamespaceDeclaration> GetNamespacePrefixes()
        {
            XamlParserFrame  frame = _stack.CurrentFrame;
            HashSet <string> keys  = new HashSet <string>();

            while (frame.Depth > 0)
            {
                if (frame._namespaces != null)
                {
                    foreach (NamespaceDeclaration namespaceDeclaration in frame.GetNamespacePrefixes())
                    {
                        if (keys.Add(namespaceDeclaration.Prefix))
                        {
                            yield return(namespaceDeclaration);
                        }
                    }
                }
                frame = (XamlParserFrame)frame.Previous;
            }

            if (_prescopeNamespaces != null)
            {
                foreach (KeyValuePair <string, string> kvp in _prescopeNamespaces)
                {
                    if (keys.Add(kvp.Key))
                    {
                        yield return(new NamespaceDeclaration(kvp.Value, kvp.Key));
                    }
                }
            }
        }
Exemple #2
0
        public override IEnumerable <NamespaceDeclaration> GetNamespacePrefixes()
        {
            XamlParserFrame             currentFrame      = this._stack.CurrentFrame;
            Dictionary <string, string> iteratorVariable1 = new Dictionary <string, string>();

            while (currentFrame.Depth > 0)
            {
                if (currentFrame._namespaces != null)
                {
                    foreach (NamespaceDeclaration iteratorVariable2 in currentFrame.GetNamespacePrefixes())
                    {
                        if (iteratorVariable1.ContainsKey(iteratorVariable2.Prefix))
                        {
                            continue;
                        }
                        iteratorVariable1.Add(iteratorVariable2.Prefix, null);
                        yield return(iteratorVariable2);
                    }
                }
                currentFrame = (XamlParserFrame)currentFrame.Previous;
            }
            if (this._prescopeNamespaces != null)
            {
                foreach (KeyValuePair <string, string> iteratorVariable3 in this._prescopeNamespaces)
                {
                    if (iteratorVariable1.ContainsKey(iteratorVariable3.Key))
                    {
                        continue;
                    }
                    iteratorVariable1.Add(iteratorVariable3.Key, null);
                    yield return(new NamespaceDeclaration(iteratorVariable3.Value, iteratorVariable3.Key));
                }
            }
        }
Exemple #3
0
        public string FindNamespaceByPrefixInParseStack(string prefix)
        {
            string str;

            if ((this._prescopeNamespaces != null) && this._prescopeNamespaces.TryGetValue(prefix, out str))
            {
                return(str);
            }
            for (XamlParserFrame frame = this._stack.CurrentFrame; frame.Depth > 0; frame = (XamlParserFrame)frame.Previous)
            {
                if (frame.TryGetNamespaceByPrefix(prefix, out str))
                {
                    return(str);
                }
            }
            return(null);
        }
        public string FindNamespaceByPrefixInParseStack(String prefix)
        {
            string xamlNs;

            if (null != _prescopeNamespaces)
            {
                if (_prescopeNamespaces.TryGetValue(prefix, out xamlNs))
                {
                    return(xamlNs);
                }
            }

            XamlParserFrame frame = _stack.CurrentFrame;

            while (frame.Depth > 0)
            {
                if (frame.TryGetNamespaceByPrefix(prefix, out xamlNs))
                {
                    return(xamlNs);
                }
                frame = (XamlParserFrame)frame.Previous;
            }
            return(null);
        }