mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Quick sub array fix.
This commit is contained in:
parent
90e632326c
commit
edd47188fe
1 changed files with 5 additions and 1 deletions
|
@ -175,7 +175,11 @@ namespace Toolbox.Library
|
|||
|
||||
public static byte[] SubArray(byte[] data, uint offset, uint length)
|
||||
{
|
||||
return data.Slice(offset, length);
|
||||
//Slice only when the dst size is big enough for the src
|
||||
if (data.Length - offset >= length)
|
||||
return data.Slice(offset, length);
|
||||
else
|
||||
return data.Skip((int)offset).Take((int)length).ToArray();
|
||||
}
|
||||
|
||||
public static string RenameDuplicateString(List<string> strings, string oldString, int index = 0, int numDigits = 1)
|
||||
|
|
Loading…
Reference in a new issue