private static bool Find_Offset(byte[] hexNumber, byte[] hexNumber2, int offset, long location, byte[] data)
 {
     if (BinSearch.Find(hexNumber, location, data) && location + (long)offset + (long)hexNumber2.Length < (long)data.Length)
     {
         return(BinSearch.Find(hexNumber2, location + (long)offset, data));
     }
     return(false);
 }
        /// <summary>
        /// Searched through 'data' for the givenBytes.
        /// </summary>
        /// <param name="startLocation">Where to start in 'data'</param>
        /// <param name="givenBytes">the stuff to look for</param>
        /// <param name="data">the big data to look through</param>
        /// <returns>location of the givenBytes, -1L if not found.</returns>
        public static long GetLocationOfGivenBytes(long startLocation, byte[] givenBytes, byte[] data)
        {
            long num = (long)(data.Length - givenBytes.Length);

            for (long location = startLocation; location < num; ++location)
            {
                if (BinSearch.Find(givenBytes, location, data))
                {
                    return(location);
                }
            }
            return(-1L);
        }
        public static List <long> GetLocationsOfGivenBytes(long startLocation, byte[] givenBytes, byte[] data)
        {
            List <long> retVal = new List <long>();
            long        num    = (long)(data.Length - givenBytes.Length);

            for (long location = startLocation; location < num; ++location)
            {
                if (BinSearch.Find(givenBytes, location, data))
                {
                    retVal.Add(location);
                    location += givenBytes.Length;
                }
            }
            return(retVal);
        }
 /// <summary>
 /// Searched through 'data' for the givenBytes going backwards.
 /// </summary>
 /// <param name="startLocation">Where to start in 'data'</param>
 /// <param name="givenBytes">the stuff to look for</param>
 /// <param name="data">the big data to look through</param>
 /// <param name="maxLookback">the maximum number of bytes to backup.</param>
 /// <returns>location of the givenBytes, -1L if not found.</returns>
 public static long GetLocationOfGivenBytesBackup(long startLocation, byte[] givenBytes, byte[] data, int maxLookback)
 {
     //long num = (long)(data.Length - givenBytes.Length);
     for (long location = startLocation; location > 0; --location)
     {
         if (BinSearch.Find(givenBytes, location, data))
         {
             return(location);
         }
         else if (location < (startLocation - maxLookback))
         {
             break;
         }
     }
     return(-1L);
 }
        /// <summary>
        /// Searched through 'data' for the givenBytes.
        /// </summary>
        /// <param name="startLocation">Where to start in 'data'</param>
        /// <param name="givenBytes">the stuff to look for</param>
        /// <param name="data">the big data to look through</param>
        /// <returns>location of the givenBytes, -1L if not found.</returns>
        public static long GetLocationOfGivenBytes(long startLocation, byte[] givenBytes, byte[] data, long maxDistance)
        {
            long retVal = -1L;
            long num    = (long)(data.Length - givenBytes.Length);

            for (long location = startLocation; location < num; ++location)
            {
                if (BinSearch.Find(givenBytes, location, data))
                {
                    retVal = location;
                    break;
                }
                else if (maxDistance < location - startLocation)
                {
                    break;
                }
            }
            return(retVal);
        }