blob: c92e1e4d217bd216bc916344b4760f1615b548e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
using System;
using System.Collections.Generic;
using System.IO;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Cecil.Pdb;
namespace StardewModdingAPI.Framework.ModLoading
{
internal class SymbolReaderProvider : ISymbolReaderProvider
{
private readonly ISymbolReaderProvider BaseProvider = new DefaultSymbolReaderProvider();
private readonly Dictionary<string, Stream> SymbolMapping = new Dictionary<string, Stream>();
public void AddSymbolMapping( string dllName, Stream symbolStream )
{
this.SymbolMapping.Add( dllName, symbolStream );
}
public ISymbolReader GetSymbolReader( ModuleDefinition module, string fileName )
{
if ( this.SymbolMapping.ContainsKey( module.Name ) )
return new MySymbolReader( module, this.SymbolMapping[ module.Name ] );
return this.BaseProvider.GetSymbolReader( module, fileName );
}
public ISymbolReader GetSymbolReader( ModuleDefinition module, Stream symbolStream )
{
if ( this.SymbolMapping.ContainsKey( module.Name ) )
return new MySymbolReader( module, this.SymbolMapping[ module.Name ] );
return this.BaseProvider.GetSymbolReader( module, symbolStream );
}
}
}
|