NetworkCommsDotNet.Tools.PacketBuilder.GetAllData C# (CSharp) Method

GetAllData() public method

Copies all cached bytes into a single array and returns. Original data is left unchanged.
public GetAllData ( ) : byte[]
return byte[]
        public byte[] GetAllData()
        {
            lock (Locker)
            {
                byte[] returnArray = new byte[totalBytesCached];

                int currentStart = 0;
                for (int i = 0; i < packets.Count; i++)
                {
                    Buffer.BlockCopy(packets[i], 0, returnArray, currentStart, packetActualBytes[i]);
                    currentStart += packetActualBytes[i];
                }

                return returnArray;
            }
        }