private void Initialize() { this.projectType = WinRTProjectTypeDetector.GetProjectType(this.assembly); this.dependencies = new Dictionary <string, string>(); this.runtimes = new List <string>(); if (this.IsUWPProject) { TargetArchitecture architecture = this.assembly.MainModule.GetModuleArchitecture(); if (architecture == TargetArchitecture.I386) { this.runtimes.Add("win10-x86"); this.runtimes.Add("win10-x86-aot"); } else if (architecture == TargetArchitecture.AMD64) { this.runtimes.Add("win10-x64"); this.runtimes.Add("win10-x64-aot"); } else if (architecture == TargetArchitecture.ARMv7) { this.runtimes.Add("win10-arm"); this.runtimes.Add("win10-arm-aot"); } } InitializeInstalledUAPVersions(); }
private void Initialize() { this.projectType = WinRTProjectTypeDetector.GetProjectType(this.assembly); if (this.projectType == WinRTProjectType.Component || this.projectType == WinRTProjectType.ComponentForWindows) { this.platforms = new List <string>() { "Any CPU", "ARM", "x64", "x86" }; } else if (this.projectType == WinRTProjectType.ComponentForUniversal) { this.platforms = new List <string>() { "Any CPU" }; } else if (this.projectType == WinRTProjectType.ComponentForWindowsPhone) { this.platforms = new List <string>() { "Any CPU", "ARM", "x86" }; } else { this.platforms = new List <string>(); } }
public static ProjectGenerationSettings GetProjectGenerationSettings(string assemblyFilePath, IAssemblyInfoService assemblyInfoService, IFrameworkResolver frameworkResolver, VisualStudioVersion visualStudioVersion, ILanguage language, ITargetPlatformResolver targetPlatformResolver) { AssemblyDefinition assembly = Telerik.JustDecompiler.Decompiler.Utilities.GetAssembly(assemblyFilePath); AssemblyInfo assemblyInfo = assemblyInfoService.GetAssemblyInfo(assembly, frameworkResolver, targetPlatformResolver); TargetPlatform targetPlatform = GlobalAssemblyResolver.Instance.GetTargetPlatform(assemblyFilePath, targetPlatformResolver); foreach (KeyValuePair <ModuleDefinition, FrameworkVersion> pair in assemblyInfo.ModulesFrameworkVersions) { if (pair.Value == FrameworkVersion.Unknown) { return(new ProjectGenerationSettings(true, ResourceStrings.GenerateOnlySourceFilesDueToUnknownFrameworkVersion, false)); } else if (pair.Value == FrameworkVersion.WindowsCE || (targetPlatform == TargetPlatform.WindowsPhone && pair.Value == FrameworkVersion.WindowsPhone) || (targetPlatform == TargetPlatform.WinRT && WinRTProjectTypeDetector.GetProjectType(assembly) == WinRTProjectType.Unknown)) { return(new ProjectGenerationSettings(true, ResourceStrings.GenerateOnlySourceFilesDueToNotSupportedProjectType, false)); } } string resultErrorMessage; if (visualStudioVersion == VisualStudioVersion.VS2010) { if (!CanBe2010ProjectCreated(assemblyInfo, targetPlatform, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } else if (visualStudioVersion == VisualStudioVersion.VS2012) { if (!CanBe2012ProjectCreated(assembly, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } else { if (targetPlatform == TargetPlatform.WinRT && language is IVisualBasic && WinRTProjectTypeDetector.GetProjectType(assembly) == WinRTProjectType.ComponentForUniversal) { resultErrorMessage = string.Format(ResourceStrings.CannotCreateProjectForComponentForUniversalInVB, visualStudioVersion.ToFriendlyString()); return(new ProjectGenerationSettings(false, resultErrorMessage)); } if (visualStudioVersion == VisualStudioVersion.VS2013) { if (!CanBe2013ProjectCreated(assembly, language, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } } return(new ProjectGenerationSettings(true)); }
private static bool CanBe2013ProjectCreated(AssemblyDefinition assembly, ILanguage language, out string errorMessage) { TargetPlatform targetPlatform = assembly.MainModule.AssemblyResolver.GetTargetPlatform(assembly.MainModule.FilePath); if (targetPlatform == TargetPlatform.WinRT && language is VisualBasic && WinRTProjectTypeDetector.GetProjectType(assembly) == WinRTProjectType.ComponentForUniversal) { errorMessage = ResourceStrings.CannotCreate2013Project; return(false); } errorMessage = null; return(true); }
public static ProjectGenerationSettings GetProjectGenerationSettings(string assemblyFilePath, IAssemblyInfoService assemblyInfoService, IFrameworkResolver frameworkResolver, VisualStudioVersion visualStudioVersion, ILanguage language) { AssemblyDefinition assembly = Telerik.JustDecompiler.Decompiler.Utilities.GetAssembly(assemblyFilePath); AssemblyInfo assemblyInfo = assemblyInfoService.GetAssemblyInfo(assembly, frameworkResolver); foreach (KeyValuePair <ModuleDefinition, FrameworkVersion> pair in assemblyInfo.ModulesFrameworkVersions) { if (pair.Value == FrameworkVersion.Unknown) { return(new ProjectGenerationSettings(true, ResourceStrings.GenerateOnlySourceFilesDueToUnknownFrameworkVersion, false)); } else if (pair.Value == FrameworkVersion.WindowsCE || pair.Value == FrameworkVersion.WindowsPhone || (pair.Value == FrameworkVersion.WinRT && WinRTProjectTypeDetector.GetProjectType(assembly) == WinRTProjectType.Unknown)) { return(new ProjectGenerationSettings(true, ResourceStrings.GenerateOnlySourceFilesDueToNotSupportedProjectType, false)); } } string resultErrorMessage; if (visualStudioVersion == VisualStudioVersion.VS2010) { if (!CanBe2010ProjectCreated(assemblyInfo, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } else if (visualStudioVersion == VisualStudioVersion.VS2012) { if (!CanBe2012ProjectCreated(assembly, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } else if (visualStudioVersion == VisualStudioVersion.VS2013) { if (!CanBe2013ProjectCreated(assembly, language, out resultErrorMessage)) { return(new ProjectGenerationSettings(false, resultErrorMessage)); } } return(new ProjectGenerationSettings(true)); }