internal static int Suggestions(NClass.Core.CompositeType startingClass, string name, bool isStatic) { NClass.Core.CompositeType ct = startingClass; while (ct != null && !ct.Name.Equals("Object")) { foreach (NClass.Core.Field f in ct.Fields) { if ((f.IsStatic == isStatic) && f.Name.ToLower().StartsWith(name)) { oo_suggestion_list.Add(f.Name); } } foreach (NClass.Core.Operation o in ct.Operations) { if (o is NClass.Core.Method && (o.IsStatic == isStatic) && (!(o is NClass.Core.Constructor)) && o.Name.ToLower().StartsWith(name)) { NClass.Core.Method m = (o as NClass.Core.Method); int num_params; string[] param_names; bool[] param_is_input; bool[] param_is_output; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(m.Name + "("); m.getParameters(out num_params, out param_names, out param_is_input, out param_is_output); for (int i = 0; i < num_params; i++) { sb.Append(param_names[i]); if (i < num_params - 1) { sb.Append(","); } } sb.Append(")"); oo_suggestion_list.Add(sb.ToString()); } } if (ct is NClass.Core.ClassType) { ct = (ct as NClass.Core.ClassType).BaseClass; } else { ct = null; } } return(oo_suggestion_list.Count); }
internal static int Prefix_Suggestion_Count(string name) { oo_suggestion_list.Clear(); int index = name.IndexOf('.'); if (name.LastIndexOf('.') != index) { return(0); } if (name.StartsWith("this.")) { if (Runtime.parent.carlisle.SelectedTab is ClassTabPage && ((Runtime.parent.carlisle.SelectedTab as ClassTabPage).tabControl1.SelectedTab as Procedure_Chart).method != null) { NClass.Core.ClassType ct = ((Runtime.parent.carlisle.SelectedTab as ClassTabPage).tabControl1.SelectedTab as Procedure_Chart).method.Parent as NClass.Core.ClassType; return(Suggestions(ct, name.Substring(index + 1), false)); } } else if (name.StartsWith("super.")) { if (Runtime.parent.carlisle.SelectedTab is ClassTabPage && ((Runtime.parent.carlisle.SelectedTab as ClassTabPage).tabControl1.SelectedTab as Procedure_Chart).method != null) { NClass.Core.ClassType ct = ((Runtime.parent.carlisle.SelectedTab as ClassTabPage).tabControl1.SelectedTab as Procedure_Chart).method.Parent as NClass.Core.ClassType; return(Suggestions(ct.BaseClass, name.Substring(index + 1), false)); } } else { foreach (NClass.Core.IEntity ie in Runtime.parent.projectCore.Entities) { if (name.StartsWith(ie.Name.ToLower() + ".")) { if (ie is NClass.Core.CompositeType) { NClass.Core.CompositeType ct = ie as NClass.Core.CompositeType; return(Suggestions(ct, name.Substring(index + 1), true)); } else if (ie is NClass.Core.EnumType) { NClass.Core.EnumType et = ie as NClass.Core.EnumType; } } } if (types.ContainsKey(name.Substring(0, index).ToLower())) { string typename = types[name.Substring(0, index).ToLower()]; foreach (NClass.Core.IEntity ie in Runtime.parent.projectCore.Entities) { if (ie.Name.ToLower().Equals(typename.ToLower())) { if (ie is NClass.Core.CompositeType) { NClass.Core.CompositeType ct = ie as NClass.Core.CompositeType; return(Suggestions(ct, name.Substring(index + 1), false)); } else if (ie is NClass.Core.EnumType) { } } } } } return(0); }