GIFToWoWTexture/GIFConverter/TGASharpLib.cs
/// <summary>
/// Compare elements in one Array with different offsets.
/// </summary>
/// <typeparam name="T">Array type.</typeparam>
/// <param name="Arr">Some Array.</param>
/// <param name="Offset1">First offset.</param>
/// <param name="Offset2">Second offset.</param>
/// <param name="Count">Elements count which must be compared.</param>
/// <returns></returns>
Compare elements in one Array with different offsets.
Compare elements in one Array with different offsets .
public static bool IsElementsEqual<T>(T[] Arr, int Offset1, int Offset2, int Count)
        {
            if (Arr == null)
                throw new ArgumentNullException(nameof(Arr) + " is null!");
            if (Offset1 >= Arr.Length || Offset1 < 0)
                throw new ArgumentOutOfRangeException(nameof(Offset1) + " has wrong value!");
            if (Offset2 >= Arr.Length || Offset2 < 0)
                throw new ArgumentOutOfRangeException(nameof(Offset2) + " has wrong value!");
            if (Count <= 0 || Offset1 + Count > Arr.Length || Offset2 + Count > Arr.Length)
                throw new ArgumentOutOfRangeException(nameof(Count) + " has wrong value!");
            if (Offset1 == Offset2)
                return true;
            for (int i = 0; i < Count; i++)
                if (!Arr[Offset1 + i].Equals(Arr[Offset2 + i]))
                    return false;
            return true;
        }
public static bool IsElementsEqual < T > ( T [ ] Arr , int Offset1 , int Offset2 , int Count ) { if ( Arr == null ) throw new ArgumentNullException ( nameof ( Arr ) + " " ) ; if ( Offset1 >= Arr . Length || Offset1 < 0 ) throw new ArgumentOutOfRangeException ( nameof ( Offset1 ) + " " ) ; if ( Offset2 >= Arr . Length || Offset2 < 0 ) throw new ArgumentOutOfRangeException ( nameof ( Offset2 ) + " " ) ; if ( Count <= 0 || Offset1 + Count > Arr . Length || Offset2 + Count > Arr . Length ) throw new ArgumentOutOfRangeException ( nameof ( Count ) + " " ) ; if ( Offset1 == Offset2 ) return true ; for ( int i = 0 ; i < Count ; i ++ ) if ( ! Arr [ Offset1 + i ] . Equals ( Arr [ Offset2 + i ] ) ) return false ; return true ; }
Compare elements in one Array with different offsets.
Compare elements in one Array with different offsets .
None
Arr
T[]
None
Offset1
int
None
Offset2
int
None
Count
int
Elements count which must be compared.
Elements count which must be compared .
typeparam
None