public string[] SymbolCompleter(ScriptingContext context, string text)
{
try {
var method_list = new List <string> ();
string[] namespaces = context.GetNamespaces();
Module[] modules = context.CurrentProcess.Modules;
foreach (Module module in modules)
{
if (!module.SymbolsLoaded || !module.SymbolTable.HasMethods)
{
continue;
}
SourceFile[] sources = module.Sources;
if (sources == null)
{
continue;
}
foreach (SourceFile sf in sources)
{
foreach (MethodSource method in sf.Methods)
{
if (method.Name.StartsWith(text))
{
int parameter_start = method.Name.IndexOf('(');
if (parameter_start != -1)
{
method_list.Add(method.Name.Substring(0, parameter_start));
}
else
{
method_list.Add(method.Name);
}
}
if (namespaces != null)
{
foreach (string n in namespaces)
{
if (n != "" && method.Name.StartsWith(String.Concat(n, ".", text)))
{
int parameter_start = method.Name.IndexOf('(');
if (parameter_start != -1)
{
method_list.Add(method.Name.Substring(n.Length + 1,
parameter_start - n.Length - 1));
}
else
{
method_list.Add(method.Name.Substring(n.Length + 1));
}
}
}
}
}
}
}
return(method_list.ToArray());
} catch {
return(null);
}
}