/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using System.Collections.Generic; using System.IO; using System.Threading; using dnlib.DotNet; using dnSpy.Contracts.Decompiler; namespace dnSpy.Decompiler.MSBuild { sealed class ProjectModuleOptions { /// /// Module /// public ModuleDef Module { get; } /// /// Decompiler to use /// public IDecompiler Decompiler { get; } /// /// Decompilation context /// public DecompilationContext DecompilationContext { get; } /// /// true to not reference mscorlib /// public bool DontReferenceStdLib { get; set; } /// /// Project version or null to use /// public ProjectVersion? ProjectVersion { get; set; } /// /// Project guid, initialized to a random guid in the constructor /// public Guid ProjectGuid { get; set; } /// /// true to extract files from resources found in the modules. Default value is true. /// public bool UnpackResources { get; set; } /// /// true to generate .resx files from resources. Only used if /// is true. Default value is true. /// public bool CreateResX { // Option is already disabled by default, but we should use a custom ResourceReader class in ResXProjectFile, // so always ignore it for now. get => false; set { } } /// /// true to decompile baml files to xaml files. Only used if /// is true and isn't null. Default value is true. /// public bool DecompileXaml { get; set; } /// /// Decompiles baml data to a /// public Func>? DecompileBaml; public ProjectModuleOptions(ModuleDef module, IDecompiler decompiler, DecompilationContext decompilationContext) { Module = module ?? throw new ArgumentNullException(nameof(module)); Decompiler = decompiler ?? throw new ArgumentNullException(nameof(decompiler)); DecompilationContext = decompilationContext ?? throw new ArgumentNullException(nameof(decompilationContext)); ProjectGuid = Guid.NewGuid(); UnpackResources = true; CreateResX = true; DecompileXaml = true; } } }