public static float GetBlockCoverage(MethodBlock block) { return block.Length == 0 || block.VisitCount > 0 ? 1 : 0; }
/// <summary> /// Called when receiving a report about a method /// </summary> /// <param name="methodName"></param> /// <param name="methodSig"></param> /// <param name="bodySize"></param> /// <param name="flags"></param> /// <param name="implFlags"></param> /// <param name="symbolFileId"></param> /// <param name="methodDef"></param> public void EnterMethod(string methodName, string methodSig, int bodySize, uint flags, uint implFlags, int symbolFileId, int methodDef) { currentTypedef.Methods.Add(currentMethod = new MethodEntry { Type = currentTypedef, Name = methodName, Signature = methodSig, BodySize = bodySize, MethodDef = methodDef, Flags = (MethodAttributes)flags, ImplFlags = (MethodImplAttributes)implFlags }); if (_symbolReader != null) { var token = new SymbolToken(methodDef); ISymbolMethod method; try { method = _symbolReader.GetMethod(token); var count = method.SequencePointCount; int[] offsets = new int[count]; int[] sls = new int[count]; int[] scs = new int[count]; int[] els = new int[count]; int[] ecs = new int[count]; ISymbolDocument[] docs = new ISymbolDocument[count]; method.GetSequencePoints(offsets, docs, sls, scs, els, ecs); for (int i = 0; i < count; i++) { MethodBlock block = new MethodBlock(); block.Offset = offsets[i]; var fileId = GetFileIdentifier(docs[i].URL); if (fileId > 0 && sls[i] != 0xFEEFEE) { block.Start = new Position { Column = scs[i], Line = sls[i] }; block.End = new Position { Column = ecs[i], Line = els[i] }; block.File = fileId; } currentMethod.Blocks.Add(block); } docs = null; } catch (Exception ex) { } finally { method = null; } } }
public BlockStylizer(MethodBlock[] points) { this.points = points; }