namespace FreeSWITCH {\r
\r
public enum ScriptContextType {\r
+ None,\r
App,\r
Api,\r
ApiBackground,\r
}\r
\r
bool processAssembly(string fileName, Assembly asm) {\r
+ // Call the entrypoint once, to initialize apps that need their main called\r
+ var entryPoint = getEntryDelegate(asm.EntryPoint);\r
+ try { entryPoint(); } catch { }\r
+\r
+ // Check for loading\r
var allTypes = asm.GetExportedTypes();\r
if (!RunLoadNotify(allTypes)) return false;\r
\r
AddAppPlugins(allTypes);\r
\r
// Add the script executors\r
- var entryPoint = getEntryDelegate(asm.EntryPoint);\r
var name = Path.GetFileName(fileName);\r
var aliases = new List<string> { name };\r
this.ApiExecutors.Add(new ApiPluginExecutor(name, aliases, () => new ScriptApiWrapper(entryPoint)));\r
try {\r
entryPoint();\r
} finally {\r
+ Script.contextType = ScriptContextType.None;\r
Script.context = null;\r
}\r
}\r
try {\r
entryPoint();\r
} finally {\r
+ Script.contextType = ScriptContextType.None;\r
Script.context = null;\r
}\r
}\r
try {\r
entryPoint();\r
} finally {\r
+ Script.contextType = ScriptContextType.None;\r
Script.context = null;\r
}\r
}\r