protected Stream GetLocalDataStreamInternal(IndexEntry idxInfo, MD5Hash key)
{
if (idxInfo == null)
throw new Exception("local index missing");
Stream dataStream = GetDataStream(idxInfo.Index);
dataStream.Position = idxInfo.Offset;
using (BinaryReader reader = new BinaryReader(dataStream, Encoding.ASCII, true))
{
byte[] md5 = reader.ReadBytes(16);
Array.Reverse(md5);
if (!key.EqualsTo(md5))
throw new Exception("local data corrupted");
int size = reader.ReadInt32();
if (size != idxInfo.Size)
throw new Exception("local data corrupted");
//byte[] unkData1 = reader.ReadBytes(2);
//byte[] unkData2 = reader.ReadBytes(8);
dataStream.Position += 10;
byte[] data = reader.ReadBytes(idxInfo.Size - 30);
return new MemoryStream(data);
}
}