private bool compareByteArrays(sequence _sequence, byte[] dataArray, int dataOffset) { byte[] sequenceArray = _sequence.byteSequence; int offset = _sequence.offset; if (dataArray.Length - dataOffset > sequenceArray.Length) { for (int i = 0; i < sequenceArray.Length; i++) { if (i == offset) { i += 3; continue; } if (sequenceArray[i] != dataArray[dataOffset + i]) { return(false); } } return(true); } return(false); }
private int findSequence(byte[] source, sequence _sequence) { for (int tempAdress = 0; tempAdress < source.Length; tempAdress++) { if (compareByteArrays(_sequence, source, tempAdress)) { return(tempAdress + _sequence.offset); } } return(-1); }