public static bool RunScriptFunction(Model model, ScriptFunction function, EA.ObjectType oType, object oContext)
{
// run script according to parameter count
switch (function.NumberOfParameters)
{
case 2:
object[] par2 = { oContext, oType };
new ScriptFuntionWrapper(function).Execute(par2);
return true;
case 3:
object[] par3 = { oContext, oType, model };
return new ScriptFuntionWrapper(function).Execute(par3);
default:
MessageBox.Show($"Script {function.FullName} has {function.NumberOfParameters} parameter",
@"Script function parameter count not 2 or 3, Break!");
return false;
}
}
}