public WinRTProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
     IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
     IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
     ProjectGenerationSettings projectGenerationSettings = null)
     : base(assemblyPath, targetPath, language, null, preferences, notifier, assemblyInfoService, visualStudioVersion, projectGenerationSettings)
 {
     Initialize();
 }
Exemple #2
0
 public WinRTProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
                            IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
                            IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
                            ProjectGenerationSettings projectGenerationSettings = null)
     : base(assemblyPath, targetPath, language, null, preferences, notifier, assemblyInfoService, visualStudioVersion, projectGenerationSettings)
 {
     Initialize();
 }
        public WinRTProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
                                   IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
                                   IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
                                   ProjectGenerationSettings projectGenerationSettings = null)
            : base(assemblyPath, targetPath, language, null, preferences, notifier, assemblyInfoService, visualStudioVersion, projectGenerationSettings)
        {
            Initialize();

            this.projectFileManager = new WinRTProjectFileManager(this.assembly, this.assemblyInfo, this.language, this.visualStudioVersion, this.namespaceHierarchyTree, this.modulesProjectsGuids, this.projectType, this.IsUWPProject, this.minInstalledUAPVersion, this.maxInstalledUAPVersion);
        }
        public BaseProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
                                  IFrameworkResolver frameworkResolver, IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
                                  IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
                                  ProjectGenerationSettings projectGenerationSettings = null, IProjectGenerationNotifier projectNotifier = null)
        {
            this.assemblyPath = assemblyPath;
            this.TargetPath   = targetPath;
            this.targetDir    = Path.GetDirectoryName(targetPath);
            this.language     = language;

            this.frameworkResolver         = frameworkResolver;
            this.assemblyInfoService       = assemblyInfoService;
            this.decompilationPreferences  = preferences;
            this.visualStudioVersion       = visualStudioVersion;
            this.projectGenerationSettings = projectGenerationSettings;

            this.currentAssemblyResolver = new WeakAssemblyResolver(GlobalAssemblyResolver.CurrentAssemblyPathCache);

            var readerParameters = new ReaderParameters(currentAssemblyResolver);

            assembly = currentAssemblyResolver.LoadAssemblyDefinition(assemblyPath, readerParameters, loadPdb: true);

            this.namespaceHierarchyTree = assembly.BuildNamespaceHierarchyTree();

            filePathsService =
                new DefaultFilePathsService(
                    this.assembly,
                    this.assemblyPath,
                    Path.GetFileName(this.TargetPath),
                    this.UserDefinedTypes,
                    this.Resources,
                    this.namespaceHierarchyTree,
                    this.language,
                    Utilities.GetMaxRelativePathLength(targetPath),
                    this.decompilationPreferences.DecompileDangerousResources);
            filePathsService.ExceptionThrown += OnExceptionThrown;

            this.modulesToProjectsFilePathsMap = this.filePathsService.GetModulesToProjectsFilePathsMap();
            this.fileGeneratedNotifier         = notifier;

            this.resourcesToPathsMap     = this.filePathsService.GetResourcesToFilePathsMap();
            this.xamlResourcesToPathsMap = this.filePathsService.GetXamlResourcesToFilePathsMap();

            this.assemblyInfo         = this.assemblyInfoService.GetAssemblyInfo(this.assembly, this.frameworkResolver);
            this.projectNotifier      = projectNotifier;
            this.modulesProjectsGuids = new Dictionary <ModuleDefinition, Guid>();
        }
 public FileGenerationNotifier(IFileGenerationNotifier notifier)
 {
     this.notifier = notifier;
 }
