public static FramedClientBuffer FromPacket(ArraySegment<byte> buffer) { Ensure.IsNotNull(buffer.Array, "buffer.Array"); var intBuffer = new byte[buffer.Count + 4]; PrepareHeader(intBuffer, buffer.Count + 4); System.Buffer.BlockCopy(buffer.Array, buffer.Offset, intBuffer, 4, buffer.Count); var framedBuffer = new FramedClientBuffer(); framedBuffer.Packet = new ArraySegment<byte>(intBuffer, 4, buffer.Count); return framedBuffer; }
public static FramedClientBuffer FromPacket(ArraySegment <byte> buffer) { Ensure.IsNotNull(buffer.Array, "buffer.Array"); var intBuffer = new byte[buffer.Count + 4]; PrepareHeader(intBuffer, buffer.Count + 4); System.Buffer.BlockCopy(buffer.Array, buffer.Offset, intBuffer, 4, buffer.Count); var framedBuffer = new FramedClientBuffer(); framedBuffer.Packet = new ArraySegment <byte>(intBuffer, 4, buffer.Count); return(framedBuffer); }