private static void CopyCoverage(TypedefEntry dst, TypedefEntry src)
 {
     foreach (var el in src.Methods)
     {
         var srcEntry = el;
         var dstEntry = dst.Methods.Find(x => x.Name == srcEntry.Name && x.Signature == srcEntry.Signature);
         CopyCoverage(dstEntry, srcEntry);
     }
 }
        public TypedefEntry Copy(AssemblyEntry assembly)
        {
            var copy = new TypedefEntry
            {
                Assembly   = assembly,
                Name       = Name,
                Attributes = Attributes
            };

            copy.Methods = new List <MethodEntry>(Methods.ConvertAll(x => x.Copy(copy)));
            return(copy);
        }
Example #3
0
        public TypedefEntry Copy(AssemblyEntry assembly)
        {
            var copy = new TypedefEntry
            {
                Assembly = assembly,
                Name = Name,
                Attributes = Attributes
            };

            copy.Methods = new List<MethodEntry>(Methods.ConvertAll(x => x.Copy(copy)));
            return copy;
        }
Example #4
0
 public MethodEntry Copy(TypedefEntry type)
 {
     return(new MethodEntry
     {
         Type = type,
         Name = this.Name,
         Flags = this.Flags,
         BodySize = this.BodySize,
         ImplFlags = this.ImplFlags,
         Signature = this.Signature,
         MethodDef = this.MethodDef,
         Blocks = new List <MethodBlock>(Blocks.ConvertAll(x => x.Copy()))
     });
 }
Example #5
0
 public MethodEntry Copy(TypedefEntry type)
 {
     return new MethodEntry
     {
         Type = type,
         Name = this.Name,
         Flags = this.Flags,
         BodySize = this.BodySize,
         ImplFlags = this.ImplFlags,
         Signature = this.Signature,
         MethodDef = this.MethodDef,
         Blocks = new List<MethodBlock>(Blocks.ConvertAll(x => x.Copy()))
     };
 }
Example #6
0
        public static int ForType(TypedefEntry type)
        {
            var visibilityAndSemantic = Types.GetAccessAndSemantic(type.Attributes);
            if (Types.IsPrivate(type.Attributes))
            {
                var nested = type.Name.IndexOf('+');
                var generic = type.Name.IndexOf('<');
                if (nested == -1 || (generic != -1 && nested > generic))
                    visibilityAndSemantic |= TypeAttributes.NestedAssembly;
            }

            if (Types.IsValueType(type.Attributes))
            {
                visibilityAndSemantic |= TypeAttributes.LayoutMask;
            }

            int index;
            if (typeImages.TryGetValue(visibilityAndSemantic, out index))
                return index;

            return -1;
        }
 /// <summary>
 /// Called when receiving a report about a type
 /// </summary>
 /// <param name="typedefName"></param>
 /// <param name="flags"></param>
 public void EnterTypedef(string typedefName, uint flags)
 {
     currentAssembly.Types.Add(currentTypedef = new TypedefEntry
     {
         Assembly = currentAssembly,
         Name = typedefName,
         Attributes = (TypeAttributes)flags
     });
 }
Example #8
0
 public void Select(TypedefEntry typedef)
 {
     SelectionHandlers.ForEach(x => x.Select(typedef));
 }
        public static void Load(XmlElement node, Report report)
        {
            report.Date = ReadAttributeDate(node, "date");

            foreach (var dFile in SelectChildNodes(node, "file"))
            {
                report.Files.Add(new FileEntry
                {
                    Id = ReadAttributeInt(dFile, "id"),
                    PathUri = ReadAttribute(dFile, "url")
                });
            }

            foreach (var asmNode in SelectChildNodes(node, "assembly"))
            {
                report.Assemblies.Add(new AssemblyEntry
                {
                    AssemblyRef = ReadAttributeInt(asmNode, "id"),
                    Name = ReadAttribute(asmNode, "name"),
                    Module = ReadAttribute(asmNode, "module"),
                    Domain = ReadAttribute(asmNode, "domain"),
                    DomainIndex = ReadAttributeInt(asmNode, "domainIdx")
                });
            }

            foreach (var typeNode in SelectChildNodes(node, "type"))
            {
                var assmRef = ReadAttributeInt(typeNode, "asmref");
                var assemblyEntry = report.Assemblies.Find(x => x.AssemblyRef == assmRef);
                if (assemblyEntry == null)
                {
                    continue;
                }

                var typedefEntry = new TypedefEntry
                {
                    Name = ReadAttribute(typeNode, "name"),
                    Attributes = (TypeAttributes)ReadAttributeLong(typeNode, "flags"),
                    Assembly = assemblyEntry
                };
                assemblyEntry.Types.Add(typedefEntry);

                foreach (var methodNode in SelectChildNodes(typeNode, "method"))
                {
                    var methodEntry = new MethodEntry
                    {
                        Name = ReadAttribute(methodNode, "name"),
                        Signature = ReadAttribute(methodNode, "sig"),
                        BodySize = ReadAttributeInt(methodNode, "bodysize"),
                        Flags = (MethodAttributes)ReadAttributeLong(methodNode, "flags"),
                        ImplFlags = (MethodImplAttributes)ReadAttributeLong(methodNode, "iflags")
                    };
                    typedefEntry.Methods.Add(methodEntry);


                    foreach (var pointNode in SelectChildNodes(methodNode, "pt"))
                    {
                        methodEntry.Blocks.Add(new MethodBlock
                        {
                            VisitCount = ReadAttributeInt(pointNode, "visit"),
                            Offset = ReadAttributeInt(pointNode, "pos"),
                            Length = ReadAttributeInt(pointNode, "len"),
                            File = ReadAttributeInt(pointNode, "fid"),
                            Start = new Position
                            {
                                Column = ReadAttributeInt(pointNode, "sc"),
                                Line = ReadAttributeInt(pointNode, "sl")
                            },
                            End = new Position
                            {
                                Column = ReadAttributeInt(pointNode, "ec"),
                                Line = ReadAttributeInt(pointNode, "el")
                            }
                        });
                    }
                }
            }
        }
Example #10
0
 private static TreeNode GetNamespaceNode(AssemblyTreeNode asmNode, TypedefEntry iClass)
 {
     var names = Types.GetNamespaceChain(iClass.Name);
     TreeNode parentNode = asmNode;
     for (var i = 0; i < names.Length - 1; ++i)
     {
         var nextNode = FindNamespaceNode(parentNode.Nodes, names[i]);
         if (nextNode == null)
         {
             nextNode = new NamespaceTreeNode(asmNode.Assembly, names[i])
             {
                 NamespacePath = string.Join(".", names, 0, i + 1)
             };
             parentNode.Nodes.Add(nextNode);
         }
         parentNode = nextNode;
     }
     return parentNode;
 }
Example #11
0
 public void Select(TypedefEntry typedef)
 {
     rtbNodeProps.Rtf = string.Format(TYPEDEF_INFO, typedef.Name, typedef.Attributes);
 }
Example #12
0
 public void Select(TypedefEntry typedef)
 {
     Deselect();
 }