/// <summary> /// Initialize sockets for file stream /// </summary> private void InitSockets() { FileTransfer = new TCPClient(AddressString, TransferPort, SSL, Logging); FileTransfer.OnMessage += (message) => { using (MemoryStream ms = new MemoryStream(message.Content)) { long id = TCPReaderWriter.ReadLong(ms, false); long index = TCPReaderWriter.ReadLong(ms, false); byte[] data = TCPReaderWriter.Read(ms, (uint)message.Content.Length - 16); TCPFileProgress progress = Incoming.Peek(); if (progress.TransferData.ID == id) { progress.Cache.AddData(new TCPFileTile() { ID = id, Data = data, Index = index }); } } }; }