public void RunScriptOnProgramImage(Program program, Script_v2 script)
{
if (script == null || !script.Enabled)
return;
IScriptInterpreter interpreter;
try
{
//$TODO: should be in the config file, yeah.
var type = Type.GetType("Reko.ImageLoaders.OdbgScript.OllyLang,Reko.ImageLoaders.OdbgScript");
interpreter = (IScriptInterpreter) Activator.CreateInstance(type);
}
catch (Exception ex)
{
eventListener.Error(new NullCodeLocation(""), ex, "Unable to load script interpreter {0}.");
return;
}
try
{
interpreter.LoadFromString(script.Script, null);
interpreter.Run();
}
catch (Exception ex)
{
eventListener.Error(new NullCodeLocation(""), ex, "An error occurred while running the script.");
}
}