private IList GetIntellisenseList() { IList list = null; // now intellisense if (IntellisenseScope == null) { return(list); } // we really want to get intellisense right away. No matter what // so, we first make it cache, then add to it var intellisense_type = Intellisense.GetType(); var m = intellisense_type.GetMethod("GetModuleList", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod); m.Invoke(Intellisense, null); var ex_m_autocomplete_modules = intellisense_type.GetField("m_autocomplete_modules", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance); if (ex_m_autocomplete_modules == null) { return(list); } return(ex_m_autocomplete_modules.GetValue(Intellisense) as IList); }
internal PythonEnvironment(GH_Component component, PythonScript script) { Component = component; Script = script; if (script != null) { Type scriptType = script.GetType(); var scopeField = scriptType.GetField("m_scope"); if (scopeField != null) { LocalScope = scopeField.GetValue(script); } var intellisenseField = scriptType.GetField("m_intellisense", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField); if (intellisenseField != null) { Intellisense = intellisenseField.GetValue(script); if (Intellisense != null) { var intellisenseType = Intellisense.GetType(); var scopeProperty = intellisenseType.GetProperty("Scope"); IntellisenseScope = scopeProperty.GetValue(Intellisense, null); } } var baseType = scriptType.BaseType; if (baseType != null && baseType != typeof(object)) { var hostType = baseType.Assembly.GetType("RhinoPython.Host"); if (hostType != null) { var engineInfo = hostType.GetProperty("Engine"); if (engineInfo != null) { Engine = engineInfo.GetValue(null, null); if (Engine != null) { var runtimeInfo = Engine.GetType().GetProperty("Runtime"); Runtime = runtimeInfo.GetValue(Engine, null); } } var scopeInfo = hostType.GetProperty("Scope", BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.Static); if (scopeInfo != null) { ScriptScope = scopeInfo.GetValue(null, null); } } } } }