// // Save the local reference related information from MarkupCompilePass1 task to cache file. // internal bool SaveCacheInformation(MarkupCompilePass1 mcPass1) { Debug.Assert(String.IsNullOrEmpty(_localCacheFile) != true, "_localCacheFile must not be empty."); Debug.Assert(mcPass1 != null, "A valid instance of MarkupCompilePass1 must be passed to method SaveCacheInformation."); bool bSuccess = false; // Transfer the cache related information from mcPass1 to this instance. LocalApplicationFile = mcPass1.LocalApplicationFile; LocalMarkupPages = mcPass1.LocalMarkupPages; // Save the cache information to the cache file. MemoryStream memStream = new MemoryStream(); // using Disposes the StreamWriter when it ends. Disposing the StreamWriter // also closes the underlying MemoryStream. Furthermore, don't add BOM here // since TaskFileService.WriteFile adds it. using (StreamWriter sw = new StreamWriter(memStream, new UTF8Encoding(false))) { // Write InternalTypeHelperFile only when Pass1 asks Pass2 to do further check. if (mcPass1.FurtherCheckInternalTypeHelper) { sw.WriteLine(mcPass1.InternalTypeHelperFile); } else { sw.WriteLine(String.Empty); } // Write the ApplicationFile for Pass2 compilation. if (LocalApplicationFile == null) { sw.WriteLine(String.Empty); } else { sw.WriteLine(LocalApplicationFile.Serialize()); } if (LocalMarkupPages != null && LocalMarkupPages.Length > 0) { for (int i = 0; i < LocalMarkupPages.Length; i++) { sw.WriteLine(LocalMarkupPages[i].Serialize( )); } } sw.Flush(); _taskFileService.WriteFile(memStream.ToArray(), _localCacheFile); bSuccess = true; } return bSuccess; }
// <summary> // ctor of IncrementalCompileAnalyzer // </summary> internal IncrementalCompileAnalyzer(MarkupCompilePass1 mcPass1) { _mcPass1 = mcPass1; _analyzeResult = RecompileCategory.NoRecompile; }
internal bool SaveStateInformation(MarkupCompilePass1 mcPass1) { Debug.Assert(String.IsNullOrEmpty(_stateFilePath) != true, "StateFilePath must not be empty."); Debug.Assert(mcPass1 != null, "A valid instance of MarkupCompilePass1 must be passed to method SaveCacheInformation."); Debug.Assert(_cacheInfoList.Length == (int)CompilerStateType.MaxCount, "The Cache string array should be already allocated."); // Transfer the cache related information from mcPass1 to this instance. AssemblyName = mcPass1.AssemblyName; AssemblyVersion = mcPass1.AssemblyVersion; AssemblyPublicKeyToken = mcPass1.AssemblyPublicKeyToken; OutputType = mcPass1.OutputType; Language = mcPass1.Language; LanguageSourceExtension = mcPass1.LanguageSourceExtension; OutputPath = mcPass1.OutputPath; RootNamespace = mcPass1.RootNamespace; LocalizationDirectivesToLocFile = mcPass1.LocalizationDirectivesToLocFile; HostInBrowser = mcPass1.HostInBrowser; DefineConstants = mcPass1.DefineConstants; ApplicationFile = mcPass1.ApplicationFile; PageMarkup = mcPass1.PageMarkupCache; ContentFiles = mcPass1.ContentFilesCache; SourceCodeFiles = mcPass1.SourceCodeFilesCache; References = mcPass1.ReferencesCache; PageMarkupFileNames = GenerateStringFromFileNames(mcPass1.PageMarkup); SplashImage = mcPass1.SplashImageName; Pass2Required = (mcPass1.RequirePass2ForMainAssembly || mcPass1.RequirePass2ForSatelliteAssembly); return SaveStateInformation(); }