コード例 #1
0
 public ProjectItemWriterFactory(AssemblyDefinition thisAssembly, Mono.Collections.Generic.Collection <TypeDefinition> userDefinedTypes,
                                 FileGenerationContext fileGenContext, IFilePathsService filePathsService, string sourceExtension)
 {
     this.assembly         = thisAssembly;
     this.fileGenContext   = fileGenContext;
     this.filePathsService = filePathsService;
     this.typeToPathMap    = filePathsService.GetTypesToFilePathsMap();
     this.sourceExtension  = sourceExtension;
 }
        public ProjectItemWriterFactory(AssemblyDefinition thisAssembly, Mono.Collections.Generic.Collection<TypeDefinition> userDefinedTypes, 
			FileGenerationContext fileGenContext, IFilePathsService filePathsService, string sourceExtension)
        {
            this.assembly = thisAssembly;
            this.fileGenContext = fileGenContext;
			this.filePathsService = filePathsService;
			this.typeToPathMap = filePathsService.GetTypesToFilePathsMap();
            this.sourceExtension = sourceExtension;
        }
コード例 #3
0
 public ProjectItemWriterFactory(AssemblyDefinition thisAssembly, Mono.Collections.Generic.Collection <TypeDefinition> userDefinedTypes,
                                 IProjectManager projectFileManager, IFilePathsService filePathsService, string sourceExtension, string targetDirectory)
 {
     this.assembly           = thisAssembly;
     this.projectFileManager = projectFileManager;
     this.filePathsService   = filePathsService;
     this.typeToPathMap      = filePathsService.GetTypesToFilePathsMap();
     this.sourceExtension    = sourceExtension;
     this.targetDirectory    = targetDirectory;
 }
コード例 #4
0
 public ResXDesignerWriter(string projectRootDirectory, string relativeResourcePath,
                           List <ProjectItemGroupCompile> designerItemGroup,
                           List <ProjectItemGroupEmbeddedResource> resourceItemGroup,
                           IFilePathsService filePathsService)
 {
     this.designerItemGroup    = designerItemGroup;
     this.resourceItemGroup    = resourceItemGroup;
     this.relativeResourcePath = relativeResourcePath;
     this.relativeDesignerPath = Path.Combine(Path.GetDirectoryName(relativeResourcePath), filePathsService.GetResourceDesignerRelativePath(Path.GetFileNameWithoutExtension(relativeResourcePath)));
     this.fullPath             = Path.Combine(projectRootDirectory, this.relativeDesignerPath);
 }
コード例 #5
0
        public ResXDesignerWriter(string projectRootDirectory, string relativeResourcePath,
            List<ProjectItemGroupCompile> designerItemGroup,
            List<ProjectItemGroupEmbeddedResource> resourceItemGroup,
			IFilePathsService filePathsService)
        {
            this.designerItemGroup = designerItemGroup;
            this.resourceItemGroup = resourceItemGroup;
            this.relativeResourcePath = relativeResourcePath;
			this.relativeDesignerPath = Path.Combine(Path.GetDirectoryName(relativeResourcePath), filePathsService.GetResourceDesignerRelativePath(Path.GetFileNameWithoutExtension(relativeResourcePath)));
            this.fullPath = Path.Combine(projectRootDirectory, this.relativeDesignerPath);
        }
コード例 #6
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>();
        }
コード例 #7
0
        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>();
        }
コード例 #8
0
        public ResXDesignerWriter(string projectRootDirectory, string relativeResourcePath, IResXDesignerProjectItemWriter itemWriter, IFilePathsService filePathsService)
        {
            this.relativeResourcePath = relativeResourcePath;
            this.itemWriter           = itemWriter;
            this.relativeDesignerPath = Path.Combine(Path.GetDirectoryName(relativeResourcePath),
                                                     filePathsService.GetResourceDesignerRelativePath(Path.GetFileNameWithoutExtension(relativeResourcePath)));

            this.fullPath = Path.Combine(projectRootDirectory, this.relativeDesignerPath);
        }
コード例 #9
0
        public const int MaxPathLength = 259; // 259 + NULL == 260

        public MSBuildProjectBuilder(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,
			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.language = language;
            this.frameworkResolver = frameworkResolver;
            this.assemblyInfoService = assemblyInfoService;
            this.visualStudioVersion = visualStudioVersion;
            this.projectGenerationSettings = projectGenerationSettings;

            this.currentAssemblyResolver = assembly.MainModule.AssemblyResolver;
			this.decompilationPreferences = preferences;

            platform = currentAssemblyResolver.GetTargetPlatform(assembly.MainModule.FilePath);
            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.assemblyInfo = GetAssemblyInfo();
			this.projectNotifier = projectNotifier;
        }
コード例 #10
0
        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;
        }