mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 12:33:12 +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