Beispiel #1
0
 public static void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, string obj)
 {
     unsafe
     {
         UnrealInterop.MarshalToUnrealString(obj, nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)));
     }
 }
Beispiel #2
0
 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));
     }
 }
Beispiel #3
0
 public SubclassOf(Type klass)
 {
     if (klass == typeof(T) || klass.IsSubclassOf(typeof(T)))
     {
         NativeClassPtr = UnrealInterop.GetNativeClassFromType(klass);
     }
     else
     {
         throw new ArgumentException(String.Format("{0} is not a subclass of {1}.", klass.Name, typeof(T).Name));
     }
 }
Beispiel #4
0
 public static void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, string obj)
 {
     unsafe
     {
         if (owner != null)
         {
             //MarshalToUnrealString allocates memory meant to be freed by managed code
             //SetStringValue marshals the string in place over top the existing string.
             UnrealInterop.SetStringValue(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)), obj);
         }
         else
         {
             // Allocate a new buffer for the string.  This marshaler still doesn't need to do any
             // cleanup on the managed side, but in the case where it's used for unowned memory,
             // the memory needs to have been allocated in a way where native code can clean it up.
             UnrealInterop.MarshalToUnrealString(obj, nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)));
         }
     }
 }
Beispiel #5
0
        static Key()
        {
            IntPtr nativeStructPtr = UnrealInterop.GetNativeStructFromName("Key");

            NativeDataSize = UnrealInterop.GetNativeStructSize(nativeStructPtr);
        }