public static bool GetArray2Arg<ARG2, T>(int arg1, ARG2 arg2, GetArray2ArgDel<ARG2, T> func, [Out] T[] data, int start, int count) { return GetArray(arg1, arg2, 0, null, func, null, data, start, count, 1); }
public static bool SetArray<ARG2, T>( int arg1, ARG2 arg2, GetArray1ArgDel<T> func1, GetArray2ArgDel<ARG2, T> func2, [Out] T[] data, int start, int count, int tupleSize) { int maxArraySize = HEU_Defines.HAPI_MAX_PAGE_SIZE / (Marshal.SizeOf(typeof(T)) * tupleSize); int localCount = count; int currentIndex = start; bool bResult = true; while (localCount > 0) { int length = 0; if (localCount > maxArraySize) { length = maxArraySize; localCount -= maxArraySize; } else { length = localCount; localCount = 0; } T[] localArray = new T[length * tupleSize]; // Copy from main array to temporary for (int i = currentIndex; i < (currentIndex + length); ++i) { for (int j = 0; j < tupleSize; ++j) { localArray[(i - currentIndex) * tupleSize + j] = data[i * tupleSize + j]; } } if (func1 != null) { bResult = func1(arg1, localArray, currentIndex, length); } else if (func2 != null) { bResult = func2(arg1, arg2, localArray, currentIndex, length); } else { HEU_HAPIUtility.LogError("No valid delegates given to SetArray<T>!"); return false; } if (!bResult) { break; } currentIndex += length; } return bResult; }