コード例 #1
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);
        }