public MetadataPartition(UdfContext context, LogicalVolumeDescriptor volumeDescriptor,
                                 MetadataPartitionMap partitionMap)
            : base(context, volumeDescriptor)
        {
            _partitionMap = partitionMap;

            PhysicalPartition physical = context.PhysicalPartitions[partitionMap.PartitionNumber];
            long fileEntryPos          = partitionMap.MetadataFileLocation * (long)volumeDescriptor.LogicalBlockSize;

            byte[] entryData = StreamUtilities.ReadExact(physical.Content, fileEntryPos, _context.PhysicalSectorSize);
            if (!DescriptorTag.IsValid(entryData, 0))
            {
                throw new IOException("Invalid descriptor tag looking for Metadata file entry");
            }

            DescriptorTag dt = EndianUtilities.ToStruct <DescriptorTag>(entryData, 0);

            if (dt.TagIdentifier == TagIdentifier.ExtendedFileEntry)
            {
                ExtendedFileEntry efe = EndianUtilities.ToStruct <ExtendedFileEntry>(entryData, 0);
                _metadataFile = new File(context, physical, efe, _volumeDescriptor.LogicalBlockSize);
            }
            else
            {
                throw new NotImplementedException("Only EFE implemented for Metadata file entry");
            }
        }
Exemple #2
0
 public Type1Partition(UdfContext context, LogicalVolumeDescriptor volumeDescriptor,
                       Type1PartitionMap partitionMap)
     : base(context, volumeDescriptor)
 {
     _partitionMap = partitionMap;
     _physical     = context.PhysicalPartitions[partitionMap.PartitionNumber];
 }