Exemplo n.º 1
0
 internal void PostSourceCodeGeneration()
 {
     _typeName         = _compiler.GetTypeName();
     _fileDependencies = _templateParser.SourceDependencies;
     _compiler         = null;
     _templateParser   = null;
 }
Exemplo n.º 2
0
        static CodeExpression CreateGetLocalResourceObject(Type member_type, Type declaringType, string memberName, string resname)
        {
            TypeConverter converter;

            if (!String.IsNullOrEmpty(memberName))
            {
                converter = TypeDescriptor.GetProperties(declaringType) [memberName].Converter;
            }
            else
            {
                converter = null;
            }

            if (member_type != typeof(System.Drawing.Color) &&
                (converter == null || converter.CanConvertFrom(typeof(String))))
            {
                CodeMethodInvokeExpression getlro = new CodeMethodInvokeExpression(
                    new CodeThisReferenceExpression(),
                    "GetLocalResourceObject",
                    new CodeExpression [] { new CodePrimitiveExpression(resname) });

                return(TemplateControlCompiler.CreateConvertToCall(Type.GetTypeCode(member_type), getlro));
            }
            else if (!String.IsNullOrEmpty(memberName))
            {
                CodeMethodInvokeExpression getlro = new CodeMethodInvokeExpression(
                    new CodeThisReferenceExpression(),
                    "GetLocalResourceObject",
                    new CodeExpression []
                {
                    new CodePrimitiveExpression(resname),
                    new CodeTypeOfExpression(new CodeTypeReference(declaringType)),
                    new CodePrimitiveExpression(memberName)
                }
                    );

                return(new CodeCastExpression(member_type, getlro));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        /*
         * Do all of the language-independent work
         */
        internal void Precompile()
        {
            _templateParser.Parse();

            _compilerInfo         = _templateParser.CompilerInfo;
            _pageFilename         = _templateParser.InputFile;
            _assemblyDependencies = _templateParser.AssemblyDependencies;

            // Set the file dependencies in the templateParser
            string[] sourceDependencies = new string[_templateParser.SourceDependencies.Count];
            _templateParser.SourceDependencies.Keys.CopyTo(sourceDependencies, 0);
            _templateParser._fileDependencies = sourceDependencies;

            if (_fUserControl)
            {
                _compiler = new UserControlCompiler((UserControlParser)_templateParser);
            }
            else
            {
                _compiler = new PageCompiler((PageParser)_templateParser);
            }
        }