private static unsafe uint[] ReadBlockOffsets(MpqArchive archive, uint hash, long offset, int count)
{
int length = count * sizeof(uint);
var sharedBuffer = CommonMethods.GetSharedBuffer(length);
if (archive.ReadArchiveData(sharedBuffer, 0, offset, length) != length) throw new EndOfStreamException();
var offsets = new uint[count];
Buffer.BlockCopy(sharedBuffer, 0, offsets, 0, length);
if (!BitConverter.IsLittleEndian) CommonMethods.SwapBytes(offsets);
// If hash is valid, decode the header
if (hash != 0) unchecked { CommonMethods.Decrypt(offsets, hash - 1); }
return offsets;
}