protected virtual void CompressSourceToStream(IO.EndianWriter blockStream, Stream sourceFile) { // Read the source bytes byte[] buffer = new byte[sourceFile.Length]; for (int x = 0; x < buffer.Length;) { int n = sourceFile.Read(buffer, x, buffer.Length - x); x += n; } // Compress the source bytes into a new buffer byte[] result = ResourceUtils.Compress(buffer, out Adler32); // Also update this ECF's checksum DataSize = result.Length; // Update this ECF's size // Write the compressed bytes to the block stream blockStream.Write(result); }