public ByteAccess FetchFrame(byte[] resourceData, uint frameNo)
{
uint frameFile = 0;
var idxData = Header.Size;
if (_isBigEndian)
{
if (frameNo >= resourceData.ToUInt32BigEndian(idxData))
throw new InvalidOperationException($"fetchFrame:: frame {frameNo} doesn't exist in resource.");
frameFile += resourceData.ToUInt32BigEndian((int)(idxData + (frameNo + 1) * 4));
}
else
{
if (frameNo >= resourceData.ToUInt32(idxData))
throw new InvalidOperationException($"fetchFrame:: frame {frameNo} doesn't exist in resource.");
frameFile += resourceData.ToUInt32((int)(idxData + (frameNo + 1) * 4));
}
return new ByteAccess(resourceData, (int)frameFile);
}