mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-27 06:07:35 +08:00
(InputCryptoStream): new class derived from CryptoStream.
properly dispose transformations used by CryptoStream.
This commit is contained in:
@@ -137,4 +137,28 @@ namespace GameRes.Formats
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CryptoStream that disposes transformation object upon close.
|
||||
/// </summary>
|
||||
public class InputCryptoStream : CryptoStream
|
||||
{
|
||||
ICryptoTransform m_transform;
|
||||
|
||||
public InputCryptoStream (Stream input, ICryptoTransform transform)
|
||||
: base (input, transform, CryptoStreamMode.Read)
|
||||
{
|
||||
m_transform = transform;
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
base.Dispose (disposing);
|
||||
if (disposing && m_transform != null)
|
||||
{
|
||||
m_transform.Dispose();
|
||||
m_transform = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user