コード例 #1
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));
        }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #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);
             }
         }
     }
 }
コード例 #5
0
ファイル: DatabaseRecord.cs プロジェクト: JGTM2016/discutils
        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;
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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;
        }
コード例 #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;
        }