示例#1
0
 public WinRTProjectFileManager(AssemblyDefinition assembly, AssemblyInfo assemblyInfo, ILanguage language, VisualStudioVersion visualStudioVersion,
                                NamespaceHierarchyTree namespaceHierarchyTree, Dictionary <ModuleDefinition, Guid> modulesProjectsGuids, WinRTProjectType projectType, bool isUWPProject, Version minInstalledUAPVersion, Version maxInstalledUAPVersion)
     : base(assembly, assemblyInfo, visualStudioVersion, modulesProjectsGuids, language, namespaceHierarchyTree)
 {
     this.projectType            = projectType;
     this.isUWPProject           = isUWPProject;
     this.minInstalledUAPVersion = minInstalledUAPVersion;
     this.maxInstalledUAPVersion = maxInstalledUAPVersion;
 }
 public FileGenerationContext(string targetDir, NamespaceHierarchyTree namespaceHierarchyTree)
 {
     TargetDirectory               = targetDir;
     NamespacesTree                = namespaceHierarchyTree;
     NormalCodeEntries             = new List <ProjectItemGroupCompile>();
     WinFormCodeEntries            = new List <ProjectItemGroupCompile>();
     WinFormResXEntries            = new List <ProjectItemGroupEmbeddedResource>();
     ResXEntries                   = new List <ProjectItemGroupEmbeddedResource>();
     XamlFileEntries               = new List <object>();
     ResourceDesignerMap           = new Dictionary <string, string>();
     XamlFullNameToRelativePathMap = new Dictionary <string, string>();
     OtherEmbeddedResources        = new List <ProjectItemGroupEmbeddedResource>();
     OtherXamlResources            = new List <ProjectItemGroupResource>();
 }
示例#3
0
        public BaseProjectBuilder(string assemblyPath, AssemblyDefinition assembly,
                                  Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <TypeDefinition> > userDefinedTypes,
                                  Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <Resource> > resources,
                                  string targetPath, ILanguage language, IFrameworkResolver frameworkResolver,
                                  IDecompilationPreferences preferences, IAssemblyInfoService assemblyInfoService, ITargetPlatformResolver targetPlatformResolver,
                                  VisualStudioVersion visualStudioVersion    = VisualStudioVersion.VS2010, ProjectGenerationSettings projectGenerationSettings = null,
                                  IProjectGenerationNotifier projectNotifier = null)
        {
            this.assemblyPath            = assemblyPath;
            this.assembly                = assembly;
            this.userDefinedTypes        = userDefinedTypes;
            this.resources               = resources;
            this.TargetPath              = targetPath;
            this.targetDir               = Path.GetDirectoryName(targetPath);
            this.targetPlatformResolver  = targetPlatformResolver;
            this.language                = language;
            this.frameworkResolver       = frameworkResolver;
            this.assemblyInfoService     = assemblyInfoService;
            this.currentAssemblyResolver = assembly.MainModule.AssemblyResolver;

            this.visualStudioVersion       = visualStudioVersion;
            this.projectGenerationSettings = projectGenerationSettings;

            this.decompilationPreferences = preferences;

            this.platform = currentAssemblyResolver.GetTargetPlatform(assembly.MainModule.FilePath, TargetPlatformResolver.Instance);
            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));
            filePathsService.ExceptionThrown += OnExceptionThrown;

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

            this.assemblyInfo         = this.assemblyInfoService.GetAssemblyInfo(this.assembly, this.frameworkResolver, this.targetPlatformResolver);
            this.projectNotifier      = projectNotifier;
            this.modulesProjectsGuids = new Dictionary <ModuleDefinition, Guid>();
        }
        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 DefaultFilePathsService(AssemblyDefinition assembly, string assemblyPath, string mainModuleProjectFileName, Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <TypeDefinition> > userDefinedTypes,
                                       Dictionary <ModuleDefinition, Mono.Collections.Generic.Collection <Resource> > resources, NamespaceHierarchyTree namespaceHierarchyTree, ILanguage language, int maxRelativePathLength)
        {
            this.assembly     = assembly;
            this.assemblyPath = assemblyPath;
            this.mainModuleProjectFileName = mainModuleProjectFileName;
            this.userDefinedTypes          = userDefinedTypes;
            this.namespaceHierarchyTree    = namespaceHierarchyTree;
            this.language = language;
            this.maxRelativePathLength = maxRelativePathLength;

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

            this.typesData       = GetFilePathsServiceData();
            this.resources       = resources;
            this.xamlResources   = GetXamlResources(resources);
            this.sourceExtension = language.VSCodeFileExtension;
        }
        public MsBuildProjectFileManager(AssemblyDefinition assembly, AssemblyInfo assemblyInfo, VisualStudioVersion visualStudioVersion,
                                         Dictionary <ModuleDefinition, Guid> modulesProjectsGuids, ILanguage language, NamespaceHierarchyTree namespaceHierarchyTree)
            : base(assembly, assemblyInfo, modulesProjectsGuids)
        {
            this.NormalCodeEntries      = new List <ProjectItemGroupCompile>();
            this.WinFormCodeEntries     = new List <ProjectItemGroupCompile>();
            this.WinFormResXEntries     = new List <ProjectItemGroupEmbeddedResource>();
            this.ResXEntries            = new List <ProjectItemGroupEmbeddedResource>();
            this.OtherEmbeddedResources = new List <ProjectItemGroupEmbeddedResource>();
            this.OtherXamlResources     = new List <ProjectItemGroupResource>();

            this.NamespacesTree      = namespaceHierarchyTree;
            this.visualStudioVersion = visualStudioVersion;
            this.language            = language;
        }