summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-08-25 21:54:00 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-08-25 21:54:00 -0400
commit211f89821e34bb55a6266384d9bac68ec0c64744 (patch)
treeaa0d9915b01aad436ed6b1a2028602c048666457 /src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs
parent80d3dd1f786f7e5846f9adb7f7a4d82e5b9b92fd (diff)
parent31ac964a8b19623b0472931403a33d51db6fb271 (diff)
downloadSMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.tar.gz
SMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.tar.bz2
SMAPI-211f89821e34bb55a6266384d9bac68ec0c64744.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs
new file mode 100644
index 00000000..8f7e05d1
--- /dev/null
+++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs
@@ -0,0 +1,40 @@
+using System.IO;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+
+namespace StardewModdingAPI.Framework.ModLoading.Symbols
+{
+ /// <summary>Provides assembly symbol writers for Mono.Cecil.</summary>
+ internal class SymbolWriterProvider : ISymbolWriterProvider
+ {
+ /*********
+ ** Fields
+ *********/
+ /// <summary>The default symbol writer provider.</summary>
+ private readonly ISymbolWriterProvider DefaultProvider = new DefaultSymbolWriterProvider();
+
+ /// <summary>The symbol writer provider for the portable PDB format.</summary>
+ private readonly ISymbolWriterProvider PortablePdbProvider = new PortablePdbWriterProvider();
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Get a symbol writer for a given module and assembly path.</summary>
+ /// <param name="module">The loaded assembly module.</param>
+ /// <param name="fileName">The assembly name.</param>
+ public ISymbolWriter GetSymbolWriter(ModuleDefinition module, string fileName)
+ {
+ return this.DefaultProvider.GetSymbolWriter(module, fileName);
+ }
+
+ /// <summary>Get a symbol writer for a given module and symbol stream.</summary>
+ /// <param name="module">The loaded assembly module.</param>
+ /// <param name="symbolStream">The loaded symbol file stream.</param>
+ public ISymbolWriter GetSymbolWriter(ModuleDefinition module, Stream symbolStream)
+ {
+ // Not implemented in default native pdb writer, so fallback to portable
+ return this.PortablePdbProvider.GetSymbolWriter(module, symbolStream);
+ }
+ }
+}