private Type GetControlType2(string tagName, IDictionary attribs, bool fAllowHtmlTags)
        {
            if (this._mappedTags != null)
            {
                Type type = (Type)this._mappedTags[tagName];
                if ((type == null) && this.TryUserControlRegisterDirectives(tagName))
                {
                    type = (Type)this._mappedTags[tagName];
                }
                if (type != null)
                {
                    if (((this._parser != null) && (this._parser._pageParserFilter != null)) && (this._parser._pageParserFilter.GetNoCompileUserControlType() == type))
                    {
                        UserControlRegisterEntry entry = (UserControlRegisterEntry)this._userControlRegisterEntries[tagName];
                        attribs["virtualpath"] = entry.UserControlSource;
                    }
                    return(type);
                }
            }
            int index = tagName.IndexOf(':');

            if (index >= 0)
            {
                if (index == (tagName.Length - 1))
                {
                    return(null);
                }
                string prefix = tagName.Substring(0, index);
                tagName = tagName.Substring(index + 1);
                ITagNameToTypeMapper mapper = null;
                if (this._prefixedMappers != null)
                {
                    mapper = (ITagNameToTypeMapper)this._prefixedMappers[prefix];
                }
                if (((mapper == null) && this.TryNamespaceRegisterDirectives(prefix)) && (this._prefixedMappers != null))
                {
                    mapper = (ITagNameToTypeMapper)this._prefixedMappers[prefix];
                }
                if (mapper == null)
                {
                    return(null);
                }
                return(mapper.GetControlType(tagName, attribs));
            }
            if (fAllowHtmlTags)
            {
                return(this._htmlMapper.GetControlType(tagName, attribs));
            }
            return(null);
        }
Exemplo n.º 2
0
        private /*public*/ Type GetControlType2(string tagName, IDictionary attribs, bool fAllowHtmlTags)
        {
            Type type;

            // First, check it the tag name has been mapped
            if (_mappedTags != null)
            {
                type = (Type)_mappedTags[tagName];

                if (type == null)
                {
                    // Maybe there is a register directive that we haven't yet processed
                    if (TryUserControlRegisterDirectives(tagName))
                    {
                        type = (Type)_mappedTags[tagName];
                    }
                }

                if (type != null)
                {
                    // If this is the special NoCompile UserControl specified by the PageParserFilter, give it the
                    // virtualPath via the attribute bag
                    if (_parser != null && _parser._pageParserFilter != null && _parser._pageParserFilter.GetNoCompileUserControlType() == type)
                    {
                        UserControlRegisterEntry ucRegisterEntry = (UserControlRegisterEntry)_userControlRegisterEntries[tagName];
                        attribs["virtualpath"] = ucRegisterEntry.UserControlSource;
                    }

                    return(type);
                }
            }

            // Check if there is a prefix
            int colonIndex = tagName.IndexOf(':');

            if (colonIndex >= 0)
            {
                // If ends with : don't try to match (88398)
                if (colonIndex == tagName.Length - 1)
                {
                    return(null);
                }

                // If so, parse the prefix and tagname
                string prefix = tagName.Substring(0, colonIndex);
                tagName = tagName.Substring(colonIndex + 1);

                // Look for a mapper for the prefix

                ITagNameToTypeMapper mapper = null;
                if (_prefixedMappers != null)
                {
                    mapper = (ITagNameToTypeMapper)_prefixedMappers[prefix];
                }

                if (mapper == null)
                {
                    // Maybe there is a register directive that we haven't yet processed
                    if (TryNamespaceRegisterDirectives(prefix) && _prefixedMappers != null)
                    {
                        mapper = (ITagNameToTypeMapper)_prefixedMappers[prefix];
                    }
                }

                if (mapper == null)
                {
                    return(null);
                }

                // Try to get the type from the prefix mapper
                return(mapper.GetControlType(tagName, attribs));
            }
            else
            {
                // There is no prefix.
                // Try the Html mapper if allowed
                if (fAllowHtmlTags)
                {
                    return(_htmlMapper.GetControlType(tagName, attribs));
                }
            }

            return(null);
        }