public List <ExtensionResult> GetResults(String term) { var results = new List <ExtensionResult>(); var extResults = __extension.CallMethod("results", term); // if it's null or not an array (__COMObject Type) then gtfo if (extResults == null || !extResults.IsComObject()) { return(null); } using (var inspector = new Scripting.Inspecting.ObjectInspector(extResults)) { foreach (var result in inspector.GetList()) { var hash = result as Hashtable; if (!hash.ContainsKey("text")) { continue; } String text = hash.TryGetValue("text").Convert <String>(); String command = hash.TryGetValue("command").Convert <String>(); results.Add(new ExtensionResult() { Extension = this, Text = text, Command = command }); } } return(results); }
public List<ExtensionResult> GetResults(String term) { var results = new List<ExtensionResult>(); var extResults = __extension.CallMethod("results", term); // if it's null or not an array (__COMObject Type) then gtfo if (extResults == null || !extResults.IsComObject()) { return null; } using (var inspector = new Scripting.Inspecting.ObjectInspector(extResults)) { foreach (var result in inspector.GetList()) { var hash = result as Hashtable; if (!hash.ContainsKey("text")) { continue; } String text = hash.TryGetValue("text").Convert<String>(); String command = hash.TryGetValue("command").Convert<String>(); results.Add(new ExtensionResult() { Extension = this, Text = text, Command = command }); } } return results; }