public TArrayCopyMarshaler(int length, UFieldAddress arrayProperty, MarshalingDelegates <T> .FromNative fromNative, MarshalingDelegates <T> .ToNative toNative) { property = arrayProperty; helper = new FScriptArrayHelper(property.Address); innerFromNative = fromNative; innerToNative = toNative; }
public TArrayReadWriteMarshaler(int length, UFieldAddress arrayProperty, MarshalingDelegates <T> .FromNative fromNative, MarshalingDelegates <T> .ToNative toNative) { property = arrayProperty; helper = new FScriptArrayHelper(property.Address); wrappers = new TArrayReadWrite <T> [length]; innerFromNative = fromNative; innerToNative = toNative; }
public static FScriptArrayHelper CreateHelperFormInnerProperty(IntPtr innerProperty, IntPtr array) { FScriptArrayHelper scriptArrayHelper = new FScriptArrayHelper(); scriptArrayHelper.innerProperty = innerProperty; scriptArrayHelper.array = (FScriptArray *)array; scriptArrayHelper.elementSize = Native_UProperty.Get_ElementSize(innerProperty); return(scriptArrayHelper); }
public TArrayBase(UObject owner, UFieldAddress arrayProperty, IntPtr address, MarshalingDelegates <T> .FromNative fromNative, MarshalingDelegates <T> .ToNative toNative) { property = arrayProperty; array = (FScriptArray *)address; ArrayHelper = new FScriptArrayHelper(property.Address, address); Owner = owner; FromNative = fromNative; ToNative = toNative; }
public static IList <T> FromNative(IntPtr nativeBuffer, int arrayIndex, IntPtr prop) { IntPtr scriptArrayAddress = nativeBuffer + (arrayIndex * Marshal.SizeOf(typeof(FScriptArray))); FScriptArrayHelper helper = new FScriptArrayHelper(prop, scriptArrayAddress); unsafe { FScriptArray *array = (FScriptArray *)scriptArrayAddress; List <T> result = new List <T>(array->ArrayNum); for (int i = 0; i < array->ArrayNum; ++i) { result.Add(innerFromNative(array->Data, i, helper.InnerPropertyAddress)); } return(result); } }
internal static void ToNativeInternal(IntPtr nativeBuffer, int arrayIndex, IList <T> value, ref FScriptArrayHelper helper, MarshalingDelegates <T> .ToNative innerToNative) { IntPtr scriptArrayAddress = nativeBuffer + (arrayIndex * Marshal.SizeOf(typeof(FScriptArray))); helper.Array = scriptArrayAddress; // Make sure any existing elements are properly destroyed helper.EmptyAndAddZeroedValues(value == null ? 0 : value.Count); if (value == null) { return; } unsafe { FScriptArray *array = (FScriptArray *)scriptArrayAddress; for (int i = 0; i < value.Count; ++i) { innerToNative(array->Data, i, helper.InnerPropertyAddress, value[i]); } } }
public static void ToNative(IntPtr nativeBuffer, int arrayIndex, IntPtr prop, IList <T> value) { FScriptArrayHelper helper = new FScriptArrayHelper(prop); TArrayReadWriteMarshaler <T> .ToNativeInternal(nativeBuffer, arrayIndex, value, ref helper, innerToNative); }