1010
1111namespace MonoDroid . Tuner
1212{
13+ public class AndroidLinkConfiguration {
14+ public IList < AssemblyDefinition > Assemblies => new List < AssemblyDefinition > ( ) ;
15+
16+ static IDictionary < LinkContext , AndroidLinkConfiguration > configurations = new Dictionary < LinkContext , AndroidLinkConfiguration > ( ) ;
17+
18+ public static AndroidLinkConfiguration GetInstance ( LinkContext context )
19+ {
20+ if ( ! configurations . TryGetValue ( context , out AndroidLinkConfiguration config ) ) {
21+ configurations . Add ( context , new AndroidLinkConfiguration ( ) ) ;
22+ }
23+ return config ;
24+ }
25+ }
1326 public class GetAssembliesStep : BaseStep
1427 {
15- AndroidLinkContext linkContext = null ;
28+ AndroidLinkConfiguration config = null ;
1629
1730 protected override void Process ( )
1831 {
19- linkContext = Context as AndroidLinkContext ;
32+ config = AndroidLinkConfiguration . GetInstance ( Context ) ;
2033 }
2134
2235 protected override void ProcessAssembly ( AssemblyDefinition assembly )
2336 {
24- if ( linkContext == null )
37+ if ( config == null )
2538 return ;
26- linkContext . Assemblies . Add ( assembly ) ;
39+ config . Assemblies . Add ( assembly ) ;
2740 }
2841 }
2942
@@ -37,10 +50,10 @@ public class RemoveResourceDesignerStep : BaseStep
3750 protected override void Process ( )
3851 {
3952 // resolve the MainAssembly Resource designer TypeDefinition
40- var _context = Context as AndroidLinkContext ;
41- if ( _context == null )
53+ AndroidLinkConfiguration config = AndroidLinkConfiguration . GetInstance ( Context ) ;
54+ if ( config == null )
4255 return ;
43- foreach ( var asm in _context . Assemblies ) {
56+ foreach ( var asm in config . Assemblies ) {
4457 if ( FindResourceDesigner ( asm , true , out mainDesigner ) ) {
4558 mainAssembly = asm ;
4659 break ;
0 commit comments