public CommonVolumeDescriptor(byte[] src, int offset, Encoding enc) : base(src, offset) { CharacterEncoding = enc; SystemIdentifier = IsoUtilities.ReadChars(src, offset + 8, 32, CharacterEncoding); VolumeIdentifier = IsoUtilities.ReadChars(src, offset + 40, 32, CharacterEncoding); VolumeSpaceSize = IsoUtilities.ToUInt32FromBoth(src, offset + 80); VolumeSetSize = IsoUtilities.ToUInt16FromBoth(src, offset + 120); VolumeSequenceNumber = IsoUtilities.ToUInt16FromBoth(src, offset + 124); LogicalBlockSize = IsoUtilities.ToUInt16FromBoth(src, offset + 128); PathTableSize = IsoUtilities.ToUInt32FromBoth(src, offset + 132); TypeLPathTableLocation = Utilities.ToUInt32LittleEndian(src, offset + 140); OptionalTypeLPathTableLocation = Utilities.ToUInt32LittleEndian(src, offset + 144); TypeMPathTableLocation = Utilities.BitSwap(Utilities.ToUInt32LittleEndian(src, offset + 148)); OptionalTypeMPathTableLocation = Utilities.BitSwap(Utilities.ToUInt32LittleEndian(src, offset + 152)); DirectoryRecord.ReadFrom(src, offset + 156, CharacterEncoding, out RootDirectory); VolumeSetIdentifier = IsoUtilities.ReadChars(src, offset + 190, 318 - 190, CharacterEncoding); PublisherIdentifier = IsoUtilities.ReadChars(src, offset + 318, 446 - 318, CharacterEncoding); DataPreparerIdentifier = IsoUtilities.ReadChars(src, offset + 446, 574 - 446, CharacterEncoding); ApplicationIdentifier = IsoUtilities.ReadChars(src, offset + 574, 702 - 574, CharacterEncoding); CopyrightFileIdentifier = IsoUtilities.ReadChars(src, offset + 702, 739 - 702, CharacterEncoding); AbstractFileIdentifier = IsoUtilities.ReadChars(src, offset + 739, 776 - 739, CharacterEncoding); BibliographicFileIdentifier = IsoUtilities.ReadChars(src, offset + 776, 813 - 776, CharacterEncoding); CreationDateAndTime = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 813); ModificationDateAndTime = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 830); ExpirationDateAndTime = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 847); EffectiveDateAndTime = IsoUtilities.ToDateTimeFromVolumeDescriptorTime(src, offset + 864); FileStructureVersion = src[offset + 881]; }
public static int ReadFrom(byte[] src, int offset, Encoding enc, out DirectoryRecord record) { int length = src[offset + 0]; record = new DirectoryRecord(); record.ExtendedAttributeRecordLength = src[offset + 1]; record.LocationOfExtent = IsoUtilities.ToUInt32FromBoth(src, offset + 2); record.DataLength = IsoUtilities.ToUInt32FromBoth(src, offset + 10); record.RecordingDateAndTime = IsoUtilities.ToUTCDateTimeFromDirectoryTime(src, offset + 18); record.Flags = (FileFlags)src[offset + 25]; record.FileUnitSize = src[offset + 26]; record.InterleaveGapSize = src[offset + 27]; record.VolumeSequenceNumber = IsoUtilities.ToUInt16FromBoth(src, offset + 28); byte lengthOfFileIdentifier = src[offset + 32]; record.FileIdentifier = IsoUtilities.ReadChars(src, offset + 33, lengthOfFileIdentifier, enc); int padding = (lengthOfFileIdentifier & 1) == 0 ? 1 : 0; int startSystemArea = lengthOfFileIdentifier + padding + 33; int lenSystemArea = length - startSystemArea; if (lenSystemArea > 0) { record.SystemUseData = new byte[lenSystemArea]; Array.Copy(src, offset + startSystemArea, record.SystemUseData, 0, lenSystemArea); } return(length); }