void HandleLog(string logString, string stackTrace, UnityEngine.LogType type) { DebugData debugdata = new DebugData() { logString = logString, stackTrace = stackTrace, type = (LogType)(int)type }; // SendData(logString); SendData(debugdata); }
public void SendData(DebugData msg) { if (this._netStream == null) { return; } ms = new MemoryStream(); // Serializer.Serialize<Message>((Stream)this._ms, (M0)msg); BinaryFormatter bf = new BinaryFormatter(); bf.Binder = new CustomizedBinder(); bf.Serialize(ms, msg); ms.Position = 0; byte[] buffer1 = new byte[ms.Length]; ms.Read(buffer1, 0, buffer1.Length); byte[] header = this.GetHeader(buffer1.Length); ms.Close(); byte[] buffer2 = new byte[buffer1.Length + header.Length]; Buffer.BlockCopy((Array)header, 0, (Array)buffer2, 0, header.Length); Buffer.BlockCopy((Array)buffer1, 0, (Array)buffer2, header.Length, buffer1.Length); _netStream.Write(buffer2, 0, buffer2.Length); }