mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
(PrefixStream): added leave_open argument to constructor.
This commit is contained in:
parent
115ac939f5
commit
8e405e8fe6
@ -83,11 +83,13 @@ namespace GameRes.Formats
|
||||
byte[] m_header;
|
||||
Stream m_stream;
|
||||
long m_position = 0;
|
||||
bool m_should_dispose;
|
||||
|
||||
public PrefixStream (byte[] header, Stream main)
|
||||
public PrefixStream (byte[] header, Stream main, bool leave_open = false)
|
||||
{
|
||||
m_header = header;
|
||||
m_stream = main;
|
||||
m_should_dispose = !leave_open;
|
||||
}
|
||||
|
||||
public override bool CanRead { get { return m_stream.CanRead; } }
|
||||
@ -180,7 +182,7 @@ namespace GameRes.Formats
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
if (disposing)
|
||||
if (m_should_dispose && disposing)
|
||||
m_stream.Dispose();
|
||||
disposed = true;
|
||||
base.Dispose (disposing);
|
||||
|
Loading…
Reference in New Issue
Block a user