// Create a PageParserFilter and initialize it
    internal static PageParserFilter Create(PagesSection pagesConfig, VirtualPath virtualPath, TemplateParser parser) {
        PageParserFilter pageParserFilter = pagesConfig.CreateControlTypeFilter();
        if (pageParserFilter != null)
            pageParserFilter.InitializeInternal(virtualPath, parser);

        return pageParserFilter;
    }
        void AddControl(PagesSection section, SettingsMappingWhatContents how)
        {
            Dictionary <string, string> attrs = how.Attributes;
            if (attrs == null || attrs.Count == 0)
                return;

            string tagPrefix, nameSpace, asm, tagName, source;
            if (!attrs.TryGetValue ("tagPrefix", out tagPrefix))
                tagPrefix = String.Empty;
            if (!attrs.TryGetValue ("namespace", out nameSpace))
                nameSpace = String.Empty;
            if (!attrs.TryGetValue ("assembly", out asm))
                asm = String.Empty;
            if (!attrs.TryGetValue ("tagName", out tagName))
                tagName = String.Empty;
            if (!attrs.TryGetValue ("src", out source))
                source = String.Empty;

            TagPrefixInfo info = new TagPrefixInfo (tagPrefix, nameSpace, asm, tagName, source);
            section.Controls.Add (info);
        }
