/// <summary> /// Create new dlr class /// </summary> /// <param name="scriptScope">Scope which contains the class definition and in which the instance will be created</param> /// <param name="pythonType">Python-Type instance</param> /// <param name="parameter">Arguments for the constructor</param> public DlrClass(DlrScriptScope scriptScope, PythonType pythonType, params object[] parameter) { this.scriptScope = scriptScope; // create class instance instance = scriptScope.Host.ScriptEngine.Operations.CreateInstance(pythonType, parameter); }
/// <summary> /// Create new dlr class /// </summary> /// <param name="scriptScope">Scope which contains the class definition and in which the instance will be created</param> /// <param name="className">name of the class</param> /// <param name="parameter">Arguments for the constructor</param> public DlrClass(DlrScriptScope scriptScope, string className, params object[] parameter) { this.className = className; this.scriptScope = scriptScope; // create class instance type = scriptScope.ScriptScope.GetVariable(className); instance = scriptScope.Host.ScriptEngine.Operations.CreateInstance(type, parameter); }
/// <summary> /// Create a new dlr host environment /// </summary> public DlrHost(T language) { this.language = language; loadedAssemblies = new HashSet <string>(); resolver = new List <IDlrImportResolver>(); // Create runtime this.runtimeSetup = language.CreateRuntime(); this.runtime = new ScriptRuntime(this.runtimeSetup); // Create engine scriptEngine = language.CreateEngine(this.runtime); //TODO: Refactor this: GenericImportModule.Host = (this as DlrHost <IronPythonLanguage>); // create default scope defaultScope = new DlrScriptScope(this); }
/// <summary> /// Create math class /// </summary> /// <param name="scriptScope"></param> /// <param name="className"></param> /// <param name="parameter"></param> internal MathClass(DlrScriptScope scriptScope, params object[] parameter) : base(scriptScope, "MathClass", parameter) { }
/// <summary> /// Create new default scope. One default scope will be created automatically when creating a Host-Instance. /// </summary> /// <returns>Scope instance</returns> public DlrScriptScope CreateNewDefaultScope() { defaultScope = new DlrScriptScope(this); return(defaultScope); }