コード例 #1
0
ファイル: CompilerWrapper.cs プロジェクト: minsys/wpf
        // <summary>
        // Start the compilation.
        // </summary>
        // <param name="assemblyName"></param>
        // <param name="language"></param>
        // <param name="rootNamespace"></param>
        // <param name="fileList"></param>
        // <param name="isSecondPass"></param>
        // <returns></returns>
        internal bool DoCompilation(string assemblyName, string language, string rootNamespace, FileUnit[] fileList, bool isSecondPass)
        {
            bool ret = true;

            CompilationUnit compUnit = new CompilationUnit(assemblyName, language, rootNamespace, fileList);

            compUnit.Pass2 = isSecondPass;

            // Set some properties required by the CompilationUnit
            compUnit.ApplicationFile = _applicationMarkup;
            compUnit.SourcePath      = _sourceDir;

            //Set the properties required by MarkupCompiler

            _mc.SourceFileResolve += new SourceFileResolveEventHandler(OnSourceFileResolve);
            _mc.Error             += new MarkupErrorEventHandler(OnCompilerError);

            LocalizationDirectivesToLocFile localizeFlag = (LocalizationDirectivesToLocFile)_localizationDirectivesToLocFile;


            //
            // Localization file should not be generated for Intellisense build. Thus
            // checking IsRealBuild.
            //
            if ((localizeFlag == MS.Internal.LocalizationDirectivesToLocFile.All ||
                 localizeFlag == MS.Internal.LocalizationDirectivesToLocFile.CommentsOnly) &&
                (TaskFileService.IsRealBuild))
            {
                _mc.ParserHooks = new LocalizationParserHooks(_mc, localizeFlag, isSecondPass);
            }

            if (isSecondPass)
            {
                for (int i = 0; i < _mc.ReferenceAssemblyList.Count; i++)
                {
                    ReferenceAssembly asmReference = _mc.ReferenceAssemblyList[i] as ReferenceAssembly;

                    if (asmReference != null)
                    {
                        if (String.Compare(asmReference.AssemblyName, assemblyName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            // Set the local assembly file to markupCompiler
                            _mc.LocalAssemblyFile = asmReference;
                        }
                    }
                }
            }

            // finally compile the app
            _mc.Compile(compUnit);

            return(ret);
        }
コード例 #2
0
        internal LocalizationParserHooks(
            MarkupCompiler                  compiler ,
            LocalizationDirectivesToLocFile directivesToFile,
            bool                            isSecondPass
            )
        {               
            _compiler = compiler;            
            _directivesToFile = directivesToFile;  
            _isSecondPass = isSecondPass;

            // The arrray list holds all the comments collected while parsing Xaml.
            _commentList = new ArrayList();

            // It is the comments current being processed.
            _currentComment = new LocalizationComment();       
        }
コード例 #3
0
        internal LocalizationParserHooks(
            MarkupCompiler compiler,
            LocalizationDirectivesToLocFile directivesToFile,
            bool isSecondPass
            )
        {
            _compiler         = compiler;
            _directivesToFile = directivesToFile;
            _isSecondPass     = isSecondPass;

            // The arrray list holds all the comments collected while parsing Xaml.
            _commentList = new ArrayList();

            // It is the comments current being processed.
            _currentComment = new LocalizationComment();
        }