MinecraftTabPatcher/Utils.cs
/// <summary>
/// Returns the index of <paramref name="search"/> in <paramref name="array"/>.
/// Returns -1 if the search array was not found.
/// </summary>
/// <param name="array"></param>
/// <param name="search"></param>
/// <param name="start"></param>
/// <returns></returns>
Returns the index of  in .
Returns -1 if the search array was not found.
Returns the index of in . Returns - 1 if the search array was not found .
public static int BinaryIndexOf(byte[] array, byte[] search, int start = 0)
        {
            int found = 0;
            int foundMax = search.Length;
            int len = array.Length;
            for (int i = start; i < len; i++)
            {
                var c = array[i];
                if (c == search[found])
                {
                    found++;
                    if (found == foundMax)
                    {
                        return i - foundMax + 1;
                    }
                }
                else
                {
                    found = 0;
                }
            }
            return -1;
        }
public static int BinaryIndexOf ( byte [ ] array , byte [ ] search , int start = 0 ) { int found = 0 ; int foundMax = search . Length ; int len = array . Length ; for ( int i = start ; i < len ; i ++ ) { var c = array [ i ] ; if ( c == search [ found ] ) { found ++ ; if ( found == foundMax ) { return i - foundMax + 1 ; } } else { found = 0 ; } } return - 1 ; }
Returns the index of  in .
Returns the index of in .
None
array
byte[]
None
search
byte[]
None
start
int
None