public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
{
if (!enabled)
{
return;
}
try
{
// Need to call this interpreter in the same way as the MasterInterpreter will call it.
// initialize main parameters
var parameters = new InterpreterMainParameters()
{
Project = project,
CurrentFCO = currentobj,
SelectedFCOs = selectedobjs,
StartModeParam = param
};
this.mainParameters = parameters;
parameters.ProjectDirectory = Path.GetDirectoryName(currentobj.Project.ProjectConnStr.Substring("MGA=".Length));
// set up the output directory
MgaGateway.PerformInTransaction(delegate
{
string outputDirName = project.Name;
if (currentobj != null)
{
outputDirName = currentobj.Name;
}
parameters.OutputDirectory = Path.GetFullPath(Path.Combine(
parameters.ProjectDirectory,
"results",
outputDirName));
//this.Parameters.PackageName = SystemC.Factory.GetModifiedName(currentobj.Name);
});
PreConfigArgs preConfigArgs = new PreConfigArgs();
preConfigArgs.ProjectDirectory = parameters.ProjectDirectory;
// call the preconfiguration with no parameters and get preconfig
var preConfig = this.PreConfig(preConfigArgs);
// get previous GUI config
var previousConfig = META.ComComponent.DeserializeConfiguration(
parameters.ProjectDirectory,
typeof(CyPhy2RF_Settings),
this.ComponentProgID);
// get interpreter config through GUI
var config = this.DoGUIConfiguration(preConfig, previousConfig);
if (config == null)
{
Logger.WriteWarning("Operation cancelled by the user.");
return;
}
// if config is valid save it and update it on the file system
META.ComComponent.SerializeConfiguration(parameters.ProjectDirectory, config, this.ComponentProgID);
// assign the new configuration to mainParameters
parameters.config = config;
// call the main (ICyPhyComponent) function
this.Main(parameters);
}
catch (Exception ex)
{
Logger.WriteError("Interpretation failed {0}<br>{1}", ex.Message, ex.StackTrace);
}
finally
{
MgaGateway = null;
project = null;
currentobj = null;
selectedobjs = null;
if (Logger != null)
{
Logger.Dispose();
Logger = null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
}
}