unsafe void SendBuildArtifact(string artifactPath, string artifactFileName, int playerId) { LiveLinkMsg.LogInfo($"SendBuildArtifact => artifactPath={artifactPath}, playerId={playerId}"); if (!File.Exists(artifactPath)) { Debug.LogError($"Attempting to send file that doesn't exist on editor. {artifactPath}"); return; } using (FileStream fs = new FileStream(artifactPath, FileMode.Open, FileAccess.Read)) { // TODO: Any OS/language supports wide chars here? Should be tested var bufferSize = fs.Length + artifactFileName.Length * sizeof(char) + sizeof(int); if (fs.Length > int.MaxValue) { Debug.LogError($"File cannot be sent to the player because it exceeds the 2GB size limit. {artifactPath}"); return; } var buffer = new byte[bufferSize]; fixed(byte *data = buffer) { var writer = new UnsafeAppendBuffer(data, (int)bufferSize); writer.Add(artifactFileName); int numBytesToRead = (int)fs.Length; int numBytesRead = writer.Length; while (numBytesToRead > 0) { int n = fs.Read(buffer, numBytesRead, numBytesToRead); if (n == 0) { break; } numBytesRead += n; numBytesToRead -= n; } } m_Connection.Send(LiveLinkMsg.EditorSendBuildArtifact, buffer, playerId); } }
void RequestSessionHandshake(MessageEventArgs args) { var handshake = new LiveLinkHandshake(LiveLinkUtility.GetEditorLiveLinkId(), LiveLinkUtility.LiveLinkCacheGUID); m_Connection.Send(LiveLinkMsg.EditorResponseHandshakeLiveLink, handshake, args.playerId); }
public static void SendArray <T>(this IEditorConnection connection, Guid msgGuid, NativeArray <T> data, int playerId = 0) where T : unmanaged { connection.Send(msgGuid, MessageEventArgsExtensions.SerializeUnmanagedArray(data), playerId); }
void RequestSessionHandshake(MessageEventArgs args) { m_Connection.Send(LiveLinkMsg.EditorResponseHandshakeLiveLink, LiveLinkUtility.GetEditorLiveLinkId(), args.playerId); }