private void ReadDirRecord(IsoRecord record) { byte len = ReadByte(); // Some CDs can have incorrect value len = 48 ('0') in VolumeDescriptor. // But maybe we must use real "len" for other records. len = 34; ReadDirRecord(record, len); }
private void ReadDirRecord(IsoRecord record, byte length) { record.ExtendedAttributeRecordLen = ReadByte(); if (record.ExtendedAttributeRecordLen != 0) throw new InvalidDataException(); record._location = ReadInt64(); record.DataLength = ReadInt64(); ReadRecordingDateTime(record._DateTime); record.Flags = ReadByte(); record.FileUnitSize = ReadByte(); record.InterleaveGapSize = ReadByte(); record.VolSequenceNumber = ReadInt32(); byte idLen = ReadByte(); record.FileId = new byte[idLen]; ReadBytes(record.FileId, idLen); int padSize = 1 - (idLen & 1); Skeep(1 - ((int)idLen & 1)); // it's bug in some cd's. Must be zeros int curPos = 33 + idLen + padSize; if (curPos > length) throw new InvalidDataException(); int rem = length - curPos; record.SystemUse = new byte[rem]; ReadBytes(record.SystemUse, rem); }
private IsoReader() { _rootDirectory = new IsoRecord(); _volumeDescriptor = new List<VolumeDescriptor>(); }
private void ReadDir(IsoRecord record, int level) { record.IsJoliet = IsJoliet; if (!record.IsDirectory) return; SeekToBlock(record.Location); long startPos = _currentPosition; bool firstItem = true; for (; ; ) { long offset = _currentPosition - startPos; if (offset >= record.DataLength) break; byte len = ReadByte(); if (len == 0) continue; IsoRecord subItem = new IsoRecord(); subItem._Parent = record; ReadDirRecord(subItem, len); if (firstItem && level == 0) IsSusp = subItem.CheckSusp(SuspSkipSize); if (!subItem.IsSystemItem) { record.SubItems.Add(subItem); } firstItem = false; } for (int i = 0; i < record.SubItems.Count; i++) ReadDir(record.SubItems[i] as IsoRecord, level + 1); }