I have one supporting optional custom plugin for the Main custom plugin. The purpose of the optional plugin is to apply quick changes to the Main plugin's custom DLLs using the Jiwa code editor, I set the optional plugin execution order to less than the Main plugin but when I am trying to call a static method of the supporting plugin I am getting an exception:
"System.IO.FileNotFoundException: 'Could not load file or assembly 'OptionalConfigPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.'"
I tried a couple of ways to make it work but both are not working.
Supporting Optional Plugin just contains a single class with some methods.
- Code: Select all
namespace OptionalConfigPlugin {
public class OptionalConfig{
public static decimal OverrideInventoryPrice(JiwaFinancials.Jiwa.JiwaInventory.Inventory inventory, JiwaFinancials.Jiwa.JiwaApplication.Manager manager){
return 10;
}
}
}
calling the above plugin method in the Main plugin like below:
- Code: Select all
bool isOptionalPluginExists = CheckCustomPluginExists(manager);
if(isOptionalPluginExists){
var assemblyName = "OptionalConfigPlugin.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var assembly = (from a in assemblies
where a.FullName == assemblyName
select a).SingleOrDefault();
if(assembly != null){
// calling method using assembly
}
}
In the above, I can't see the referred plugin (Optional Plugin) assembly in the assemblies variable.
On the second try, I directly called the class method.
- Code: Select all
var price = OptionalConfigPlugin.OptionalConfig.OverrideInventoryPrice(inventory, manager);
Obviously, the above code will fail when the optional plugin is not referred but it is failing even though I referred the plugin.
How can I get the assembly of the referred plugin in the Main plugin?