mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
(PrefixStream): don't seek over unseekable streams.
This commit is contained in:
parent
632d4b4602
commit
526904af29
@ -106,6 +106,8 @@ namespace GameRes.Formats
|
||||
get { return m_position; }
|
||||
set
|
||||
{
|
||||
if (!m_stream.CanSeek)
|
||||
throw new NotSupportedException ("Underlying stream does not support Stream.Position property");
|
||||
m_position = Math.Max (value, 0);
|
||||
if (m_position > m_header.Length)
|
||||
{
|
||||
@ -146,7 +148,7 @@ namespace GameRes.Formats
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
if (m_header.Length == m_position)
|
||||
if (m_header.Length == m_position && m_stream.CanSeek)
|
||||
m_stream.Position = 0;
|
||||
int stream_read = m_stream.Read (buffer, offset, count);
|
||||
m_position += stream_read;
|
||||
@ -159,7 +161,7 @@ namespace GameRes.Formats
|
||||
{
|
||||
if (m_position < m_header.Length)
|
||||
return m_header[m_position++];
|
||||
if (m_position == m_header.Length)
|
||||
if (m_position == m_header.Length && m_stream.CanSeek)
|
||||
m_stream.Position = 0;
|
||||
int b = m_stream.ReadByte();
|
||||
if (-1 != b)
|
||||
|
Loading…
Reference in New Issue
Block a user