private void build() { // set list data NamespaceData data = stack.Peek(); list.ItemsSource = data.CreateEntries(false); // build path name String name = null; foreach (NamespaceData d in stack) { if (d.name.Length == 0) { continue; // nothing to add (first one) } if (name == null) { name = d.name; } else { name = d.name + "." + name; } } PathName.Text = (name == null) ? " " : name; }
public NamespaceEntry(Type t) { this.is_namespace = false; this.namespace_ = null; this.klass = t; this.name = Utils.GetCompleteName(klass); // klass.Name; this.display_name = this.name.Replace("+", "."); if (t.IsEnum) { type_letter = "En"; } else if (t.IsInterface) { type_letter = "I"; } // else if (t.IsNested) type_letter = "Nes"; else if (name.Contains("+")) { type_letter = "I.C"; } else { type_letter = "C"; } this.desc = String.Format("{0} members, {1} methods", klass.GetMembers().Length, klass.GetMembers().Length); }
private void create_root() { // 1. load assemblies List <AssemblyEntry> entries = GetAssmblies(); List <Assembly> loaded = new List <Assembly>(); foreach (AssemblyEntry ae in entries) { try { if (ae.Enabled) { loaded.Add(Assembly.Load(ae.Name)); } } catch { } } // 2. load classes List <Type> classes = new List <Type>(); foreach (Assembly asm in loaded) { Type [] types = asm.GetTypes(); foreach (Type t in types) { if (!t.IsNotPublic) { if (t.IsClass || t.IsInterface || t.IsEnum) { classes.Add(t); } } } } // 3. create namespace root root = new NamespaceData(""); foreach (Type type in classes) { String name = type.FullName; NamespaceData pos = root.FindNamespaceFromClassName(name); pos.classes.Add(type); } // 4. and sort it! root.Sort(); }
// ------------------------------------------ private NamespaceData FindNamespaceFromClassName(String [] names, int offset, int count) { if (offset >= count) { return(this); } foreach (NamespaceData nd in namespaces) { if (nd.name == names[offset]) { return(nd.FindNamespaceFromClassName(names, offset + 1, count)); } } NamespaceData n2 = new NamespaceData(names[offset]); namespaces.Add(n2); return(n2.FindNamespaceFromClassName(names, offset + 1, count)); }
public NamespaceEntry(NamespaceData nd) { this.is_namespace = true; this.namespace_ = nd; this.klass = null; this.name = namespace_.name; this.display_name = this.name; this.type_letter = "N"; // int namespaces = namespace_.CountNamespaces(); int classes = namespace_.CountClasses(true); int outer_classes = namespace_.CountClasses(false); int inner_classes = classes - outer_classes; this.desc = String.Format("{0} namespaces, {1} classes", namespaces, outer_classes); if (inner_classes != 0) { this.desc += String.Format(", {0} inner classes", inner_classes); } }
public void Update() { // this forces root to be updated next time root = null; }
// ---------------------------------- private int CompareNamespaceData(NamespaceData n1, NamespaceData n2) { return(String.Compare(n1.name, n2.name)); }