Exemplo n.º 1
0
 public override bool ProcessCodeConstruct(CodeConstructType codeType, string code)
 {
     if (codeType == CodeConstructType.ScriptTag)
     {
         throw new InvalidOperationException("Say NO to server script blocks!");
     }
     return base.ProcessCodeConstruct(codeType, code);
 }
Exemplo n.º 2
0
        public override bool ProcessCodeConstruct(CodeConstructType codeType, string code) {
            if (!_viewTypeControlAdded &&
                _viewBaseType != null &&
                _directiveType == DirectiveType.Master) {

                // If we're dealing with a master page that needs to have its base type set, do it here.
                // It's done by adding the ViewType control, which has a builder that sets the base type.

                // The code currently assumes that the file in question contains a code snippet, since
                // that's the item we key off of in order to know when to add the ViewType control.

                Hashtable attribs = new Hashtable();
                attribs["typename"] = _viewBaseType;
                AddControl(typeof(ViewType), attribs);
                _viewTypeControlAdded = true;
            }

            return base.ProcessCodeConstruct(codeType, code);
        }
 public override bool ProcessCodeConstruct(CodeConstructType codeType, string code)
 {
     return false;
 }
Exemplo n.º 4
0
    private bool PageParserFilterProcessedCodeBlock(CodeConstructType codeConstructType,
        string code, int lineNumber) {

        // This requires a PageParserFilter, and CompilationMode must allow it
        if (_pageParserFilter == null || CompilationMode == CompilationMode.Never)
            return false;

        // Temporarily adjust the line number to match what's passed in.  This makes it correctly
        // point to the begining of <script> blocks rather than the end
        int restoreLineNumber = _lineNumber;
        _lineNumber = lineNumber;
        try {
            // Ask the PageParserFilter whether it wants to process it
            return _pageParserFilter.ProcessCodeConstruct(codeConstructType, code);
        }
        finally {
            _lineNumber = restoreLineNumber;
        }
    }
Exemplo n.º 5
0
		public virtual bool ProcessCodeConstruct (CodeConstructType codeType, string code)
		{
			return false;
		}
 public override bool ProcessCodeConstruct(CodeConstructType codeType, string code)
 {
     if (codeType == CodeConstructType.ExpressionSnippet && !_viewTypeControlAdded 
         && _viewBaseType != null && _directiveType == DirectiveType.Master)
     {
         Hashtable attributes = new Hashtable();
         attributes["typename"] = _viewBaseType;
         base.AddControl(typeof(ViewType), attributes);
         this._viewTypeControlAdded = true;
     }
     return base.ProcessCodeConstruct(codeType, code);
 }
        public override bool ProcessCodeConstruct(CodeConstructType codeType, string code) {

            // Only do our special handling when dealing with a script page
            if (!_isScriptPage)
                return base.ProcessCodeConstruct(codeType, code);

            Type controlType = null;
            Hashtable attributes = new Hashtable();

            attributes["Code"] = code;
            attributes["Line"] = Line;

            switch (codeType) {
                case CodeConstructType.CodeSnippet:
                    controlType = typeof(SnippetControl);
                    break;
                case CodeConstructType.ExpressionSnippet:
                    controlType = typeof(ExpressionSnippetControl);
                    break;
                case CodeConstructType.DataBindingSnippet:
                    controlType = typeof(DataBindingIslandControl);
                    break;
                case CodeConstructType.ScriptTag:
                    if (_script != null) {
                        throw new Exception("The page should not contain more than one <script runat='server' tag");
                    }

                    _script = code;
                    _scriptLine = Line;
                    return true;
                default:
                    return false;
            }

            Debug.Assert(controlType != null);
            AddControl(controlType, attributes);

            return true;
        }
 public virtual new bool ProcessCodeConstruct(CodeConstructType codeType, string code)
 {
   return default(bool);
 }