public int CopyTo(byte[] dest, int offset) { if (IsDisposed) { return(0); } int copied = First16Bits.CopyTo(dest, offset); offset += copied; MemorySegmentExtensions.CopyTo(SegmentToLast6Bytes, dest, offset); copied += SegmentToLast6Bytes.Count; return(copied); }
public bool TryGetBuffers(out System.Collections.Generic.IList <System.ArraySegment <byte> > buffer) { if (IsDisposed) { buffer = default(System.Collections.Generic.IList <System.ArraySegment <byte> >); return(false); } buffer = new System.Collections.Generic.List <ArraySegment <byte> >() { MemorySegmentExtensions.ToByteArraySegment(Header.First16Bits.m_Memory), MemorySegmentExtensions.ToByteArraySegment(Header.SegmentToLast6Bytes), MemorySegmentExtensions.ToByteArraySegment(Payload), }; return(true); }
/// <summary> /// Copies all of the data in the packet to the given destination. The amount of bytes copied is given by <see cref="Length"/> /// </summary> /// <param name="destination"></param> /// <param name="offset"></param> public void CopyTo(byte[] destination, int offset) { offset += Header.CopyTo(destination, offset); MemorySegmentExtensions.CopyTo(Payload, destination, offset); }