Example #3
0
    /*
     * Do some initialization before the parsing
     */
    internal virtual void PrepareParse() {
        if (_circularReferenceChecker == null)
            _circularReferenceChecker = new CaseInsensitiveStringSet();

        _baseType = DefaultBaseType;

        // Initialize the main directive
        _mainDirectiveConfigSettings = CreateEmptyAttributeBag();

        // Get the config sections we care about
        if (!FInDesigner) {
            _compConfig = MTConfigUtil.GetCompilationConfig(CurrentVirtualPath);
            _pagesConfig = MTConfigUtil.GetPagesConfig(CurrentVirtualPath);
        }

        // Get default settings from config
        ProcessConfigSettings();

        // Initialize the type mapper
        // This must follow processing of config, so it can use the results
        _typeMapper = new MainTagNameToTypeMapper(this as BaseTemplateParser);

        // Register the <object> tag
        _typeMapper.RegisterTag("object", typeof(System.Web.UI.ObjectTag));

        _sourceDependencies = new CaseInsensitiveStringSet();

        // Create and seed the stack of ID lists.
        _idListStack = new Stack();
        _idList = new CaseInsensitiveStringSet();

        _scriptList = new ArrayList();

        // Optionally collect additional parse data for render tracing
        InitializeParseRecorders();
    }
		public static AspNet_Page map_PagesConfig(this AspNet_Page aspNetPage, PagesSection pagesSection)
		{
			aspNetPage.PagesConfig = pagesSection.property_Values_AsStrings();
			return aspNetPage;

		}
    internal static long GetRecompilationHash(PagesSection ps)
    {
        HashCodeCombiner recompilationHash = new HashCodeCombiner();
        NamespaceCollection namespaces;
        TagPrefixCollection controls;
        TagMapCollection tagMapping;

        // Combine items from Pages section
        recompilationHash.AddObject(ps.Buffer);
        recompilationHash.AddObject(ps.EnableViewState);
        recompilationHash.AddObject(ps.EnableViewStateMac);
        recompilationHash.AddObject(ps.EnableEventValidation);
        recompilationHash.AddObject(ps.SmartNavigation);
        recompilationHash.AddObject(ps.ValidateRequest);
        recompilationHash.AddObject(ps.AutoEventWireup);
        if (ps.PageBaseTypeInternal != null) {
            recompilationHash.AddObject(ps.PageBaseTypeInternal.FullName);
        }
        if (ps.UserControlBaseTypeInternal != null) {
            recompilationHash.AddObject(ps.UserControlBaseTypeInternal.FullName);
        }
        if (ps.PageParserFilterTypeInternal != null) {
            recompilationHash.AddObject(ps.PageParserFilterTypeInternal.FullName);
        }
        recompilationHash.AddObject(ps.MasterPageFile);
        recompilationHash.AddObject(ps.Theme);
        recompilationHash.AddObject(ps.StyleSheetTheme);
        recompilationHash.AddObject(ps.EnableSessionState);
        recompilationHash.AddObject(ps.CompilationMode);
        recompilationHash.AddObject(ps.MaxPageStateFieldLength);
        recompilationHash.AddObject(ps.ViewStateEncryptionMode);
        recompilationHash.AddObject(ps.MaintainScrollPositionOnPostBack);

        // Combine items from Namespaces collection
        namespaces = ps.Namespaces;

        recompilationHash.AddObject(namespaces.AutoImportVBNamespace);
        if (namespaces.Count == 0) {
            recompilationHash.AddObject("__clearnamespaces");
        }
        else {
            foreach (NamespaceInfo ni in namespaces) {
                recompilationHash.AddObject(ni.Namespace);
            }
        }

        // Combine items from the Controls collection
        controls = ps.Controls;

        if (controls.Count == 0) {
            recompilationHash.AddObject("__clearcontrols");
        }
        else {
            foreach (TagPrefixInfo tpi in controls) {
                recompilationHash.AddObject(tpi.TagPrefix);

                if (tpi.TagName != null && tpi.TagName.Length != 0) {
                    recompilationHash.AddObject(tpi.TagName);
                    recompilationHash.AddObject(tpi.Source);
                }
                else {
                    recompilationHash.AddObject(tpi.Namespace);
                    recompilationHash.AddObject(tpi.Assembly);
                }
            }
        }

        // Combine items from the TagMapping Collection
        tagMapping = ps.TagMapping;

        if (tagMapping.Count == 0) {
            recompilationHash.AddObject("__cleartagmapping");
        }
        else {
            foreach (TagMapInfo tmi in tagMapping) {
                recompilationHash.AddObject(tmi.TagType);
                recompilationHash.AddObject(tmi.MappedTagType);
            }
        }

        return recompilationHash.CombinedHash;
    }
 internal void Init(VirtualPath virtualPath)
 {
     base.CurrentVirtualPath = virtualPath;
     this._virtualPath = virtualPath;
     this._pagesConfig = MTConfigUtil.GetPagesConfig(virtualPath);
 }
 internal static long GetRecompilationHash(PagesSection ps)
 {
     HashCodeCombiner combiner = new HashCodeCombiner();
     combiner.AddObject(ps.Buffer);
     combiner.AddObject(ps.EnableViewState);
     combiner.AddObject(ps.EnableViewStateMac);
     combiner.AddObject(ps.EnableEventValidation);
     combiner.AddObject(ps.SmartNavigation);
     combiner.AddObject(ps.ValidateRequest);
     combiner.AddObject(ps.AutoEventWireup);
     if (ps.PageBaseTypeInternal != null)
     {
         combiner.AddObject(ps.PageBaseTypeInternal.FullName);
     }
     if (ps.UserControlBaseTypeInternal != null)
     {
         combiner.AddObject(ps.UserControlBaseTypeInternal.FullName);
     }
     if (ps.PageParserFilterTypeInternal != null)
     {
         combiner.AddObject(ps.PageParserFilterTypeInternal.FullName);
     }
     combiner.AddObject(ps.MasterPageFile);
     combiner.AddObject(ps.Theme);
     combiner.AddObject(ps.StyleSheetTheme);
     combiner.AddObject(ps.EnableSessionState);
     combiner.AddObject(ps.CompilationMode);
     combiner.AddObject(ps.MaxPageStateFieldLength);
     combiner.AddObject(ps.ViewStateEncryptionMode);
     combiner.AddObject(ps.MaintainScrollPositionOnPostBack);
     NamespaceCollection namespaces = ps.Namespaces;
     combiner.AddObject(namespaces.AutoImportVBNamespace);
     if (namespaces.Count == 0)
     {
         combiner.AddObject("__clearnamespaces");
     }
     else
     {
         foreach (NamespaceInfo info in namespaces)
         {
             combiner.AddObject(info.Namespace);
         }
     }
     TagPrefixCollection controls = ps.Controls;
     if (controls.Count == 0)
     {
         combiner.AddObject("__clearcontrols");
     }
     else
     {
         foreach (TagPrefixInfo info2 in controls)
         {
             combiner.AddObject(info2.TagPrefix);
             if ((info2.TagName != null) && (info2.TagName.Length != 0))
             {
                 combiner.AddObject(info2.TagName);
                 combiner.AddObject(info2.Source);
             }
             else
             {
                 combiner.AddObject(info2.Namespace);
                 combiner.AddObject(info2.Assembly);
             }
         }
     }
     TagMapCollection tagMapping = ps.TagMapping;
     if (tagMapping.Count == 0)
     {
         combiner.AddObject("__cleartagmapping");
     }
     else
     {
         foreach (TagMapInfo info3 in tagMapping)
         {
             combiner.AddObject(info3.TagType);
             combiner.AddObject(info3.MappedTagType);
         }
     }
     return combiner.CombinedHash;
 }
 internal void Init(VirtualPath virtualPath) {
     CurrentVirtualPath = virtualPath;
     _virtualPath = virtualPath;
     _pagesConfig = MTConfigUtil.GetPagesConfig(virtualPath);
 }
 void ProcessClear(string val, PagesSection section, SettingsMappingWhatContents how)
 {
     if (val == "controls")
         section.Controls.Clear ();
     else if (val == "tagMapping")
         section.TagMapping.Clear ();
 }
 void ProcessAdd(string val, PagesSection section, SettingsMappingWhatContents how)
 {
     if (val == "controls")
         AddControl (section, how);
 }