public void ReadRecords(FileStream fs, PVD pvd) { var address = LBA * pvd.LogicBlockSize; fs.Seek(address, SeekOrigin.Begin); int last = (int)DataLength; while (last > 0) { var rec = new DirectoryRecord(); rec.Parent = this; var p0 = fs.Position; if (!rec.Parse(fs, pvd)) { var l = pvd.LogicBlockSize - p0 % pvd.LogicBlockSize; if (l < 100) { continue; } break; } Records.Add(rec); var p1 = fs.Position; var len = p1 - p0; last -= (int)len; } }
public void Parse(FileStream fs) { Address = fs.Position; byte[] pvd = new byte[0x800]; fs.Read(pvd, 0, 0x800); Type = pvd[0]; var lbs = BitConverter.ToUInt16(pvd, 128); fs.Seek(Address + 156, SeekOrigin.Begin); RootDir = new DirectoryRecord(); RootDir.Parse(fs, this); LogicBlockSize = lbs; fs.Seek(Address + 0x800, SeekOrigin.Begin); }