private static bool isSame(byte[] buffer, ByteMask search) { for (int i = 0; i < search.Length(); i++) { if (!search.Mask[i]) { continue; } if (buffer[i] != search.Pattern[i]) { return(false); } } return(true); }
private static byte[] replaceBuffer(byte[] buffer, ByteMask replace) { byte[] replacedBuffer = new byte[buffer.Length]; for (int i = 0; i < replace.Length(); i++) { if (replace.Mask[i]) { replacedBuffer[i] = replace.Pattern[i]; } else { replacedBuffer[i] = buffer[i]; } } return(replacedBuffer); }