changed getblock function to just check beginning of block

This commit is contained in:
mm00
2025-05-08 18:15:20 +02:00
parent 679f15bce0
commit eb76262e42

View File

@@ -49,12 +49,22 @@ public class Reader {
/// </summary>
/// <param name="memAddr">memory address in current system endianness</param>
/// <returns>A <see cref="Kaitai.BlendFile.FileBlock"/> object</returns>
/*
public FileBlock? GetBlock(long memAddr) {
var blocks = OrderedBlocks.Where(x =>
memAddr >= x.MemAddr.ToPointer() && memAddr < x.MemAddr.ToPointer() + x.LenBody);
return blocks.MaxBy(x => x.LenBody);
}
*/
public FileBlock? GetBlock(long memAddr)
{
return OrderedBlocks.FirstOrDefault(x => x.MemAddr.ToMemAddr() == memAddr);
}
/// <summary>
/// Creates a new instance of the <see cref="Reader"/> class