From 0b29eb3bc37553aa2e9776e17727ba07018606ea Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 25 Aug 2021 20:01:59 -0400 Subject: minor refactoring in new symbol code --- .../ModLoading/Symbols/SymbolWriterProvider.cs | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs') diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs index 33e91db0..8f7e05d1 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs @@ -4,19 +4,37 @@ using Mono.Cecil.Cil; namespace StardewModdingAPI.Framework.ModLoading.Symbols { + /// Provides assembly symbol writers for Mono.Cecil. internal class SymbolWriterProvider : ISymbolWriterProvider { - private readonly ISymbolWriterProvider BaseProvider = new DefaultSymbolWriterProvider(); + /********* + ** Fields + *********/ + /// The default symbol writer provider. + private readonly ISymbolWriterProvider DefaultProvider = new DefaultSymbolWriterProvider(); - public ISymbolWriter GetSymbolWriter( ModuleDefinition module, string fileName ) + /// 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.BaseProvider.GetSymbolWriter( module, fileName ); + return this.DefaultProvider.GetSymbolWriter(module, fileName); } - public ISymbolWriter GetSymbolWriter( ModuleDefinition module, Stream symbolStream ) + /// 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 new PortablePdbWriterProvider().GetSymbolWriter( module, symbolStream ); + return this.PortablePdbProvider.GetSymbolWriter(module, symbolStream); } } } -- cgit