public static string FromNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner) { unsafe { ScriptArray *ustring = (ScriptArray *)(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray))); return(UnrealInterop.MarshalIntPtrAsString(ustring->Data)); } }
public static void DestructInstance(IntPtr nativeBuffer, int arrayIndex) { unsafe { ScriptArray *ustring = (ScriptArray *)(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray))); Marshal.FreeCoTaskMem(ustring->Data); ustring->Data = IntPtr.Zero; ustring->ArrayNum = 0; ustring->ArrayMax = 0; } }
protected void AddInternal() { // adds a single value, not initialized // caller should have checked if we're destroyed CheckOwner("Trying to Add on an array on a destroyed Unreal Object"); unsafe { ScriptArray *sa = (ScriptArray *)NativeBuffer; } UnrealArrayBaseNativeMethods.AddToArray(NativeUnrealProperty, NativeBuffer); }
public IList <T> FromNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner) { List <T> result = new List <T>(); unsafe { ScriptArray *Array = (ScriptArray *)nativeBuffer; for (int i = 0; i < Array->ArrayNum; ++i) { result.Add(InnerTypeFromNative(Array->Data, i, owner)); } } return(result); }
public void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, IReadOnlyList <T> obj) { unsafe { ScriptArray *mirror = (ScriptArray *)(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray))); mirror->ArrayNum = obj.Count; mirror->ArrayMax = obj.Count; mirror->Data = Marshal.AllocCoTaskMem(obj.Count * ElementSize); for (int i = 0; i < obj.Count; ++i) { InnerTypeToNative(mirror->Data, i, owner, obj[i]); } } }