Beispiel #1
0
        internal DynamicDiskGroup(VirtualDisk disk)
        {
            _disks = new Dictionary <Guid, DynamicDisk>();

            DynamicDisk dynDisk = new DynamicDisk(disk);

            _database = dynDisk.Database;
            _disks.Add(dynDisk.Id, dynDisk);
            _record = dynDisk.Database.GetDiskGroup(dynDisk.GroupId);
        }
Beispiel #2
0
        internal DiskGroupRecord GetDiskGroup(Guid guid)
        {
            foreach (var record in _records.Values)
            {
                if (record.RecordType == RecordType.DiskGroup)
                {
                    DiskGroupRecord dgRecord = (DiskGroupRecord)record;
                    if (new Guid(dgRecord.GroupGuidString) == guid)
                    {
                        return(dgRecord);
                    }
                }
            }

            return(null);
        }
Beispiel #3
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);
        }