Ejemplo n.º 1
0
 NativeArray<T> ReceiveArray<T>(LiveLinkTestConnection.Message msg, string error = null) where T : unmanaged
 {
     NativeArray<T> dat = default;
     if (error != null)
         Assert.DoesNotThrow(() => dat = msg.EventArgs.ReceiveArray<T>(), error);
     else
         Assert.DoesNotThrow(() => dat = msg.EventArgs.ReceiveArray<T>(), $"Failed to deserialize NativeArray<{typeof(T).Name}> from {msg.Data.Length} byte long message {msg.FormatBytes()}");
     var read = MessageEventArgsExtensions.SerializeUnmanagedArray(dat).Length;
     Assert.AreEqual(msg.Data.Length, read, $"Failed to read all bytes when receiving array of type {typeof(T).Name}. Read {read} out of {msg.Data.Length} bytes. Is that really the right type for this message?");
     return dat;
 }
Ejemplo n.º 2
0
 public void PostMessageArray <T>(int player, Guid messageId, T[] data) where T : unmanaged =>
 PostMessage(player, messageId, MessageEventArgsExtensions.SerializeUnmanagedArray(data));