@@ -15,18 +15,21 @@ public class RecipeV1Loader
1515 public static IEnumerable < IRecipePlugin > FindRecipePlugins ( )
1616 {
1717 var location = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ! , "Plugin" ) ;
18- var files = Directory . EnumerateFiles ( location , "*.v1.dll" , SearchOption . AllDirectories ) ;
19- foreach ( var file in files )
18+ if ( Directory . Exists ( location ) )
2019 {
21- using var loader = PluginLoader . CreateFromAssemblyFile ( file , false , [ typeof ( IRecipePlugin ) , typeof ( IRecipe ) , typeof ( ISimpleRecipe ) ] ) ;
22- var plugin = loader . LoadDefaultAssembly ( ) ;
23- foreach ( var recipePluginType in plugin . GetTypes ( ) . Where ( t => typeof ( IRecipePlugin ) . IsAssignableFrom ( t ) && ! t . IsAbstract ) )
20+ var files = Directory . EnumerateFiles ( location , "*.v1.dll" , SearchOption . AllDirectories ) ;
21+ foreach ( var file in files )
2422 {
25- var recipePlugin = Activator . CreateInstance ( recipePluginType ) as IRecipePlugin ;
26- if ( recipePlugin is not null )
23+ using var loader = PluginLoader . CreateFromAssemblyFile ( file , false , [ typeof ( IRecipePlugin ) , typeof ( IRecipe ) , typeof ( ISimpleRecipe ) ] ) ;
24+ var plugin = loader . LoadDefaultAssembly ( ) ;
25+ foreach ( var recipePluginType in plugin . GetTypes ( ) . Where ( t => typeof ( IRecipePlugin ) . IsAssignableFrom ( t ) && ! t . IsAbstract ) )
2726 {
28- Debug . WriteLine ( recipePlugin . Name ) ;
29- yield return recipePlugin ;
27+ var recipePlugin = Activator . CreateInstance ( recipePluginType ) as IRecipePlugin ;
28+ if ( recipePlugin is not null )
29+ {
30+ Debug . WriteLine ( recipePlugin . Name ) ;
31+ yield return recipePlugin ;
32+ }
3033 }
3134 }
3235 }
0 commit comments