(AImageHeader): don't require input stream to be seekable.

This commit is contained in:
morkt 2016-07-07 14:44:19 +04:00
parent b99f0c7029
commit fa972916c3
2 changed files with 3 additions and 3 deletions

View File

@ -213,8 +213,7 @@ namespace GameRes.Formats.Cyberworks
int id = input.ReadByte(); int id = input.ReadByte();
if (id == scheme.Value2) if (id == scheme.Value2)
{ {
using (var seekable = new SeekableStream (input)) using (var reader = new AImageReader (input, scheme))
using (var reader = new AImageReader (seekable, scheme))
{ {
reader.Unpack(); reader.Unpack();
return TgaStream.Create (reader.Info, reader.Data, scheme.Flipped); return TgaStream.Create (reader.Info, reader.Data, scheme.Flipped);

View File

@ -116,12 +116,13 @@ namespace GameRes.Formats.Cyberworks
if (src_stride * (int)Info.Height != data_size) if (src_stride * (int)Info.Height != data_size)
throw new InvalidFormatException(); throw new InvalidFormatException();
m_output = new byte[dst_stride * (int)Info.Height]; m_output = new byte[dst_stride * (int)Info.Height];
var gap = new byte[src_stride-dst_stride];
int dst = 0; int dst = 0;
for (uint y = 0; y < Info.Height; ++y) for (uint y = 0; y < Info.Height; ++y)
{ {
m_input.Read (m_output, dst, dst_stride); m_input.Read (m_output, dst, dst_stride);
m_input.Read (gap, 0, gap.Length);
dst += dst_stride; dst += dst_stride;
m_input.BaseStream.Seek (src_stride-dst_stride, SeekOrigin.Current);
} }
} }
} }