public static TreeView ShowReport(CoverageReport report, TreeView tvItems) { tvItems.BeginUpdate(); if (report == null) { return(tvItems); } foreach (string assemblyName in ReportHelper.GetAssemblies(report)) { AssemblyNode asmNode = new AssemblyNode(assemblyName); tvItems.Nodes.Add(asmNode); foreach (CoverageReport.TypeDescriptor dType in ReportHelper.GetTypes(report, assemblyName)) { TreeNode namespaceNode = ReportTreeHelper.GetNamespaceNode(asmNode, dType.typeName); ClassNode classNode = new ClassNode(dType); namespaceNode.Nodes.Add(classNode); Dictionary <string, PropertyTreeNode> props = new Dictionary <string, PropertyTreeNode>(); foreach (CoverageReport.MethodDescriptor md in dType.methods) { if ((md.flags & 0x0800) == 0) { ReportTreeHelper.AddMethodNode(classNode, md); continue; } //has special meaning MdSpecial mdSpecial = DefineMdSpecial(md.methodName); string propName = ExtractProperty(mdSpecial, md.methodName); if (mdSpecial == MdSpecial.Unknown) { ReportTreeHelper.AddMethodNode(classNode, md); continue; } PropertyTreeNode propertyNode; if (!props.TryGetValue(propName, out propertyNode)) { propertyNode = new PropertyTreeNode(propName); props[propName] = propertyNode; classNode.Nodes.Add(propertyNode); } MethodNode mdNode = new MethodNode(md); switch (mdSpecial) { case MdSpecial.Get: case MdSpecial.Remove: propertyNode.Getter = mdNode; break; case MdSpecial.Set: case MdSpecial.Add: propertyNode.Setter = mdNode; break; } } foreach (KeyValuePair <string, PropertyTreeNode> kv in props) { if (kv.Value.Getter != null) { kv.Value.Nodes.Add(kv.Value.Getter); } if (kv.Value.Setter != null) { kv.Value.Nodes.Add(kv.Value.Setter); } } } asmNode.UpdateCoverageInfo(); } tvItems.EndUpdate(); return(tvItems); }
public static TreeView ShowReport(CoverageReport report, TreeView tvItems) { tvItems.BeginUpdate(); if (report == null) return tvItems; foreach (string assemblyName in ReportHelper.GetAssemblies(report)) { AssemblyNode asmNode = new AssemblyNode(assemblyName); tvItems.Nodes.Add(asmNode); foreach (CoverageReport.TypeDescriptor dType in ReportHelper.GetTypes(report, assemblyName)) { TreeNode namespaceNode = ReportTreeHelper.GetNamespaceNode(asmNode, dType.typeName); ClassNode classNode = new ClassNode(dType); namespaceNode.Nodes.Add(classNode); Dictionary<string, PropertyTreeNode> props = new Dictionary<string, PropertyTreeNode>(); foreach (CoverageReport.MethodDescriptor md in dType.methods) { if ((md.flags & 0x0800) == 0) { ReportTreeHelper.AddMethodNode(classNode, md); continue; } //has special meaning MdSpecial mdSpecial = DefineMdSpecial(md.methodName); string propName = ExtractProperty(mdSpecial, md.methodName); if (mdSpecial == MdSpecial.Unknown) { ReportTreeHelper.AddMethodNode(classNode, md); continue; } PropertyTreeNode propertyNode; if (!props.TryGetValue(propName, out propertyNode)) { propertyNode = new PropertyTreeNode(propName); props[propName] = propertyNode; classNode.Nodes.Add(propertyNode); } MethodNode mdNode = new MethodNode(md); switch (mdSpecial) { case MdSpecial.Get: case MdSpecial.Remove: propertyNode.Getter = mdNode; break; case MdSpecial.Set: case MdSpecial.Add: propertyNode.Setter = mdNode; break; } } foreach (KeyValuePair<string, PropertyTreeNode> kv in props) { if (kv.Value.Getter != null) kv.Value.Nodes.Add(kv.Value.Getter); if (kv.Value.Setter != null) kv.Value.Nodes.Add(kv.Value.Setter); } } asmNode.UpdateCoverageInfo(); } tvItems.EndUpdate(); return tvItems; }