(IndexReader): clear entries list and path before parsing.

This commit is contained in:
morkt 2015-10-25 01:21:11 +04:00
parent d8a1109ddb
commit 1ddb25ec3d

View File

@ -83,6 +83,8 @@ namespace GameRes.Formats.Bishop
{ {
m_file.View.Reserve (index_offset, (uint)(m_file.MaxOffset - index_offset)); m_file.View.Reserve (index_offset, (uint)(m_file.MaxOffset - index_offset));
m_dir.Capacity = count; m_dir.Capacity = count;
m_dir.Clear();
m_path.Clear();
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
string name = m_file.View.ReadString (index_offset, 0x20); string name = m_file.View.ReadString (index_offset, 0x20);
@ -117,6 +119,8 @@ namespace GameRes.Formats.Bishop
{ {
m_file.View.Reserve (index_offset, (uint)(m_file.MaxOffset - index_offset)); m_file.View.Reserve (index_offset, (uint)(m_file.MaxOffset - index_offset));
m_dir.Capacity = count; m_dir.Capacity = count;
m_dir.Clear();
m_path.Clear();
uint filenames_offset = index_offset + (uint)(count * 12); uint filenames_offset = index_offset + (uint)(count * 12);
byte[] names_buf = new byte[m_file.MaxOffset - filenames_offset]; byte[] names_buf = new byte[m_file.MaxOffset - filenames_offset];
m_file.View.Read (filenames_offset, names_buf, 0, (uint)names_buf.Length); m_file.View.Read (filenames_offset, names_buf, 0, (uint)names_buf.Length);