mirror of
https://github.com/kwsch/NLSE.git
synced 2026-03-21 17:55:06 -05:00
Use offset as a variable in the search
Makes the search not repeat itself.
This commit is contained in:
parent
bfd7aef6be
commit
8649dd958f
|
|
@ -91,8 +91,8 @@ internal static void ReplaceAllBytes(byte[] array, byte[] oldPattern, byte[] new
|
|||
{
|
||||
if (oldPattern.Length != newPattern.Length || oldPattern.SequenceEqual(newPattern))
|
||||
return;
|
||||
int offset; // Loop until no instances of oldPattern are found
|
||||
while ((offset = IndexOfBytes(array, oldPattern, 0, 0)) != -1)
|
||||
int offset = 0; // Loop until no instances of oldPattern are found
|
||||
while ((offset = IndexOfBytes(array, oldPattern, offset, 0)) != -1)
|
||||
Array.Copy(newPattern, 0, array, offset, newPattern.Length);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user