public CurrentMethod(WindowsPdbWriter pdbWriter, MethodDef method, Dictionary <Instruction, uint> toOffset)
            {
                this.pdbWriter = pdbWriter;
                Method         = method;
                this.toOffset  = toOffset;
                toOffset.Clear();
                uint offset       = 0;
                var  instructions = method.Body.Instructions;
                int  count        = instructions.Count;

                for (int i = 0; i < count; i++)
                {
                    var instr = instructions[i];
                    toOffset[instr] = offset;
                    offset         += (uint)instr.GetSize();
                }
                BodySize = offset;
            }
            public void Write(WindowsPdbWriter pdbWriter, IList <Instruction> instrs)
            {
                checkedPdbDocs.Clear();
                while (true)
                {
                    PdbDocument currPdbDoc = null;
                    bool        otherDocsAvailable = false;
                    int         index = 0, instrOffset = 0;
                    Instruction instr = null;
                    for (int i = 0; i < instrs.Count; i++, instrOffset += instr.GetSize())
                    {
                        instr = instrs[i];
                        var seqp = instr.SequencePoint;
                        if (seqp == null || seqp.Document == null)
                        {
                            continue;
                        }
                        if (checkedPdbDocs.ContainsKey(seqp.Document))
                        {
                            continue;
                        }
                        if (currPdbDoc == null)
                        {
                            currPdbDoc = seqp.Document;
                        }
                        else if (currPdbDoc != seqp.Document)
                        {
                            otherDocsAvailable = true;
                            continue;
                        }

                        if (index >= instrOffsets.Length)
                        {
                            int newSize = index * 2;
                            if (newSize < 64)
                            {
                                newSize = 64;
                            }
                            Array.Resize(ref instrOffsets, newSize);
                            Array.Resize(ref startLines, newSize);
                            Array.Resize(ref startColumns, newSize);
                            Array.Resize(ref endLines, newSize);
                            Array.Resize(ref endColumns, newSize);
                        }

                        instrOffsets[index] = instrOffset;
                        startLines[index]   = seqp.StartLine;
                        startColumns[index] = seqp.StartColumn;
                        endLines[index]     = seqp.EndLine;
                        endColumns[index]   = seqp.EndColumn;
                        index++;
                    }
                    if (index != 0)
                    {
                        pdbWriter.writer.DefineSequencePoints(pdbWriter.Add(currPdbDoc), (uint)index, instrOffsets, startLines, startColumns, endLines, endColumns);
                    }

                    if (!otherDocsAvailable)
                    {
                        break;
                    }
                    if (currPdbDoc != null)
                    {
                        checkedPdbDocs.Add(currPdbDoc, true);
                    }
                }
            }