i want to make plugin support for my program
the goal is to make it compile files in plugin folder and launch few methods but i can get it working
my current progress using CSScriptLibrary :
public static void run(String fileName, String methodName, params Object[] parameters)
{
FileInfo f = new FileInfo(fileName);
try
{
CSScript.Evaluator.Reset();
CSScript.Evaluator.ReferenceAssembliesFromCode(File.ReadAllText(Environment.CurrentDirectory + @"\addons\ResourceManager.cs"));
dynamic block = CSScript.Evaluator.LoadCode(File.ReadAllText(f.FullName));
block.Load(parameters); // <---- Exception
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
}
but it throws exception :
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'WAddon.Load(Weird.ResourceManager)' has some invalid arguments AddonManager.cs:line 28
the addon file :
using System;
using Weird;
class WAddon
{
public static void Load(ResourceManager resManager)
{
resManager.add("var", "0");
}
}
i dont think resmanager class is important anyways want to pass instance of it to load function so it can change things on original program