/// <summary> /// Loads header part 1 from a file stream. /// </summary> /// <param name="file">The file stream to load from.</param> /// <param name="offset">The absolute offset into the file where part 1 starts.</param> /// <param name="size">The size of part 1 in bytes.</param> /// <param name="p">Progress info.</param> internal NefsHeaderPt1(FileStream file, UInt32 offset, UInt32 size, NefsProgressInfo p) { _offset = offset; _size = size; /* Validate inputs */ if (size == 0) { log.Warn("Header part 1 has a size of 0."); return; } UInt32 nextEntry = offset; UInt32 lastEntry = offset + size - NefsHeaderPt1Entry.SIZE; UInt32 numEntries = size / NefsHeaderPt1Entry.SIZE; /* Load each entry */ while (nextEntry <= lastEntry) { p.BeginTask(1.0f / (float)numEntries); var entry = new NefsHeaderPt1Entry(file, nextEntry); _entries.Add(entry); nextEntry += NefsHeaderPt1Entry.SIZE; p.EndTask(); } }
/// <summary> /// Gets a Part 2 entry corresponding to the specified Part 1 entry. /// </summary> /// <param name="pt1Entry">The Part 1 entry to get the matching Part 2 entry for.</param> public NefsHeaderPt2Entry GetEntry(NefsHeaderPt1Entry pt1Entry) { return(GetEntry(pt1Entry.Id, pt1Entry.OffsetIntoPt2)); }