Beispiel #1
0
        private void ReadSegmentTable(FileStream file)
        {
            // Read the segment table
            file.Seek(_mzHeader.offsetNEHeader + _neHeader.SegTableOffset, SeekOrigin.Begin);
            var me = EnterRegion("Segment Table");

            for (int i = 0; i < _neHeader.SegCount; i++)
            {
                var seg = new SegmentEntry();
                seg.Read(file);
                seg.offset = (1 << _neHeader.FileAlnSzShftCnt) * seg.offset;
                _segments.Add(seg);
                if (seg.lengthBytes > 0)
                {
                    _fileMap.Add(new MapEntry(seg.offset, seg.lengthBytes, string.Format("Segment {0}", i)));
                }
            }
            LeaveRegion(me);
        }
Beispiel #2
0
 public void ReadSegment(SegmentEntry seg, byte[] buffer)
 {
     // Read from disk
     _file.Seek(seg.offset, SeekOrigin.Begin);
     _file.Read(buffer, 0, seg.lengthBytes);
 }