/// <summary> /// Does actual loading and initialization of script Assembly. Can throw many kinds of errors, depending on what problem was run across during loading. /// </summary> /// <param name="file_name">File name of script assembly (.dll)</param> /// <param name="namespace_class">The namespace and type in the assembly to initialize and return</param> /// <returns></returns> private IScriptEngineInterface LoadAndInitAssembly(string file_name, string namespace_class) { //Common.SendToDebug("Loading ScriptEngine Assembly " + FileName); // Load .Net Assembly (.dll), initialize and return it // All error checking is expected to be handled by caller. Assembly a = Assembly.LoadFrom(file_name); Type t = a.GetType(namespace_class, true); IScriptEngineInterface ret = (IScriptEngineInterface)Activator.CreateInstance(t); return(ret); }
public IScriptEngineInterface LoadScriptEngine(string EngineName) { IScriptEngineInterface ret = null; try { ret = LoadAndInitAssembly( Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine." + EngineName + ".dll"), "OpenSim.Region.ScriptEngine." + EngineName + ".ScriptEngine"); } catch (Exception e) { m_log.Error("[ScriptEngine]: " + "Error loading assembly \"" + EngineName + "\": " + e.Message + ", " + e.StackTrace.ToString()); } return(ret); }