mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 20:39:29 +08:00
(Ai6Opener): use Array.IndexOf instead of manual loop.
This commit is contained in:
parent
1d7369a2e4
commit
e711993eb7
@ -51,7 +51,7 @@ namespace GameRes.Formats.Silky
|
|||||||
if (!IsSaneCount (count))
|
if (!IsSaneCount (count))
|
||||||
return null;
|
return null;
|
||||||
long index_offset = 4;
|
long index_offset = 4;
|
||||||
uint index_size = (uint)(count * (0x104 + 8));
|
uint index_size = (uint)(count * (0x104 + 12));
|
||||||
if (index_size > file.View.Reserve (index_offset, index_size))
|
if (index_size > file.View.Reserve (index_offset, index_size))
|
||||||
return null;
|
return null;
|
||||||
var name_buffer = new byte[0x104];
|
var name_buffer = new byte[0x104];
|
||||||
@ -59,11 +59,11 @@ namespace GameRes.Formats.Silky
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
file.View.Read (index_offset, name_buffer, 0, (uint)name_buffer.Length);
|
file.View.Read (index_offset, name_buffer, 0, (uint)name_buffer.Length);
|
||||||
int name_length = 0;
|
int name_length = Array.IndexOf<byte> (name_buffer, 0);
|
||||||
while (name_length < name_buffer.Length && 0 != name_buffer[name_length])
|
|
||||||
++name_length;
|
|
||||||
if (0 == name_length)
|
if (0 == name_length)
|
||||||
return null;
|
return null;
|
||||||
|
if (-1 == name_length)
|
||||||
|
name_length = name_buffer.Length;
|
||||||
byte key = (byte)(name_length+1);
|
byte key = (byte)(name_length+1);
|
||||||
for (int j = 0; j < name_length; ++j)
|
for (int j = 0; j < name_length; ++j)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user