mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
use Buffer.BlockCopy instead of Array.Copy.
This commit is contained in:
@@ -700,7 +700,7 @@ namespace GameRes.Formats.NitroPlus
|
|||||||
if (position >= m_encrypted_length)
|
if (position >= m_encrypted_length)
|
||||||
return m_stream.Read (buffer, offset, count);
|
return m_stream.Read (buffer, offset, count);
|
||||||
int read = Math.Min (m_encrypted_length - (int)position, count);
|
int read = Math.Min (m_encrypted_length - (int)position, count);
|
||||||
Array.Copy (m_encrypted.Value, (int)position, buffer, offset, read);
|
Buffer.BlockCopy (m_encrypted.Value, (int)position, buffer, offset, read);
|
||||||
m_stream.Seek (read, SeekOrigin.Current);
|
m_stream.Seek (read, SeekOrigin.Current);
|
||||||
if (read < count)
|
if (read < count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -893,7 +893,7 @@ namespace GameRes.Formats.RenPy
|
|||||||
if (m_position < m_header.Length)
|
if (m_position < m_header.Length)
|
||||||
{
|
{
|
||||||
int header_count = Math.Min (count, m_header.Length - (int)m_position);
|
int header_count = Math.Min (count, m_header.Length - (int)m_position);
|
||||||
Array.Copy (m_header, (int)m_position, buffer, offset, header_count);
|
Buffer.BlockCopy (m_header, (int)m_position, buffer, offset, header_count);
|
||||||
m_position += header_count;
|
m_position += header_count;
|
||||||
read += header_count;
|
read += header_count;
|
||||||
offset += header_count;
|
offset += header_count;
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ namespace GameRes.Formats.Will
|
|||||||
header.Write (file_table.Count);
|
header.Write (file_table.Count);
|
||||||
foreach (var ext in file_table)
|
foreach (var ext in file_table)
|
||||||
{
|
{
|
||||||
Array.Copy (ext.Value.Extension, buffer, ext.Value.Extension.Length);
|
Buffer.BlockCopy (ext.Value.Extension, 0, buffer, 0, ext.Value.Extension.Length);
|
||||||
for (int i = ext.Value.Extension.Length; i < 4; ++i)
|
for (int i = ext.Value.Extension.Length; i < 4; ++i)
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
header.Write (buffer, 0, 4);
|
header.Write (buffer, 0, 4);
|
||||||
@@ -212,7 +212,7 @@ namespace GameRes.Formats.Will
|
|||||||
{
|
{
|
||||||
foreach (var entry in ext.Value.Files)
|
foreach (var entry in ext.Value.Files)
|
||||||
{
|
{
|
||||||
Array.Copy (entry.RawName, buffer, entry.RawName.Length);
|
Buffer.BlockCopy (entry.RawName, 0, buffer, 0, entry.RawName.Length);
|
||||||
for (int i = entry.RawName.Length; i < buffer.Length; ++i)
|
for (int i = entry.RawName.Length; i < buffer.Length; ++i)
|
||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
header.Write (buffer);
|
header.Write (buffer);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace GameRes.Formats.DRS
|
|||||||
return null;
|
return null;
|
||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
Array.Copy (output, src_offset, output, out_pos, 3);
|
Buffer.BlockCopy (output, src_offset, output, out_pos, 3);
|
||||||
out_pos += 3;
|
out_pos += 3;
|
||||||
}
|
}
|
||||||
pixel_count -= count * 3;
|
pixel_count -= count * 3;
|
||||||
@@ -174,7 +174,7 @@ namespace GameRes.Formats.DRS
|
|||||||
src_offset = out_pos - 3 * input.ReadByte ();
|
src_offset = out_pos - 3 * input.ReadByte ();
|
||||||
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
||||||
return null;
|
return null;
|
||||||
Array.Copy (output, src_offset, output, out_pos, count);
|
Buffer.BlockCopy (output, src_offset, output, out_pos, count);
|
||||||
out_pos += count;
|
out_pos += count;
|
||||||
pixel_count -= count;
|
pixel_count -= count;
|
||||||
break;
|
break;
|
||||||
@@ -186,7 +186,7 @@ namespace GameRes.Formats.DRS
|
|||||||
src_offset = out_pos - 3 * (off_hi << 8 | off_lo);
|
src_offset = out_pos - 3 * (off_hi << 8 | off_lo);
|
||||||
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
||||||
return null;
|
return null;
|
||||||
Array.Copy (output, src_offset, output, out_pos, count);
|
Buffer.BlockCopy (output, src_offset, output, out_pos, count);
|
||||||
out_pos += count;
|
out_pos += count;
|
||||||
pixel_count -= count;
|
pixel_count -= count;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -600,7 +600,7 @@ namespace GameRes.Formats.Kogado
|
|||||||
n++;
|
n++;
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
Array.Copy (m_MTFTable, 0, m_MTFTable, 1, n);
|
Buffer.BlockCopy (m_MTFTable, 0, m_MTFTable, 1, n);
|
||||||
m_MTFTable[0] = c;
|
m_MTFTable[0] = c;
|
||||||
}
|
}
|
||||||
dest[i] = n;
|
dest[i] = n;
|
||||||
@@ -616,7 +616,7 @@ namespace GameRes.Formats.Kogado
|
|||||||
byte c = m_MTFTable[n];
|
byte c = m_MTFTable[n];
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
Array.Copy (m_MTFTable, 0, m_MTFTable, 1, n);
|
Buffer.BlockCopy (m_MTFTable, 0, m_MTFTable, 1, n);
|
||||||
m_MTFTable[0] = c;
|
m_MTFTable[0] = c;
|
||||||
}
|
}
|
||||||
dest[i] = c;
|
dest[i] = c;
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion ("1.0.3.22")]
|
[assembly: AssemblyVersion ("1.0.3.23")]
|
||||||
[assembly: AssemblyFileVersion ("1.0.3.22")]
|
[assembly: AssemblyFileVersion ("1.0.3.23")]
|
||||||
|
|||||||
@@ -56,9 +56,7 @@ namespace GameRes
|
|||||||
break;
|
break;
|
||||||
if (buffer.Length == size)
|
if (buffer.Length == size)
|
||||||
{
|
{
|
||||||
byte[] new_buffer = new byte[checked(size/2*3)];
|
Array.Resize (ref buffer, checked(size/2*3));
|
||||||
Array.Copy (buffer, new_buffer, size);
|
|
||||||
buffer = new_buffer;
|
|
||||||
}
|
}
|
||||||
buffer[size++] = (byte)b;
|
buffer[size++] = (byte)b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace GameRes.Utility
|
|||||||
{
|
{
|
||||||
if (preceding > count)
|
if (preceding > count)
|
||||||
preceding = count;
|
preceding = count;
|
||||||
System.Array.Copy (data, src, data, dst, preceding);
|
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
||||||
src = dst;
|
src = dst;
|
||||||
dst += preceding;
|
dst += preceding;
|
||||||
count -= preceding;
|
count -= preceding;
|
||||||
|
|||||||
Reference in New Issue
Block a user