[ALL] Get rid of rest of non-library usings

This commit is contained in:
Matt Nadareski
2016-09-22 15:59:03 -07:00
parent 74fbe60686
commit 863e936d07
5 changed files with 196 additions and 316 deletions

View File

@@ -982,32 +982,37 @@ namespace SabreTools.Helper
return;
}
// Now get the hash of the stream
// Create the hashers
uint tempCrc;
using (OptimizedCRC crc = new OptimizedCRC())
using (MD5 md5 = System.Security.Cryptography.MD5.Create())
using (SHA1 sha1 = System.Security.Cryptography.SHA1.Create())
OptimizedCRC crc = new OptimizedCRC();
MD5 md5 = System.Security.Cryptography.MD5.Create();
SHA1 sha1 = System.Security.Cryptography.SHA1.Create();
// Now get the hash of the stream
BinaryReader fs = new BinaryReader(stream);
byte[] buffer = new byte[1024];
int read;
while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
{
BinaryReader fs = new BinaryReader(stream);
byte[] buffer = new byte[1024];
int read;
while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
{
crc.Update(buffer, 0, read);
md5.TransformBlock(buffer, 0, read, buffer, 0);
sha1.TransformBlock(buffer, 0, read, buffer, 0);
}
crc.Update(buffer, 0, 0);
md5.TransformFinalBlock(buffer, 0, 0);
sha1.TransformFinalBlock(buffer, 0, 0);
tempCrc = crc.UnsignedValue;
_md5 = md5.Hash;
_sha1 = sha1.Hash;
crc.Update(buffer, 0, read);
md5.TransformBlock(buffer, 0, read, buffer, 0);
sha1.TransformBlock(buffer, 0, read, buffer, 0);
}
crc.Update(buffer, 0, 0);
md5.TransformFinalBlock(buffer, 0, 0);
sha1.TransformFinalBlock(buffer, 0, 0);
tempCrc = crc.UnsignedValue;
_md5 = md5.Hash;
_sha1 = sha1.Hash;
// Dispose of the hashers
crc.Dispose();
md5.Dispose();
sha1.Dispose();
if (_compressionMethod == CompressionMethod.Deflated)
{
stream.Close();