mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 03:44:13 +08:00
use Buffer.BlockCopy instead of Array.Copy.
This commit is contained in:
parent
3a2be63bf3
commit
2a7520939d
@ -700,7 +700,7 @@ namespace GameRes.Formats.NitroPlus
|
||||
if (position >= m_encrypted_length)
|
||||
return m_stream.Read (buffer, offset, 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);
|
||||
if (read < count)
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ namespace GameRes.Formats.RenPy
|
||||
if (m_position < m_header.Length)
|
||||
{
|
||||
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;
|
||||
read += header_count;
|
||||
offset += header_count;
|
||||
|
@ -201,7 +201,7 @@ namespace GameRes.Formats.Will
|
||||
header.Write (file_table.Count);
|
||||
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)
|
||||
buffer[i] = 0;
|
||||
header.Write (buffer, 0, 4);
|
||||
@ -212,7 +212,7 @@ namespace GameRes.Formats.Will
|
||||
{
|
||||
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)
|
||||
buffer[i] = 0;
|
||||
header.Write (buffer);
|
||||
|
@ -142,7 +142,7 @@ namespace GameRes.Formats.DRS
|
||||
return null;
|
||||
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;
|
||||
}
|
||||
pixel_count -= count * 3;
|
||||
@ -174,7 +174,7 @@ namespace GameRes.Formats.DRS
|
||||
src_offset = out_pos - 3 * input.ReadByte ();
|
||||
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
||||
return null;
|
||||
Array.Copy (output, src_offset, output, out_pos, count);
|
||||
Buffer.BlockCopy (output, src_offset, output, out_pos, count);
|
||||
out_pos += count;
|
||||
pixel_count -= count;
|
||||
break;
|
||||
@ -186,7 +186,7 @@ namespace GameRes.Formats.DRS
|
||||
src_offset = out_pos - 3 * (off_hi << 8 | off_lo);
|
||||
if (count > pixel_count || src_offset < 0 || src_offset == out_pos)
|
||||
return null;
|
||||
Array.Copy (output, src_offset, output, out_pos, count);
|
||||
Buffer.BlockCopy (output, src_offset, output, out_pos, count);
|
||||
out_pos += count;
|
||||
pixel_count -= count;
|
||||
break;
|
||||
|
@ -600,7 +600,7 @@ namespace GameRes.Formats.Kogado
|
||||
n++;
|
||||
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;
|
||||
}
|
||||
dest[i] = n;
|
||||
@ -616,7 +616,7 @@ namespace GameRes.Formats.Kogado
|
||||
byte c = m_MTFTable[n];
|
||||
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;
|
||||
}
|
||||
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
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion ("1.0.3.22")]
|
||||
[assembly: AssemblyFileVersion ("1.0.3.22")]
|
||||
[assembly: AssemblyVersion ("1.0.3.23")]
|
||||
[assembly: AssemblyFileVersion ("1.0.3.23")]
|
||||
|
@ -56,9 +56,7 @@ namespace GameRes
|
||||
break;
|
||||
if (buffer.Length == size)
|
||||
{
|
||||
byte[] new_buffer = new byte[checked(size/2*3)];
|
||||
Array.Copy (buffer, new_buffer, size);
|
||||
buffer = new_buffer;
|
||||
Array.Resize (ref buffer, checked(size/2*3));
|
||||
}
|
||||
buffer[size++] = (byte)b;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace GameRes.Utility
|
||||
{
|
||||
if (preceding > count)
|
||||
preceding = count;
|
||||
System.Array.Copy (data, src, data, dst, preceding);
|
||||
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
||||
src = dst;
|
||||
dst += preceding;
|
||||
count -= preceding;
|
||||
|
Loading…
x
Reference in New Issue
Block a user