using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; namespace StardewModdingAPI.Framework.ModLoading.Symbols { /// Provides assembly symbol writers for Mono.Cecil. internal class SymbolWriterProvider : ISymbolWriterProvider { /********* ** Fields *********/ /// The default symbol writer provider. private readonly ISymbolWriterProvider DefaultProvider = new DefaultSymbolWriterProvider(); /// The symbol writer provider for the portable PDB format. private readonly ISymbolWriterProvider PortablePdbProvider = new PortablePdbWriterProvider(); /********* ** Public methods *********/ /// Get a symbol writer for a given module and assembly path. /// The loaded assembly module. /// The assembly name. public ISymbolWriter GetSymbolWriter(ModuleDefinition module, string fileName) { return this.DefaultProvider.GetSymbolWriter(module, fileName); } /// Get a symbol writer for a given module and symbol stream. /// The loaded assembly module. /// The loaded symbol file stream. public ISymbolWriter GetSymbolWriter(ModuleDefinition module, Stream symbolStream) { // Not implemented in default native pdb writer, so fallback to portable return this.PortablePdbProvider.GetSymbolWriter(module, symbolStream); } } }