コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }