private SparseStream OpenExtent(ExtentRecord extent)
        {
            DiskRecord disk = _database.GetDisk(extent.DiskId);

            DynamicDisk diskObj = _disks[new Guid(disk.DiskGuidString)];

            return(new SubStream(diskObj.Content, Ownership.None, (diskObj.DataOffset + extent.DiskOffsetLba) * Sizes.Sector, extent.SizeLba * Sizes.Sector));
        }
 private static int CompareExtentInterleaveOrder(ExtentRecord x, ExtentRecord y)
 {
     if (x.InterleaveOrder > y.InterleaveOrder)
     {
         return(1);
     }
     else if (x.InterleaveOrder < y.InterleaveOrder)
     {
         return(-1);
     }
     return(0);
 }
 private static int CompareExtentOffsets(ExtentRecord x, ExtentRecord y)
 {
     if (x.OffsetInVolumeLba > y.OffsetInVolumeLba)
     {
         return(1);
     }
     else if (x.OffsetInVolumeLba < y.OffsetInVolumeLba)
     {
         return(-1);
     }
     return(0);
 }
Esempio n. 4
0
 internal IEnumerable <ExtentRecord> GetComponentExtents(ulong componentId)
 {
     foreach (DatabaseRecord record in _records.Values)
     {
         if (record.RecordType == RecordType.Extent)
         {
             ExtentRecord extentRecord = (ExtentRecord)record;
             if (extentRecord.ComponentId == componentId)
             {
                 yield return(extentRecord);
             }
         }
     }
 }
Esempio n. 5
0
        public static DatabaseRecord ReadFrom(byte[] buffer, int offset)
        {
            DatabaseRecord result = null;

            if (Utilities.ToInt32BigEndian(buffer, offset + 0xC) != 0)
            {
                switch ((RecordType)(buffer[offset + 0x13] & 0xF))
                {
                    case RecordType.Volume:
                        result = new VolumeRecord();
                        break;

                    case RecordType.Component:
                        result = new ComponentRecord();
                        break;

                    case RecordType.Extent:
                        result = new ExtentRecord();
                        break;

                    case RecordType.Disk:
                        result = new DiskRecord();
                        break;

                    case RecordType.DiskGroup:
                        result = new DiskGroupRecord();
                        break;

                    default:
                        throw new NotImplementedException("Unrecognized record type: " + buffer[offset + 0x13]);
                }

                result.DoReadFrom(buffer, offset);
            }

            return result;
        }
Esempio n. 6
0
        public static DatabaseRecord ReadFrom(byte[] buffer, int offset)
        {
            DatabaseRecord result = null;

            if (Utilities.ToInt32BigEndian(buffer, offset + 0xC) != 0)
            {
                switch ((RecordType)(buffer[offset + 0x13] & 0xF))
                {
                case RecordType.Volume:
                    result = new VolumeRecord();
                    break;

                case RecordType.Component:
                    result = new ComponentRecord();
                    break;

                case RecordType.Extent:
                    result = new ExtentRecord();
                    break;

                case RecordType.Disk:
                    result = new DiskRecord();
                    break;

                case RecordType.DiskGroup:
                    result = new DiskGroupRecord();
                    break;

                default:
                    throw new NotImplementedException("Unrecognized record type: " + buffer[offset + 0x13]);
                }

                result.DoReadFrom(buffer, offset);
            }

            return(result);
        }
Esempio n. 7
0
        private SparseStream OpenExtent(ExtentRecord extent)
        {
            DiskRecord disk = _database.GetDisk(extent.DiskId);

            DynamicDisk diskObj = _disks[new Guid(disk.DiskGuidString)];

            return new SubStream(diskObj.Content, Ownership.None, (diskObj.DataOffset + extent.DiskOffsetLba) * Sizes.Sector, extent.SizeLba * Sizes.Sector);
        }
Esempio n. 8
0
        private static int CompareExtentOffsets(ExtentRecord x, ExtentRecord y)
        {
            if (x.OffsetInVolumeLba > y.OffsetInVolumeLba)
            {
                return 1;
            }
            else if (x.OffsetInVolumeLba < y.OffsetInVolumeLba)
            {
                return -1;
            }

            return 0;
        }
Esempio n. 9
0
        private static int CompareExtentInterleaveOrder(ExtentRecord x, ExtentRecord y)
        {
            if (x.InterleaveOrder > y.InterleaveOrder)
            {
                return 1;
            }
            else if (x.InterleaveOrder < y.InterleaveOrder)
            {
                return -1;
            }

            return 0;
        }