int WriteToBuffer(Hash hash, Block block)
{
if (WriteBuffer.Length + block.Length > Settings.MaxZipEntrySize) {
FlushBuffer(false);
}
HashSource hashSource = new HashSource() {
Hash = hash,
Path = -1,
Offset = (int)WriteBuffer.Length,
Length = block.Length,
};
WriteBuffer.Write(block.Buffer, block.Offset, block.Length);
hashes.Add(hashSource);
int hashIndex = hashes.Count - 1;
HashIndexesForPatching.Add(hashIndex);
return hashIndex;
}