Example #1
0
        public IAssemblyDecompilationResults GenerateFiles(CancellationToken cancellationToken)
        {
            this.decompilationResults = new Dictionary <uint, Dictionary <uint, IDecompilationResults> >();

            BuildProjectCancellable(cancellationToken);

            ICollection <IModuleDecompilationResults> moduleDecompilationResults = new List <IModuleDecompilationResults>();

            foreach (KeyValuePair <uint, Dictionary <uint, IDecompilationResults> > pair in this.decompilationResults)
            {
                uint moduleToken = pair.Key;
                moduleDecompilationResults.Add(new ModuleDecompilationResults(moduleToken, GetModuleFilePathByToken(moduleToken), pair.Value));
            }

            string assemblyAttributesFilePath = GetAssemblyAttributesFilePath();
            IDecompilationResults assemblyAttributesDecompilationResults = GetAssemblyAttributesDecompilationResults(assemblyAttributesFilePath);

            ProjectGenerationDecompilationCacheService.ClearAssemblyContextsCache();
            this.currentAssemblyResolver.ClearCache();
            this.currentAssemblyResolver.ClearAssemblyFailedResolverCache();

            ICollection <string> resourcesFilePaths = new List <string>();

            foreach (string resourceFilePath in this.resourcesToPathsMap.Values)
            {
                resourcesFilePaths.Add(Path.Combine(this.targetDir, resourceFilePath));
            }

            foreach (string xamlResourceFilePath in this.xamlResourcesToPathsMap.Values)
            {
                resourcesFilePaths.Add(Path.Combine(this.targetDir, xamlResourceFilePath));
            }

            return(new AssemblyDecompilationResults(this.assemblyPath, assemblyAttributesDecompilationResults, moduleDecompilationResults, resourcesFilePaths));
        }
 protected virtual void ClearCaches()
 {
     ProjectGenerationDecompilationCacheService.ClearAssemblyContextsCache();
     this.currentAssemblyResolver.ClearCache();
     this.currentAssemblyResolver.ClearAssemblyFailedResolverCache();
 }