Exemple #6
0
 public Differ(IgnoredChangesSet ignoreChangeSet, IFileGenerationNotifier progressNotifier)
 {
     this.ignoreChangeSet  = ignoreChangeSet;
     this.progressNotifier = progressNotifier;
 }
 public MSBuildProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
                              IFrameworkResolver frameworkResolver, IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
                              IAssemblyInfoService assemblyInfoService, ITargetPlatformResolver targetPlatformResolver, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
                              ProjectGenerationSettings projectGenerationSettings = null, IProjectGenerationNotifier projectNotifier = null)
     : base(assemblyPath, targetPath, language, frameworkResolver, preferences, notifier, assemblyInfoService, targetPlatformResolver, visualStudioVersion, projectGenerationSettings, projectNotifier)
 {
     this.projectFileManager = new MsBuildProjectFileManager(this.assembly, this.assemblyInfo, this.visualStudioVersion, this.modulesProjectsGuids, this.language, this.namespaceHierarchyTree);
 }
        public static IAssemblyDecompilationResults GenerateFiles(string assemblyFilePath, AssemblyDefinition assembly, string targetPath, SupportedLanguage language, CancellationToken cancellationToken, bool decompileDangerousResources, IFileGenerationNotifier notifier = null)
        {
            ILanguage decompilerLanguage = GetLanguage(language);
            string    csprojFileName     = Path.ChangeExtension(Path.GetFileName(assemblyFilePath), decompilerLanguage.VSProjectFileExtension);
            string    csprojTargetPath   = Path.Combine(targetPath, csprojFileName);

            Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <TypeDefinition> > assemblyUserDefinedTypes = Utilities.GetUserDefinedTypes(assembly, decompileDangerousResources);
            Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <Resource> >       assemblyResources        = Utilities.GetResources(assembly);

            IDecompilationPreferences decompilationPreferences = new DecompilationPreferences()
            {
                DecompileDangerousResources = decompileDangerousResources
            };

            JustAssemblyProjectBuilder projectBuilder;

            if (notifier != null)
            {
                projectBuilder = new JustAssemblyProjectBuilder(assemblyFilePath, assembly, assemblyUserDefinedTypes, assemblyResources, csprojTargetPath, decompilerLanguage, decompilationPreferences, new FileGenerationNotifier(notifier));
            }
            else
            {
                projectBuilder = new JustAssemblyProjectBuilder(assemblyFilePath, assembly, assemblyUserDefinedTypes, assemblyResources, csprojTargetPath, decompilerLanguage, decompilationPreferences, null);
            }

            return(projectBuilder.GenerateFiles(cancellationToken));
        }
 public NetCoreProjectBuilder(string assemblyPath, string targetPath, ILanguage language, IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
                              IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2017, ProjectGenerationSettings projectGenerationSettings = null, IProjectGenerationNotifier projectNotifier = null)
     : base(assemblyPath, targetPath, language, null, preferences, notifier, assemblyInfoService, visualStudioVersion, projectGenerationSettings, projectNotifier)
 {
     this.projectFileManager = new NetCoreProjectFileManager(this.assembly, this.assemblyInfo, this.modulesProjectsGuids);
 }
        public MSBuildProjectBuilder(string assemblyPath, string targetPath, ILanguage language,
            IFrameworkResolver frameworkResolver,IDecompilationPreferences preferences, IFileGenerationNotifier notifier,
            IAssemblyInfoService assemblyInfoService, VisualStudioVersion visualStudioVersion = VisualStudioVersion.VS2010,
			ProjectGenerationSettings projectGenerationSettings = null, IProjectGenerationNotifier projectNotifier = null)
        {
            this.assemblyPath = assemblyPath;
            this.TargetPath = targetPath;
			this.targetDir = Path.GetDirectoryName(targetPath);
            this.language = language;

            this.frameworkResolver = frameworkResolver;
            this.decompilationPreferences = preferences;
            this.assemblyInfoService = assemblyInfoService;
            this.visualStudioVersion = visualStudioVersion;
            this.projectGenerationSettings = projectGenerationSettings;

            this.currentAssemblyResolver = new WeakAssemblyResolver(GlobalAssemblyResolver.CurrentAssemblyPathCache);

            var readerParameters = new ReaderParameters(currentAssemblyResolver);
            assembly = currentAssemblyResolver.LoadAssemblyDefinition(assemblyPath, readerParameters, loadPdb: true);

            platform = currentAssemblyResolver.GetTargetPlatform(assemblyPath);
            namespaceHierarchyTree = assembly.BuildNamespaceHierarchyTree();

            filePathsService =
                new DefaultFilePathsService(
					this.assembly,
                    this.assemblyPath,
					Path.GetFileName(this.TargetPath),
                    this.UserDefinedTypes,
                    this.Resources,
                    namespaceHierarchyTree,
                    this.language,
                    Utilities.GetMaxRelativePathLength(targetPath));

			this.modulesToProjectsFilePathsMap = this.filePathsService.GetModulesToProjectsFilePathsMap();
			this.resourcesToPathsMap = this.filePathsService.GetResourcesToFilePathsMap();
			this.xamlResourcesToPathsMap = this.filePathsService.GetXamlResourcesToFilePathsMap();
            this.fileGeneratedNotifier = notifier;

			this.assemblyInfo = GetAssemblyInfo();
			this.projectNotifier = projectNotifier;
        }
Exemple #11
0
        public static IAssemblyDecompilationResults GenerateFiles(string assemblyFilePath, string targetPath, SupportedLanguage language, CancellationToken cancellationToken, IFileGenerationNotifier notifier = null)
        {
            ILanguage decompilerLanguage = GetLanguage(language);
            string    csprojFileName     = Path.ChangeExtension(Path.GetFileName(assemblyFilePath), decompilerLanguage.VSProjectFileExtension);
            string    csprojTargetPath   = Path.Combine(targetPath, csprojFileName);

            JustAssemblyProjectBuilder projectBuilder;

            if (notifier != null)
            {
                projectBuilder = new JustAssemblyProjectBuilder(assemblyFilePath, csprojTargetPath, decompilerLanguage, new FileGenerationNotifier(notifier));
            }
            else
            {
                projectBuilder = new JustAssemblyProjectBuilder(assemblyFilePath, csprojTargetPath, decompilerLanguage, null);
            }

            return(projectBuilder.GenerateFiles(cancellationToken));
        }
 public FileGenerationNotifier(IFileGenerationNotifier notifier)
 {
     this.notifier = notifier;
 }