Example #1
0
        private IBuffer GetExtentBuffer(long targetPos, out long streamStartPos)
        {
            AttributeRecord rec = null;

            if (_attribute.Extents.Count == 1)
            {
                // Handled as a special case, because sometimes _file can be null (for diagnostics)
                rec            = _attribute.LastExtent;
                streamStartPos = 0;
            }
            else
            {
                long bytesPerCluster = _file.Context.BiosParameterBlock.BytesPerCluster;
                long vcn             = targetPos / bytesPerCluster;

                NonResidentAttributeRecord nonResident = _attribute.GetNonResidentExtent(vcn);
                streamStartPos = nonResident.StartVcn * bytesPerCluster;
                rec            = nonResident;
            }

            return(rec.GetDataBuffer(_file));
        }